Repository navigation
fix(render): integrate Vietnamese legacy transcoding and respect text width metrics - #1
Merged
vantruong-dang merged 2 commits intoOct 24, 2026
Conversation
…factor - Connect transcode_vietnamese in place_text_entity, layout_mtext_entity, and table cells - Preserve entity width_factor multiplied by TextStyle width_factor (twf * swf) - Combine entity oblique with TextStyle oblique for precise text column layout - Resolve text fonts dynamically using style name and font name hints
…yout metrics # Conflicts: # crates/render/src/dim.rs
vantruong-dang
force-pushed
the
feature/vietnamese-legacy-transcoder
branch
from
October 23, 2026 08:10
514cdfa to
1e8c71c
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR is stacked on top of PR storytold#1877 (Fonts). It completes the integration of the legacy Vietnamese transcoder (
cadcraft-fonts::vietnamese) into the rendering pipeline.Previously,
TextFont::resolvemapped legacy font names (e.g.,.VnTime,VNI-Helve) to modern Unicode faces, but raw strings were passed unchanged to the shaper, causing mojibake (e.g.,B¶n vÏinstead ofBản vẽ). Additionally, legacy text suffered from overlap issues because text stylewidth_factor(DXF group 41) was ignored in layout calculations.Key Changes
Render Pipeline Integration:
crates/render/src/lib.rs: Wrappedplace_text_entity,layout_mtext_entity, anddim_textwithtranscode_vietnamese(value, hint)and dynamic font resolution.width_factormultiplied byTextStyle.width_factor(twf * swf) and combine oblique angles (t.oblique + ts.oblique).Table & Dimension Layout:
crates/render/src/table.rs: Transcodes table cell text and resolves Vietnamese font hints.crates/render/src/dim.rs: Transcodes user dimension text overrides andDIMPOSTstrings.crates/render/src/linetype_text.rs&tolerance.rs: Added transcoding for complex linetype texts and geometric tolerance callouts.Integration Tests (
crates/render/src/tests.rs):place_text_entity_transcodes_legacy_vietnamese: Verifies TCVN3 and VNI TEXT entities shape into proper Unicode glyphs.text_width_factor_compresses_bounding_box: Proves width compression and style factor multiplication prevent text overlap.mtext_segments_transcode_legacy_vietnamese: Tests multiline MTEXT with\Pparagraph breaks.table_cell_transcodes_and_renders_vietnamese: Tests table cell rendering in DisplayList.dimension_override_transcodes_vietnamese: Tests dimension override strings.Quality Gates
cargo test -p cadcraft-render: 96/96 tests pass (100%).cargo test -p cadcraft-fonts: 71/71 tests pass (100%).cargo xtask layers: 16/16 crates compliant, no violations.