Skip to content

feat: await referenced fonts before lazy draw - #55

Merged
mlightcad merged 1 commit into
mainfrom
feat/await-fonts-before-draw
Aug 9, 2026
Merged

mlightcad merged 1 commit into
mainfrom
feat/await-fonts-before-draw

Conversation

@mlightcad

@mlightcad mlightcad commented Aug 9, 2026

Copy link
Copy Markdown
Owner

Summary

  • Add FontManager.awaitFontsBeforeDraw and per-draw { awaitFonts } so lazy loading can wait for content/style fonts before building geometry (single draw instead of fallback + fontLoaded redraw).
  • Propagate the flag through UnifiedRenderer / worker pool (setAwaitFontsBeforeDraw), and make requestFonts return an awaitable promise.
  • Wire an example checkbox and cover await / options / worker sync in remote font-loading tests.

Test plan

  • npm test --workspace=@mlightcad/mtext-renderer -- test/worker/render-remote-font-loading.test.ts
  • Example: enable Lazy Font Loading + Await Fonts Before Draw, Release Fonts, then Render — first paint should wait and not progressively redraw on fontLoaded
  • Example: Lazy ON, Await OFF — confirm fallback-then-redraw on fontLoaded still works
  • Worker and main-thread render modes both respect the await flag

@mlightcad mlightcad self-assigned this Aug 9, 2026
@mlightcad mlightcad added the enhancement New feature or request label Aug 9, 2026
Co-authored-by: Cursor <cursoragent@cursor.com>
@mlightcad
mlightcad force-pushed the feat/await-fonts-before-draw branch from 65a57b9 to 025f5a6 Compare August 9, 2026 07:13
@mlightcad
mlightcad merged commit 7547980 into main Aug 9, 2026
2 checks passed
@mlightcad
mlightcad deleted the feat/await-fonts-before-draw branch August 9, 2026 08:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant