Skip to content

Drop all-zero stroke-dasharray when emitting PDF - #382

Open
amandeavor wants to merge 1 commit into
yWorks:masterfrom
amandeavor:fix/drop-zero-dasharray
Open

amandeavor wants to merge 1 commit into
yWorks:masterfrom
amandeavor:fix/drop-zero-dasharray

Conversation

@amandeavor

Copy link
Copy Markdown
Contributor

Problem

stroke-dasharray="0.00 0.00" is valid SVG but produces an invalid PDF dash pattern. PDF viewers (including Acrobat) can error on dash arrays whose lengths are all zero.

Fixes #343

Solution

When a parsed stroke-dasharray contains only zeros, emit a solid stroke ([]) instead of writing the zero-length dash pattern.

Verification

  • Added test/strokes/zero-dasharray regression covering 0.00 0.00 alongside a solid line
  • Asserts the PDF content stream does not contain an all-zero d operator
  • npm test -- test/strokes/strokes.spec.ts — 4 passed
  • npm run typecheck / npm run lint / npm run format — clean

PDF dash patterns with only zero lengths are invalid and cause viewer
errors. When SVG specifies values like "0.00 0.00", treat the stroke as
solid instead of writing the pattern.

Fixes yWorks#343
Copilot AI lite review requested due to automatic review settings September 25, 2026 07:25

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

stroke-dasharray="0.00 0.00" should probably be dropped

2 participants