Skip to content

Draw an empty dash pattern as a solid line - #106

Merged
bobsingor merged 1 commit into
embedpdf/mainfrom
embedpdf/fix/iso-dashes
Nov 3, 2026
Merged

bobsingor merged 1 commit into
embedpdf/mainfrom
embedpdf/fix/iso-dashes

Conversation

@bobsingor

Copy link
Copy Markdown
Contributor

ISO 32000 says an empty dash array is a solid line (8.4.3.6). A dashed /BS whose /D is [] drew the default dash [3] instead, because the generator read an empty /D as one left out. This is the one case where our dash rule was off ISO.

  • A dashed /BS draws its /D, the default [3] when it has none, and no dash at all for an empty one. That covers shapes, lines, polylines and ink (GetDashPatternString) and form widget borders (GetBorderStyleInfo, which now draws such a border solid).
  • EPDFAnnot_GetBorderStyle reads such a border as solid, as it already read a /Border whose dash array is empty, so the engine reports what is drawn.

A /Border dash array still draws its own numbers (ISO 32000 table 166).

Context: Acrobat draws dashes by a rule of its own, checked on Nov 3 across six kinds. It treats a /BS without /D as solid, and draws any /Border dash array as [3] whatever its numbers. We keep ISO's rule; the engine side (embedpdf fix/iso-dashes) writes a dashed border's default pattern out as /D [3 3], so Acrobat draws it dashed too.

Tests

  • AnEmptyDashPatternIsASolidLine: on a square, circle, line and ink, no /D draws [3 ] 0 d and reads dashed; /D [] and /Border [0 0 2 []] draw no dash and read solid. Recorded as a layer-mode writer.
  • TextFieldDrawsItsBorderStyle: an empty /D on a widget draws its solid border.

On macOS, the full unit, embedder and pixel suites fail the same tests as fork main (986db17): unit 2 (the ephemeral ink tests that #105 fixes), embedder 12, pixel 51 with the same 2 surprises. The engine's drawing conformance passes in full, on the local engine and the cloud engine, against a runtime built from this branch. Linux CI hasn't run yet.

ISO 32000 says an empty dash array is a solid line (8.4.3.6). A dashed /BS whose /D is [] drew the default dash [3] instead, because the generator read an empty /D as a /D left out. Now:

- A dashed /BS draws its /D, the default [3] when it has none, and no dash at all for an empty one: shapes, lines, polylines, ink (GetDashPatternString) and form widget borders (GetBorderStyleInfo, which now draws such a border solid).
- EPDFAnnot_GetBorderStyle reads such a border as solid, as it already read a /Border whose dash array is empty, so the engine reports what is drawn.

A /Border dash array is drawn as before, its own numbers (ISO 32000 table 166). Acrobat draws dashes by a rule of its own (a /BS without /D solid, any /Border dash array as [3]); the engine keeps ISO's.

Tests: AnEmptyDashPatternIsASolidLine (square, circle, line and ink: no /D draws [3 ] 0 d and reads dashed; /D [] and /Border [0 0 2 []] draw no dash and read solid), and TextFieldDrawsItsBorderStyle with an empty /D on a widget; the new test recorded as a layer-mode writer. On macOS the full unit, embedder and pixel suites fail the same tests as fork main (986db17): unit 2 (the ephemeral ink tests #105 fixes), embedder 12, pixel 51 and the same 2 surprises.
@bobsingor
bobsingor merged commit 5bbe69f into embedpdf/main Nov 3, 2026
1 check passed
@bobsingor
bobsingor deleted the embedpdf/fix/iso-dashes branch November 3, 2026 20:53
roanutil pushed a commit to roanutil/embed-pdf-viewer that referenced this pull request Nov 4, 2026
…olid

Dashes keep ISO 32000's rule, with two fixes that make every app draw the engine's dashed borders the same:

- A dashed border written without a pattern of its own (a create, or an update that makes a border dashed or clears its pattern while dashed) now states the default, [3, 3], and reads it back. ISO 32000 draws a dashed /BS without /D with the default dash, but Acrobat, redrawing one, draws it solid (checked Nov 3: output/dash-acrobat-check in the platform repo). The rule lives in engine-core's derive step (resolve/dash.ts: dashDraftFollows, dashPatchFollows), so the engine's writes and the viewer's predictions agree, and in placedWidgetOf for a form's widget placements. A patch that leaves the border alone leaves another app's dashed border without /D as it is: it reads dashArray null and draws the default.
- An empty /D is a solid line (ISO 32000 8.4.3.6). The runtime now draws it so and reads such a border as 'solid' (embedpdf/runtime, "Draw an empty dash pattern as a solid line"), so the viewer, which draws what the engine reads, agrees with no change of its own.

Conformance (runDrawingDetailsConformance): a dashed create reads [3, 3]; dashArray null on a dashed border reads [3, 3]; another app's dashed square without /D reads dashed with dashArray null; one with /D [] reads solid. With the pinned runtime, the local engine and the cloud engine pass all 11. Docs: the style table and "Dashed lines", synced to both sites. API snapshots: placedWidgetOf, the drawing fixture.

Runtime: embedpdf/runtime#106, in the pinned f2dd40897.
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.

1 participant