From 3c14a56eedaa9ce5b1f50ab735322e6fe489f9a7 Mon Sep 17 00:00:00 2001 From: Roy-043 Date: Thu, 5 Oct 2023 12:21:55 +0200 Subject: [PATCH] Draft: fix multiline offset for rotated SVG texts Forum topic: https://forum.freecad.org/viewtopic.php?p=711184#p711184 --- src/Mod/Draft/draftfunctions/svgtext.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/Mod/Draft/draftfunctions/svgtext.py b/src/Mod/Draft/draftfunctions/svgtext.py index c696496f7d..f661be6335 100644 --- a/src/Mod/Draft/draftfunctions/svgtext.py +++ b/src/Mod/Draft/draftfunctions/svgtext.py @@ -29,6 +29,7 @@ import math import FreeCAD as App +import DraftVecUtils import draftutils.utils as utils ## \addtogroup draftfunctions @@ -48,6 +49,9 @@ def _get_text_techdraw(text, tcolor, fontsize, anchor, """ svg = "" for i in range(len(text)): + delta = App.Vector(0, -i * linespacing, 0) + point = base + DraftVecUtils.rotate(delta, angle) + _t = text[i].replace("&", "&") _t = _t.replace("<", "<") t = _t.replace(">", ">") @@ -60,10 +64,10 @@ def _get_text_techdraw(text, tcolor, fontsize, anchor, svg += 'font-family:{}" '.format(fontname) svg += 'transform="' svg += 'rotate({},{},{}) '.format(math.degrees(angle), - base.x, - base.y - i * linespacing) - svg += 'translate({},{}) '.format(base.x, - base.y - i * linespacing) + point.x, + point.y) + svg += 'translate({},{}) '.format(point.x, + point.y) svg += 'scale(1,-1)"' # svg += 'freecad:skip="1"' svg += '>\n'