diff options
| author | Kaalleen <36401965+kaalleen@users.noreply.github.com> | 2021-10-09 18:25:29 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-10-09 18:25:29 +0200 |
| commit | 5a1ad7e4e8bebb31a679674ed8b4ca526138695c (patch) | |
| tree | 254f906a6524abd3cb9a685975e563f09790bbaa /lib/svg | |
| parent | 0224794a0815f22a719d2880e175077b77214513 (diff) | |
Letters to font extension (#1312)
Diffstat (limited to 'lib/svg')
| -rw-r--r-- | lib/svg/guides.py | 16 | ||||
| -rw-r--r-- | lib/svg/tags.py | 1 |
2 files changed, 8 insertions, 9 deletions
diff --git a/lib/svg/guides.py b/lib/svg/guides.py index e492a90d..3329940e 100644 --- a/lib/svg/guides.py +++ b/lib/svg/guides.py @@ -3,11 +3,10 @@ # Copyright (c) 2010 Authors # Licensed under the GNU GPL version 3.0 or later. See the file LICENSE for details. -from inkex import transforms +from inkex.units import convert_unit from ..utils import Point, cache, string_to_floats from .tags import INKSCAPE_LABEL, SODIPODI_GUIDE, SODIPODI_NAMEDVIEW -from .units import get_doc_size, get_viewbox_transform class InkscapeGuide(object): @@ -20,16 +19,15 @@ class InkscapeGuide(object): def _parse(self): self.label = self.node.get(INKSCAPE_LABEL, "") - doc_size = list(get_doc_size(self.svg)) - - # convert the size from viewbox-relative to real-world pixels - viewbox_transform = get_viewbox_transform(self.svg) - viewbox_transform = transforms.Transform(-transforms.Transform(viewbox_transform)).apply_to_point(doc_size) + doc_size = self.svg.get_page_bbox() + # inkscape's Y axis is reversed from SVG's, and the guide is in inkscape coordinates self.position = Point(*string_to_floats(self.node.get('position'))) + self.position.y = doc_size.y.size - self.position.y - # inkscape's Y axis is reversed from SVG's, and the guide is in inkscape coordinates - self.position.y = doc_size[1] - self.position.y + # convert units to px + unit = self.svg.unit + self.position.y = convert_unit(self.position.y, 'px', unit) # This one baffles me. I think inkscape might have gotten the order of # their vector wrong? diff --git a/lib/svg/tags.py b/lib/svg/tags.py index 3130bc16..0dc027ea 100644 --- a/lib/svg/tags.py +++ b/lib/svg/tags.py @@ -28,6 +28,7 @@ INKSCAPE_GROUPMODE = inkex.addNS('groupmode', 'inkscape') CONNECTION_START = inkex.addNS('connection-start', 'inkscape') CONNECTION_END = inkex.addNS('connection-end', 'inkscape') CONNECTOR_TYPE = inkex.addNS('connector-type', 'inkscape') +INKSCAPE_DOCUMENT_UNITS = inkex.addNS('document-units', 'inkscape') XLINK_HREF = inkex.addNS('href', 'xlink') |
