Skip to content

Annotate fonts + underline, signature pad upgrades, editor polish#129

Merged
sumitsahoo merged 4 commits into
mainfrom
dev
Jun 23, 2026
Merged

Annotate fonts + underline, signature pad upgrades, editor polish#129
sumitsahoo merged 4 commits into
mainfrom
dev

Conversation

@sumitsahoo

Copy link
Copy Markdown
Collaborator

Promotes the latest dev work to main (production). Bundles #128.

Highlights

Annotate — rich text

  • 14 font families (3 standard + 11 bundled open-source TTFs), each with bold / italic / underline. Embedded fonts are subset-embedded into the export via fontkit so the placed preview matches the burned PDF. Self-hosted (offline-first), lazy-loaded, runtime-cached — not precached.

Signature

  • Larger 600×360 pad for tablet/pencil signing; Draw/Upload is now a segmented tab.
  • Export crops to the ink's bounding box, so a signature places at its true size rather than being boxed by transparent margins.

Editor polish

  • Command palette: focus restoration on close, ARIA combobox wiring, prefers-reduced-motion auto-scroll.
  • Annotate: clears stale italic on no-italic families (e.g. Oswald); no faked oblique the PDF can't render.
  • README updated.

Testing

  • vp check clean · vp build clean · 316/316 unit tests
  • e2e (real browser): annotate-fonts ✓, signature-pen ✓, command-palette ✓, editor-smoke ✓

Note: merging to main auto-deploys via Cloudflare Workers Builds.

🤖 Generated with Claude Code

- Bigger pad for tablet/pencil signing: intrinsic 500×200 → 600×360 (5:2 → 5:3,
  ~50% taller signing area) at higher resolution for crisp stylus strokes. The
  intrinsic ratio drives the displayed height (width is panel-bound), so it scales
  without distorting the placed/exported signature.
- Draw/Upload is now a sliding-thumb segmented tab (the shared Segmented control
  used by Crop's "All pages / This page") instead of two separate buttons.
Expand the text tool's font picker from 3 to 14 families and add an underline
toggle alongside bold/italic.

Fonts: a PDF can only render Helvetica/Times/Courier without embedding, so the
new families (Roboto, Open Sans, Lato, Montserrat, Poppins, Merriweather, Lora,
Playfair Display, Roboto Mono, Source Code Pro, Oswald) are bundled Latin-subset
TTFs (SIL OFL / Apache — see public/fonts/README.md), self-hosted so the app
stays offline-first. At burn time they're fetched + fontkit subset-embedded into
the exported PDF; the same TTF backs the on-canvas @font-face preview, so what
you place is what exports. Single FONT_FAMILIES registry drives the picker, the
preview, and the burn so they can't drift. Bold/Italic/Bold-Italic per family
(Oswald has no italic → the toggle disables); TTFs are not precached (the glob
omits .ttf) and instead runtime-cached on first use to keep the install lean.

Underline is a drawn rule (font-independent), rendered identically in the canvas
preview, the inline editor, and the PDF burn.

Adds @pdf-lib/fontkit. Verified: vp check, vp test (316), vp build, a new e2e
(annotate-fonts.e2e.ts — picker lists 14, places underlined Roboto, asserts the
export embeds a Roboto subset), and editor-smoke for no regressions.
…ont italic

Audit follow-ups on the recently-added work:

- signature: export now crops to the ink bounding box. The pad was enlarged
  to 600x360 for tablet/pencil signing, but exporting the whole canvas wrapped
  small signatures in transparent margins, so they placed undersized + offset.
- command palette: restore focus to the opener on close (was dumped on <body>);
  wire the ARIA combobox pattern (aria-activedescendant / aria-controls / option
  ids); honour prefers-reduced-motion for the arrow-key auto-scroll.
- annotate: clear a stale italic flag when switching to a family with no italic
  (e.g. Oswald) and stop cssFont synthesizing an oblique the PDF burn can't —
  fixes a WYSIWYG mismatch for no-italic families / legacy drafts.
- readme: note the richer annotate text (14 fonts, bold/italic/underline).
Annotate fonts + underline, signature pad upgrades, editor polish
@cloudflare-workers-and-pages

Copy link
Copy Markdown

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Preview URL Updated (UTC)
✅ Deployment successful!
View logs
cloakpdf 5f063d8 Commit Preview URL

Branch Preview URL
Jun 23 2026, 10:37 AM

@sumitsahoo sumitsahoo merged commit 2e21eb9 into main Jun 23, 2026
5 checks passed
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