Repository navigation
Paint line elements with stroke only - #144
Open
mkantautas wants to merge 1 commit into
Open
mkantautas wants to merge 1 commit into
mkantautas wants to merge 1 commit into
Conversation
SVG line elements are never filled. Shape::after() applied the fill, black by default, to lines as well, so a line with stroke="none" still emitted a zero-area fill that PDF viewers draw as a hairline, and a stroked line was filled and stroked. Refs dompdf#122
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
SVG line elements are never filled (SVG 1.1, 9.5).
Shape::after()applied the fill to lines as well, and the default fill is black, so:stroke="none"or no stroke emits a zero-area fill (m … l f), which PDF viewers draw as a hairline. This is the first problem in line not rendered correctly #122.B) instead of stroked (S).This adds
Shape::isFillable(), whichLineoverrides to return false. A line is stroked when it has a stroke and otherwise ends its path without painting (n).Rendered through Dompdf 3.1.6 (an
<img>with an SVG data URI, uncompressed output):<line x1="0" y1="20" x2="200" y2="20" stroke="none"/>f, a hairline in PDFium and popplern, nothing drawnstroke="#3366cc" stroke-width="4"BS<rect width="200" height="40" fill="#eeeeee"/>re fre ftests/Svg/ShapePaintTest.phprenders each shape onto a mocked surface and checks the paint call. Its four line cases fail on master; with this change the suite passes on PHP 7.1 to 8.4 (PHPUnit 7.5 to 11.5). The percentagestroke-opacityreported in #122 stays open.