Skip to content

Fix CJK MTEXT rendering with tiny wrap width#264

Open
mi-chow wants to merge 1 commit into
mlightcad:mainfrom
mi-chow:fix-mtext-tiny-wrap-width
Open

Fix CJK MTEXT rendering with tiny wrap width#264
mi-chow wants to merge 1 commit into
mlightcad:mainfrom
mi-chow:fix-mtext-tiny-wrap-width

Conversation

@mi-chow
Copy link
Copy Markdown

@mi-chow mi-chow commented May 12, 2026

Summary

Fixes MTEXT rendering when a DXF contains a positive wrap width that is smaller than the text height.

In this case, the MTEXT renderer treats the tiny value as the word-wrap width, which forces CJK text to wrap one character per line. This patch detects clearly impossible MTEXT widths and estimates a usable width from the longest explicit MTEXT line while preserving explicit line breaks such as \P.

Test

corepack pnpm test -- packages/three-renderer/__tests__/AcTrMText.spec.ts

@mlightcad
Copy link
Copy Markdown
Owner

mlightcad commented May 14, 2026

@mi-chow Thanks for your PR. Can you share me dxf file that you used so that I can have a try. Moreover, it looks like that it is better to move this change to module mtext-renderer instead of cad-viewer.

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.

3 participants