forked from 1b-agent/opencadstudio-upstream
feat(text): parse TEXT via acadrust + extend SDF text to MTEXT
Two related steps for the text pipeline: - TEXT parsing now goes through acadrust's parse_plain_text (like MTEXT uses parse_mtext). text::acad_text_encode parses the value's %% codes — including %%u/%%o underline/overline and %%nnn — and re-encodes to the stroke tessellator's \L/\O + resolved-Unicode grammar, so OCS no longer tokenizes TEXT %% codes itself. (ATTRIB/TOLERANCE/DIMENSION still use the local tokenizer for now.) Bumps the acadrust pin to the commit that completes the TEXT/MTEXT control-code set. - SDF text (OCS_TEXT_SDF) now covers MTEXT and every text-producing entity, not just top-level TEXT. TextStroke carries a GlyphRun (layout params); the collector walks convert()'s TruckObject::Text runs and applies annotation scale exactly as tessellate does for strokes. layout_glyph_quads shares lff::tokenize_run so %% specials resolve and \L/\O decorations are skipped (decoration LINES in SDF are still TODO). Verified: stroke rendering unchanged with the flag off; SDF glyphs render correctly for TEXT and MTEXT with OCS_TEXT_SDF=1. 154 lib tests green. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
1 parent
b88e5e4ad5
commit
d528a3e2a5
9 files changed
+149
-28
No files matched your search
@@ -19,6 +19,25 @@ pub struct TextStroke {
|
||||
pub origin: [f64; 2],
|
||||
pub color: Option<[f32; 3]>,
|
||||
pub fill_tris: Vec<[f32; 2]>,
|
||||
/// Layout inputs to rebuild this run as per-glyph SDF quads (see
|
||||
/// `scene::text::glyph_quads`). `Some` on runs wired for the SDF text
|
||||
/// renderer; `None` leaves the run to the stroke path only. Heights are
|
||||
/// raw (pre annotation-scale), matching `strokes` — the SDF collector
|
||||
/// applies annotation scale the same way `tessellate` does for strokes.
|
||||
pub run: Option<GlyphRun>,
|
||||
}
|
||||
|
||||
/// Per-run text-layout inputs needed to reproduce a run as SDF glyph quads.
|
||||
#[derive(Clone, Debug)]
|
||||
pub struct GlyphRun {
|
||||
pub text: String,
|
||||
pub font: String,
|
||||
/// Raw height in drawing units (annotation scale applied later).
|
||||
pub height: f32,
|
||||
pub rotation: f32,
|
||||
pub width_factor: f32,
|
||||
pub oblique: f32,
|
||||
pub tracking: f32,
|
||||
}
|
||||
|
||||
#[allow(dead_code)]
|
||||
|
||||
Reference in new issue
Block a user