Skip to content

fix: expand fixed-width \U+XXXX escapes and iterate by code point - #59

Merged
mlightcad merged 2 commits into
mainfrom
fix/unicode-escape-and-supplementary-chars
Sep 7, 2026
Merged

mlightcad merged 2 commits into
mainfrom
fix/unicode-escape-and-supplementary-chars

Conversation

@mlightcad

Copy link
Copy Markdown
Owner

Summary

  • Pre-expand AutoCAD \U+XXXX (exactly four hex digits) before MText parsing so trailing hex digits are not absorbed (fixes cad-viewer#615, e.g. \U+22054.0∅4.0)
  • Iterate text by Unicode code point in SHX font and MTextProcessor so supplementary-plane characters (emoji / surrogate pairs) are not split into halves
  • Bump @mlightcad/mtext-parser to ^1.5.1 and package version to 0.12.6; add unit tests and example coverage

Test plan

  • pnpm --filter @mlightcad/mtext-renderer test -- test/renderer/unicodeEscapes.test.ts test/renderer/mtext.processor.test.ts
  • In example app, open basic sample and confirm \U+22054.0通 renders as ∅4.0通
  • Confirm literal 😀 / \U+D83D\U+DE00 are treated as one code point each (missing glyph ? is OK if font lacks emoji)

Prevent greedy hex absorption after \U+XXXX (cad-viewer#615) and keep supplementary-plane characters from being split into UTF-16 surrogates.
@mlightcad mlightcad self-assigned this Sep 7, 2026
@mlightcad mlightcad added the bug Something isn't working label Sep 7, 2026
@mlightcad
mlightcad merged commit 8d05e90 into main Sep 7, 2026
3 of 4 checks passed
@mlightcad
mlightcad deleted the fix/unicode-escape-and-supplementary-chars branch September 7, 2026 07:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant