fix(dimension): render diameter text and shrink point markers (#139)

Two issues in a file whose dimensions carry baked *D### blocks.

Missing diameter text: the baked MText values are "\U+220520" /
"\U+220510" — the \U+2205 (⌀) escape immediately followed by the literal
digits "20"/"10". The MText parser read up to six hex digits for a \U+
escape, so it greedily consumed "220520" = 0x220520, which is past the
maximum code point, char::from_u32 returned None, and the whole text
dropped. A \U+ escape is exactly four hex digits; read four so the symbol
decodes and the trailing digits stay literal. (Angular "90\U+00B0" only
worked because its escape sits at the end of the string.)

Node artifacts: PDMODE=0 points were drawn as a fixed 0.1-world-unit "+",
which in a small drawing turned the 31 dimension def-points on the
Defpoints layer into visible crosses. Size the dot from world-per-pixel
(~1 px, zoom-adaptive via the tessellation cache key) to match the near-
invisible dot other CAD apps draw.

Co-Authored-By: Claude Opus 4.8 <[email protected]>
This commit is contained in:
Hakan SevenandClaude Opus 4.8 committed 2026-06-25 18:22:35 +03:00
1 parent 177ae20be4
commit 7086a79c79
2 files changed
+18 -3

No files matched your search

+8 -2
View File
@@ -515,8 +515,14 @@ pub fn parse_mtext_paragraphs_ex(
chars.next();
if chars.peek() == Some(&'+') {
chars.next();
let mut hex = String::with_capacity(6);
for _ in 0..6 {
// A `\U+XXXX` escape is exactly four hex digits (a BMP
// code point). Reading more greedily swallows the
// following literal characters — e.g. the diameter
// value `\U+220520` ("⌀20") was parsed as code point
// 0x220520, which is out of range, so the whole text
// vanished. (#139)
let mut hex = String::with_capacity(4);
for _ in 0..4 {
match chars.peek() {
Some(&c) if c.is_ascii_hexdigit() => {
hex.push(chars.next().unwrap());