Files
cadcraft/docs
austin62jakeandClaude Opus 5.5 b17ae78cec fix(fonts): place Middle and bottom-justified text as AutoCAD does (#2229)
A justified TEXT's insertion point (group 10) is computed from its alignment point, and AutoCAD
takes it from a DWG as it is (it recomputes it only for DXF). CADCraft placed a Middle (M) text
at half its height and a bottom-justified one a third of its height below the baseline,
whatever the string or font, so in AutoCAD those texts were drawn off their alignment points:
0.35 at height 2.5 for "Tg 1234 ABC" justified M, 0.09 for BL with Arial (#2229).

- Middle (M) now centres the text on its own ink, descenders included, as AutoCAD does. Text
  that draws nothing keeps half the height. Middle Center (MC) and the others are unchanged.
- Bottom justifications with a TrueType face put the alignment point at the face's descent
  (its descent over its cap height, the text height): 0.296 of the height for Arial, where
  AutoCAD puts it. The stroke font keeps a third, which matches AutoCAD's SHX fonts.

`frame` (the DWG insertion point) and `place` (drawing) share the new `justify_offset`, so
what is drawn and what is saved agree. With the reporter's commands, the saved points are now
within 0.0006 of AutoCAD's: M -0.9032 (AutoCAD -0.9038), BL -19.2604 (-19.2599).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-29 10:01:18 -05:00
..