Draft: fix multiline offset for rotated SVG texts
Forum topic: https://forum.freecad.org/viewtopic.php?p=711184#p711184
This commit is contained in:
@@ -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'
|
||||
|
||||
Reference in New Issue
Block a user