fix(tolerance): draw the feature control frame properly
A tolerance drew one row of ASCII soup — "RUN | ANGtol(M) | ..." — about a tenth of its proper size. Six defects, each independent. Rows were split on the two-character string "^J". A DWG stores a raw newline, and the text-DXF reader rewrites the on-disk ^J to one before we see it, so that split never fired on either mainstream path and every row collapsed into the first. It now normalises all four spellings the break arrives in — including the \P our own DXF writer emits, which made open-DWG → save-DXF → reopen asymmetric. Symbols were replaced with ASCII labels from a table that was itself wrong: it read r as circular runout, n as angularity, p as position. The font's own encoding says concentricity, diameter, projected tolerance zone, and the benchmark's pre-exploded reference agrees. That table was an inversion of acadrust's, which is self-contradictory — it binds n to two different meanings. Do not re-derive from it. The frame is a proportion of the character height: a compartment spans -h..+h about its row's centreline, so it is 2h tall and the margin falls out of that. It was built as height + 2*DIMGAP instead, which is a different entity's geometry — DIMGAP sizes the dimension line's break and the rectangle around a basic dimension, where it genuinely applies twice per axis. Even fed a self-consistent style that can only ever produce 1.5h, so it was wrong in kind rather than mis-fed. Height came from the entity's own field, which a DWG never sets — the reader carries only the style's handle, leaving a small non-zero default that a "> 0" test happily used. It now resolves the style by handle first and name second: a DWG records the handle and defaults the name, a DXF the reverse, so matching on the name alone would have picked the wrong style for every DWG-read tolerance. An entity may also override single style variables on itself, and this one halves its character height that way; ignoring that drew the frame several times too large. Rows stacked upward, every row inherited the widest row's columns, and one full-width border boxed them all — none of which showed while the parse only ever produced a single row. The insertion point sits on the first row's centreline; anchoring the frame's bottom-left there offset it by its own height, and by an amount that changed with the row count. Cell text ran together because the glyph run asked for no letter spacing while the width measurement assumed the font's own, so the characters crowded inside correctly-sized boxes. Compartments are also measured by what they draw now: the pen advance stops one letter-space past the last glyph, and counting that made every one of them too wide. Symbols come from a bundled stroke font, restored from this repository's own history: it shipped QCAD's gdt.cxf until the text engine moved from CXF to LFF, which removed every .cxf and left nothing in their place — the ASCII labels date from exactly there. Converted to LFF, keyed by the letter its \Fgdt;X escape carries, and registered under that name like any other font, so a switch to it resolves through the ordinary lookup: an MTEXT carrying the escape, or a text style named gdt.shx, reaches it too, with no code of their own. The geometry is public domain by explicit waiver; provenance is in the file's header. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
parent
1b60924bbe
commit
c10e8dae44
3 changed files with 843 additions and 153 deletions
143
assets/fonts/gdt.lff
Normal file
143
assets/fonts/gdt.lff
Normal file
|
|
@ -0,0 +1,143 @@
|
|||
# Format: LibreCAD Font 1
|
||||
# Creator: converted from the QCAD 3 'gdt' CXF font
|
||||
# Version: 1
|
||||
# Name: gdt
|
||||
# Encoding: UTF-8
|
||||
# LetterSpacing: 3
|
||||
# WordSpacing: 6.75
|
||||
# LineSpacingFactor: 1
|
||||
# Author: Andrew Mustun (QCAD)
|
||||
# License: GPL v3
|
||||
|
||||
[0061] a
|
||||
0,0;13.5,0
|
||||
0,0;13.5,7.7
|
||||
|
||||
[0062] b
|
||||
0,-2;18,-2
|
||||
9,-2;9,11
|
||||
|
||||
[0063] c
|
||||
0,0;5,9
|
||||
5,9;18.5,9
|
||||
18.5,9;13.5,0
|
||||
13.5,0;0,0
|
||||
|
||||
[0064] d
|
||||
0,0;18,0
|
||||
18,0;0,0,A1
|
||||
|
||||
[0065] e
|
||||
14,4.5;0,4.5,A1;14,4.5,A1
|
||||
|
||||
[0066] f
|
||||
0,-2.35;7.7491,11.0718
|
||||
5.45,-2.35;13.1991,11.0718
|
||||
|
||||
[0067] g
|
||||
0,-2.35;7.7491,11.0718
|
||||
10.3918,-2.35;18.1409,11.0718
|
||||
13.651015,4.5;4.651015,4.5,A1;13.651015,4.5,A1
|
||||
|
||||
[0068] h
|
||||
0,-2;8,6
|
||||
10.071,3.9289;5.929,8.0711
|
||||
13,11;5.929,8.0711
|
||||
13,11;10.071,3.9289
|
||||
|
||||
[0069] i
|
||||
4,0;9.4,0
|
||||
4,9;9.4,9
|
||||
0,4.5;13.4,4.5
|
||||
|
||||
[006A] j
|
||||
0,4.5;13.5,4.5
|
||||
6.75,11.25;6.75,-2.25
|
||||
11.3,4.5;2.2,4.5,A1;11.3,4.5,A1
|
||||
|
||||
[006B] k
|
||||
18,0;0,0,A1
|
||||
|
||||
[006C] l
|
||||
14,4.5;0,4.5,A1;14,4.5,A1
|
||||
5,8;5,1
|
||||
5,1;9,1
|
||||
|
||||
[006D] m
|
||||
14,4.5;0,4.5,A1;14,4.5,A1
|
||||
4,1;4,8
|
||||
4,8;7,1
|
||||
7,1;10,8
|
||||
10,8;10,1
|
||||
|
||||
[006E] n
|
||||
9,4.5;0,4.5,A1;9,4.5,A1
|
||||
0.625,-2.2117;8.375,11.2117
|
||||
|
||||
[006F] o
|
||||
0,9;9,9
|
||||
9,9;9,0
|
||||
9,0;0,0
|
||||
0,0;0,9
|
||||
|
||||
[0070] p
|
||||
14,4.5;0,4.5,A1;14,4.5,A1
|
||||
4.5,1;4.5,8
|
||||
4.5,8;7.75,8
|
||||
4.5,4.5;7.75,4.5
|
||||
7.75,4.5;7.75,8,A1
|
||||
|
||||
[0071] q
|
||||
1.5,9;1.5,0
|
||||
1.5,0;4.5,0
|
||||
0,6;3,6,A-1
|
||||
0,3;3,3,A1
|
||||
0,6;0,3
|
||||
|
||||
[0072] r
|
||||
14,4.5;0,4.5,A1;14,4.5,A1
|
||||
11.5,4.5;2.5,4.5,A1;11.5,4.5,A1
|
||||
|
||||
[0073] s
|
||||
14,4.5;0,4.5,A1;14,4.5,A1
|
||||
8.9446,7.4412;6.6109,8,A0.118;5.9047,5.0584,A0.7883;8.0957,3.9416;7.3887,1,A-0.7882;5.0574,1.5575,A-0.1179
|
||||
|
||||
[0074] t
|
||||
0,-2;8,6
|
||||
10,-2;18,6
|
||||
10.071,3.9289;5.929,8.0711
|
||||
20.071,3.9289;15.929,8.0711
|
||||
13,11;5.929,8.0711
|
||||
23,11;15.929,8.0711
|
||||
13,11;10.071,3.9289
|
||||
23,11;20.071,3.9289
|
||||
0,-2;10,-2
|
||||
|
||||
[0075] u
|
||||
0,4.5;17,4.5
|
||||
|
||||
[0076] v
|
||||
0,9;0,0
|
||||
0,0;18,0
|
||||
18,0;18,9
|
||||
|
||||
[0077] w
|
||||
0,9;9,0
|
||||
9,0;18,9
|
||||
|
||||
[0078] x
|
||||
0,9;9,9
|
||||
4.5,9;4.5,0
|
||||
4.5,0;7.5,5.1962
|
||||
4.5,0;1.5,5.1962
|
||||
|
||||
[0079] y
|
||||
0,4.5;42.5,4.5
|
||||
4.5,13.4;38,4.5
|
||||
4.5,-4.4;38,4.5
|
||||
4.5,13.4;4.5,-4.4
|
||||
|
||||
[007A] z
|
||||
0,0;34,0
|
||||
0,0;0,9
|
||||
0,9;34,0
|
||||
Loading…
Reference in a new issue