From e5f81e4791a0a741d4c42be2961771034eb1b3f0 Mon Sep 17 00:00:00 2001 From: Roy-043 <70520633+Roy-043@users.noreply.github.com> Date: Thu, 22 May 2025 17:26:00 +0200 Subject: [PATCH] Draft: ShapeString fix stick font check for small character (#21522) Fixes #21501. For some fonts `Part.makeWireString()` returns characters that are much smaller than the given height. This would lead to a false positive for the 'sticky font' check (which checks the area of the "L" character). --- src/Mod/Draft/draftobjects/shapestring.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/Mod/Draft/draftobjects/shapestring.py b/src/Mod/Draft/draftobjects/shapestring.py index 991e3bdc89..92af708608 100644 --- a/src/Mod/Draft/draftobjects/shapestring.py +++ b/src/Mod/Draft/draftobjects/shapestring.py @@ -162,8 +162,13 @@ class ShapeString(DraftObject): if not shapes: fill = False else: - fill = sum([shape.Area for shape in shapes]) > 0.03\ - and math.isclose(Part.Compound(char).BoundBox.DiagonalLength, + # Depending on the font the size of char can be very small. + # For the area check to make sense we need to use a scale factor. + # https://github.com/FreeCAD/FreeCAD/issues/21501 + char_comp = Part.Compound(char) + factor = 1 / char_comp.BoundBox.YLength + fill = sum([shape.Area for shape in shapes]) > (0.03 / factor ** 2) \ + and math.isclose(char_comp.BoundBox.DiagonalLength, Part.Compound(shapes).BoundBox.DiagonalLength, rel_tol=1e-7)