From fe5cca63c2a15dfc49cd251a6be4ab3925ab1dab Mon Sep 17 00:00:00 2001 From: =?utf8?q?L=C3=A1szl=C3=B3=20N=C3=A9meth?= Date: Mon, 5 Dec 2022 11:10:16 +0100 Subject: [PATCH] LibreLogo: fix SVG export of font features and text portions MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Text portions of rotated text was exported with bad positions. Text using font features was exported with non-portable font names with colon, working only in LibreOffice correctly. Fix these by converting the text to curve during the SVG export. Change-Id: I3707aaa4143f583b988bbbe37b5eb741530cccba Reviewed-on: https://gerrit.libreoffice.org/c/core/+/143668 Tested-by: Jenkins Reviewed-by: László Németh --- librelogo/source/LibreLogo/LibreLogo.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/librelogo/source/LibreLogo/LibreLogo.py b/librelogo/source/LibreLogo/LibreLogo.py index 5f0c2261f614..1ba5b835244f 100644 --- a/librelogo/source/LibreLogo/LibreLogo.py +++ b/librelogo/source/LibreLogo/LibreLogo.py @@ -168,6 +168,7 @@ class __Doc__: self.time = 0 self.zoomvalue = 0 self.lockturtle = False + self.fixSVG = False self.initialize() def initialize(self): @@ -539,6 +540,7 @@ class LogoProgram(threading.Thread): parent = _.doc.CurrentController.Frame.ContainerWindow MessageBox(parent, "Document objects with%s script events" % [" possible", ""][secid-1], "LibreLogo program can't start", "errorbox") else: + _.fixSVG = False _.start_time = __time__.process_time() exec(self.code) __unlock__(all_levels = True) @@ -1440,6 +1442,7 @@ def text(shape, orig_st): # has HTML-like formatting if formatting != None: + _.fixSVG = True prev_format = 0 prev_extra_data = extra_data[0] c.collapseToStart() @@ -1811,6 +1814,9 @@ def __groupend__(name = ""): __time__.sleep(0.1) __dispatcher__(".uno:Paste", (), draw) __dispatcher__(".uno:FormatGroup", (), draw) + # fix bad or non-portable SVG export by converting text to curve + if _.fixSVG: + __dispatcher__(".uno:ChangeBezier", (), draw) pic = drawpage.getByIndex(0) pic.setPosition(__Point__((g.BoundRect.Width - g.Size.Width)//2, (g.BoundRect.Height - g.Size.Height)//2)) drawpage.Height, drawpage.Width = g.BoundRect.Height, g.BoundRect.Width @@ -1856,6 +1862,8 @@ def fontweight(n = -1): def fontfamily(s = -1): if s != -1: _.fontfamily = s + if ':' in s: + _.fixSVG = True else: return _.fontfamily -- 2.11.4.GIT