Skip to content

feat: separate mesh/SHX default fonts and preserve worker precision - #27

Open
mlightcad wants to merge 1 commit into
mainfrom
feat/default
Open

mlightcad wants to merge 1 commit into
mainfrom
feat/default

Conversation

@mlightcad

Copy link
Copy Markdown
Owner

Summary

  • Introduce role-based default fallback fonts in FontManager: mesh (defaultMeshFont), primary SHX (defaultShxFont), and SHX big font (defaultShxBigFont), with indAndReplaceFont resolving by font type/role instead of a single defaultFont.
  • Add setDefaultFonts(mesh, shx, shxBig) on UnifiedRenderer / main-thread / Web Worker renderers; initialization loads all three defaults.
  • Fix Web Worker MText serialization/reconstruction so large drawing insertion coordinates stay on the root group transform while glyph geometry remains local (avoids float precision loss in vertex buffers).
  • Fix decoration line geometries to use explicit indices; ensure unindexed line geometries are indexed before merge.
  • Update the example app with separate default font dropdowns and demo cases for missing inline/style fonts.
  • Bump @mlightcad/mtext-renderer to 0.11.0.

Test plan

  • Run
    x test mtext-renderer (or package test script) and confirm ontManager, mtext.processor, mtext.anchor, and webWorkerRenderer.precision tests pass.
  • Run the example app; verify mesh / English SHX / big SHX default selectors reload fonts and re-render.
  • In the example font demo, confirm missing mesh/SHX inline fonts and missing text-style primary/big fonts fall back to the configured defaults.
  • Render MText at large world coordinates in Web Worker mode and confirm position/anchor match main-thread rendering (no jitter or offset).

Made with Cursor

…t large coordinates

Add role-based fallback fonts (mesh, primary SHX, big SHX) via FontManager and setDefaultFonts API. Fix Web Worker serialization so large insertion coordinates live on the root transform with local glyph geometry. Update the example demo and bump version to 0.11.0.

Co-authored-by: Cursor <cursoragent@cursor.com>

This branch has not been deployed

No deployments
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