cad-editor/tests
Repository files (latest commit first)
Filename Latest commit message Latest commit date
Hakan Seven 5018963d3d fix(export): project viewport text into paper space
Review follow-ups to #390, which fixed PDF/print text for model space but
left the layout-plot path — the one issue #385 was filed from — broken.

viewport_content_wires rewrote points/snap_pts/key_vertices/aabb and then
cloned text_verts through untouched, so paper-space viewport text stayed at
model (UTM) coordinates: a dimension at model (25000, 12000) plotted its
lines onto the sheet and its glyphs kilometres off the page. A text-only
wire fared worse — TEXT/MTEXT carry no stroke points since text went
SDF-only, so it was dropped outright by the empty-clip and AABB rejections.
Project the glyphs through the same proj_abs the snap points use (via the
existing map_text_verts helper), cull per glyph on the quad centroid, count
them towards the paper AABB, and dim them like the wire colour.

Also in emit_text, which diverged from the wire pass it mirrors:
- divide the pen by `scale`, or a Fit/windowed plot prints text as
  near-invisible hairlines while its own lines stay correct;
- apply the CTB plot style, or a monochrome.ctb plot renders the lines
  black and leaves the text on its screen colour;
- reset the dash pattern, which is persistent PDF state the wire pass
  leaves set — a HIDDEN-linetype last wire printed glyph outlines dashed.

export_table's doc claimed it honoured TEXTFILL and widened the bold pen
itself; it did neither. Gate fill_tris on textfill() so hollow-on-screen
text exports hollow, carry the bold flag and widen the pen by the 1.7x the
bake uses, and resolve Face once per family instead of once per glyph (the
atlas mutex is held for that whole walk).

uv_key identifies a glyph by its tile's uv_min, but grow_height rescales
every entry's V and reset rewinds the packer, leaving already-built quads
addressing the wrong tile — garbage on screen and a silent miss in the
export table, i.e. #385 again under #347's grow-the-atlas conditions. Bump
an atlas generation on both and fold it into the tessellation memo guard so
the text re-lays-out instead. Quads built earlier in the same pass that
grows are still stale for that pass; the guard heals them on the next one.

Tests: the integration test's "some wire has text_verts" assert passed on
pre-fix code too (the exporter ignored them; the scene always carried
them), and its dimension half was satisfied by the TEXT alone — assert per
entity handle instead, and stop colliding on fixed names in the shared temp
root. The unit test's bbox came from the same quads the mapping reads, so
it held by construction; pin the run's own world box instead. That still
cannot catch a mirrored corner assignment — verified by mirroring it — so
say so rather than claim coverage the assert doesn't have.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-16 10:06:15 +03:00
..
active_space_roundtrip.rs fix(layout): create the CTAB variable so the exact paper tab round-trips 2026-07-12 01:17:26 +03:00
annotative_context_roundtrip.rs feat(annotative): synthesize per-object contexts + editable UI 2026-07-13 22:38:29 +03:00
annotative_context_synthesis.rs feat(annotative): synthesize per-object contexts + editable UI 2026-07-13 22:38:29 +03:00
block_hatch_export.rs fix(hatch): flag only the outer ring as external when serializing holes 2026-07-13 05:55:54 +01:00
dim_copy_check.rs fix(copy): duplicate a dimension's baked block so COPY copies it (#161) 2026-06-25 22:30:45 +03:00
dim_line_color_roundtrip.rs feat(props): make dim-line colour editable for leaders and dimensions 2026-07-13 17:31:09 +03:00
page_setup_root_repair.rs fix(io): resolve root named-objects dict robustly on foreign DWGs 2026-07-13 16:28:21 +03:00
pdf_export_text_check.rs fix(export): project viewport text into paper space 2026-07-16 10:06:15 +03:00
text_font_rendering.rs fix(text): keep inline \C colours through block colour inheritance (SDF) 2026-07-07 22:17:27 +03:00
zoom_extents_xline.rs fix(view): exclude XLine/Ray display segments from ZOOM Extents (#284) 2026-07-05 14:08:43 -07:00