Repository navigation
Conversation
This branch has not been deployed
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.
What kind of change does this PR introduce?
Bug fix. Fixes #1060.
dash()throws for any length of0, so the usual way to draw a dotted line,doc.lineCap('round').dash(0, { space: 2 })(dash array[0 2]), fails withlengths must be numeric and greater than zero. PDF 32000-1 §8.4.3.6 only requires the dash array's numbers to be non-negative and not all zero. The check was added in #969 for #949, wheredash(0)wrote[0 0] 0 d, an all-zero array that Edge and Adobe Reader refused. As discussed in #1060, the check went further than that case needed.This change:
>= 0as long as at least one is greater than zero, sodash(0, { space: 2 })writes[0 2] 0 danddash([2, 0, 3])is accepted;dash(0)/dash([0, 0])(the Use of dash(0) emits PDF that some readers interpret as corrupt #949 case), negative numbers,nulland other non-finite values;dash([])writes[] 0 d, which is a solid line);lengths must be numeric and non-negative, and not all zero, and updatesdocs/vector.md.Checklist:
Tests in
tests/unit/vector.spec.js:dash(0, { space: 2 })writes[0 2] 0 ddash([2, 0, 3])changed from "throws" to "does not throw"dash([0, 0])throws0,-1andnullcases still throw, with the updated messageOn
masterthe new and changed tests fail (6 failed, 11 passed invector.spec.js, including the message updates). With the fix, all 17 pass. Ranyarn test(62 files, 552 tests, unit and visual),yarn lintandyarn prettier, all passing. The output was not opened in Adobe Reader or Edge; the[0 2]content stream was only checked as text against the spec.