Skip to content

Pin the runtime to f2dd40897: shapes without a stroke, and ink drawn as Acrobat draws it - #971

Merged
bobsingor merged 3 commits into
mainfrom
feature/ink-curves
Nov 4, 2026
Merged

bobsingor merged 3 commits into
mainfrom
feature/ink-curves

Conversation

@bobsingor

Copy link
Copy Markdown
Contributor

Pins the runtime release that draws shapes and ink as Acrobat does, with the two viewer and engine halves that release needs: shapes, lines and ink without a stroke, and ink drawn with Acrobat's curves.

Runtime. Pinned to f2dd40897, the release of embedpdf/runtime#101 to embedpdf/runtime#108, and runtime-src points at it. Two new functions join the generated list: EPDFAnnot_SetNoColor (embedpdf/runtime#104), which this PR uses, and EPDFAnnot_SetSubtype (embedpdf/runtime#103), which the annotation kind change will use. The release also carries the Latin fallback floor (embedpdf/runtime#101, embedpdf/runtime#102) and ISO dashes (embedpdf/runtime#106), whose engine halves follow in their own PRs.

No stroke: color: null. A square, circle, polygon, polyline, line or ink takes color: null and keeps its strokeWidth. The engine writes /C [], ISO 32000's empty colour, and reads an empty or missing /C as null, as Acrobat draws both. A missing /C used to read as red. A line, polyline or ink at width 0 is a hairline with a 1 pt line's endings (Paint.hairline). The style panel's allowsNone offers "none" on strokes, fills and backgrounds, never on ink or markup. runNoStrokeConformance checks reads, writes, creates and pixels on both engines from the Acrobat grid's cases. Contract and SDK: color is nullable on the six kinds (api:sync).

Ink with Acrobat's curves. The runtime now writes each ink stroke as the cubic Béziers Acrobat fits to its points (Schneider's fit without the Newton step, within sqrt(2) pt of every point; a one-point stroke is a dot of radius 0.5). The viewer draws the same curves: ink-curves.ts is one fit for the scene (a path of C segments, round caps, no join), the box (the runtime's /Rect rules) and the hit test (curves flattened to 0.05 pt). The cloudy border's Bézier helpers moved to bezier.ts, which ink shares.

Checks, with the release's darwin-arm64 and wasm32 payloads built locally (both sha256s match the pin):

  • Engine 1909 (wasm and native), cloud engine 1106, engine-core 1015, core-annotation 659 pass.
  • The pin alone fails four of them, annotation rect > the viewer shows the rect the engine writes > ink on wasm and native: the runtime's ink /Rect follows the curves, which the viewer learns from the ink commit. So the pin lands with it.
  • The runtime's and the viewer's tests hold the fit to Acrobat's curves for the eight cases of the Acrobat check to 0.001 pt, and pin the tolerance with a dense zigzag (37 cubics; 39 below T 1.2747, 33 above 1.5062).
  • api:check, and docs:check for both sites.

The release brings fork PRs 101 to 108: no stroke without /C, ink drawn
with the curves Acrobat fits, ISO dashes (an empty /D is solid), an
annotation's kind changed in place (EPDFAnnot_SetSubtype), and the Latin
fallback floor. EPDFAnnot_SetNoColor and EPDFAnnot_SetSubtype join the
generated function list, and runtime-src moves to the pin.
A square, circle, polygon, polyline, line or ink annotation takes `color: null` for no stroke and keeps its `strokeWidth`. The engine writes it as `/C []`, the empty colour ISO 32000 defines as no colour, and reads an empty or missing `/C` as `null`: that's how Acrobat draws both (checked with a grid of shapes without appearance streams). A missing `/C` used to read as red.

- Engine: the stroked kinds' `color` is nullable; the reader drops its red default; the writer uses the runtime's new `EPDFAnnot_SetNoColor`. `runNoStrokeConformance` checks reads, writes, creates and pixels on both engines, from the Acrobat grid's cases.
- Viewer: `Style.color` may be `null` and the scene paints no stroke for it. A line, polyline or ink at width 0 is a hairline (`Paint.hairline`, one pixel at any zoom) with a 1 pt line's endings, as the runtime and Acrobat draw it; it drew nothing before.
- Style panel: a colour property's `allowsNone` offers "none". On a shape's or line's stroke and fill, a text box's background, a redaction's fill and a form field's border and background; never on ink or markup, which would just vanish. Tool defaults take `color: null` too.
- Docs: "Without a line" on the shapes page, the style section and the style-panel property table; the style-panel samples use `allowsNone`. Synced to both sites.
- Contract and SDK: `color` is nullable on the six kinds (`pnpm api:sync`). API snapshots, changesets.

Runtime: embedpdf/runtime#104 (`EPDFAnnot_SetNoColor`), in the pinned f2dd40897.
The viewer draws an ink stroke as the runtime now writes it (embedpdf/runtime, cpdf_ink_curves.h), which is how Acrobat draws it: cubic Béziers fitted to the points as Schneider fits digitized curves, without his Newton step, never more than sqrt(2) pt from any point, and a stroke of one point as a dot of radius 0.5. The fit is ink-curves.ts, one implementation for the scene, the box and the hit test:

- Scene: each stroke is a `path` of `C` segments with round caps and no join (the curves meet smoothly); a dot is an `ellipse` filled in the stroke's colour.
- Box: the points and what the curves paint, as the runtime measures /Rect: the curves' ends and turns, half the width across each curve's ends, round caps, past each turn, and a miter where two curves meet in a corner.
- Hit test and marquee: the curves flattened to within 0.05 pt; a dot is a filled oval.

Tested against the same Acrobat numbers as the runtime: the eight cases of ink-curves.pdf to 0.001 pt, the tolerance pinned by the dense zigzag (37 cubics; 39 below 1.2747, 33 above 1.5062), and the box of the runtime's /Rect test (top at 93.172844). The fit gives the same curves in page space as in the file's.

The cloudy border's Bézier helpers moved to bezier.ts, which ink shares. Docs: the ink section of engine/annotations/shapes, synced to both sites. API snapshot: `scene`'s body.

Runtime: embedpdf/runtime#105, in the pinned f2dd40897.
@vercel

vercel Bot commented Nov 3, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
cloudpdf-com Ready Ready Preview Nov 4, 2026 6:26am UTC
embed-pdf-website Error Error Nov 4, 2026 6:26am UTC

Request Review

This branch had an error being deployed

1 failed and 1 active deployments
Preview – cloudpdf-com — c70e3ddf Deployed Nov 4, 2026 by vercel[bot]
Preview – embed-pdf-website — c70e3ddf Deployed Nov 4, 2026 by vercel[bot]
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