Skip to content

fix: prefer mesh defaults over BIGFONT and correct MTEXT width factor - #58

Merged
mlightcad merged 1 commit into
mainfrom
fix/missing-font-latin-wrap-and-width-factor
Sep 7, 2026
Merged

mlightcad merged 1 commit into
mainfrom
fix/missing-font-latin-wrap-and-width-factor

Conversation

@mlightcad

Copy link
Copy Markdown
Owner

Summary

  • Prefer non-BIGFONT default fonts (e.g. simsun) when a style font is missing, so Latin runs are not measured with fullwidth GBK cells from hztxt/gbcbig.
  • Reorder modern / cjk presets to put simsun first, and skip BIGFONT faces in findAndReplaceFont fallback selection.
  • Fix absolute/relative \W width-factor handling to match AutoCAD/ezdxf (absolute replaces; relative multiplies current factor).
  • Add a regression test for the common Chinese missing-style case (标准 + Latin drawing number wrapping).

Test plan

  • Run unit tests in packages/mtext-renderer (especially fontManager and mtext.missing-font-latin-wrap)
  • Confirm missing style font 标准 resolves to simsun when both hztxt and simsun are loaded
  • Confirm {\W0.667;\T1.1;FYA/G-AE-01-01-2018} stays on one line inside AutoCAD defined width (~31.95)
  • Spot-check CJK glyph fallback still works via BIGFONT after mesh primary face

Missing style fonts (e.g. 标准) were falling back to hztxt BIGFONT, which maps ASCII to fullwidth cells and falsely wraps Latin MTEXT. Also align absolute/relative \W with AutoCAD semantics.
@mlightcad mlightcad self-assigned this Sep 7, 2026
@mlightcad mlightcad added the enhancement New feature or request label Sep 7, 2026
@mlightcad
mlightcad merged commit 51a8fc2 into main Sep 7, 2026
2 checks passed
@mlightcad
mlightcad deleted the fix/missing-font-latin-wrap-and-width-factor branch September 7, 2026 00:22
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