forked from 1b-agent/opencadstudio-upstream
Text: stroke font space widths of the reference
The SHX names the embedded LFF fonts stand in for (txt, monotxt, simplex, romans, romand, romanc, complex, italic, gdt, isocp) use the space advance of the reference's fonts. Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
1 parent
2dfa9f3f2a
commit
de65cd7e50
1 file changed
+22
@@ -87,6 +87,22 @@ const ALIASES: &[(&str, &str)] = &[
|
||||
("EXTFONT", "unicode"),
|
||||
];
|
||||
|
||||
/// The space advance of the reference's stroke fonts, in glyph units (cap
|
||||
/// height 9), measured from their text extents: the SHX names these LFF
|
||||
/// fonts stand in for keep the reference's word gaps.
|
||||
const SHX_SPACE: &[(&str, f32)] = &[
|
||||
("TXT", 9.0),
|
||||
("MONOTXT", 9.0),
|
||||
("SIMPLEX", 9.0 * 19.0 / 21.0),
|
||||
("ROMANS", 9.0),
|
||||
("ROMAND", 9.0),
|
||||
("ROMANC", 9.0),
|
||||
("COMPLEX", 9.0),
|
||||
("ITALIC", 9.0),
|
||||
("GDT", 9.0),
|
||||
("ISOCP", 3.6),
|
||||
];
|
||||
|
||||
// ── Public types ──────────────────────────────────────────────────────────
|
||||
|
||||
/// One glyph: a list of open 2-D polyline strokes in glyph units.
|
||||
@@ -163,6 +179,12 @@ fn fonts_map() -> &'static HashMap<String, Font> {
|
||||
map.insert(alias.to_ascii_uppercase(), f);
|
||||
}
|
||||
}
|
||||
// Those names keep the reference font's space width.
|
||||
for (name, word) in SHX_SPACE {
|
||||
if let Some(f) = map.get_mut(*name) {
|
||||
f.word_spacing = *word;
|
||||
}
|
||||
}
|
||||
map
|
||||
})
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user