From de59719db48b6aa0aefecc045a45be5bbc02500b Mon Sep 17 00:00:00 2001 From: Cosimo Lupo Date: Tue, 12 Sep 2017 22:21:20 -0400 Subject: [PATCH] move stuff to fontTools.svgLib.path sub-package in case later on we want to add things to svgLib which don't have to do with paths specifically --- Lib/fontTools/svgLib/__init__.py | 58 +------------------ Lib/fontTools/svgLib/path/__init__.py | 58 +++++++++++++++++++ Lib/fontTools/svgLib/{ => path}/parser.py | 0 Tests/svgLib/{ => path}/__init__.py | 0 Tests/svgLib/{ => path}/parser_test.py | 0 .../{svgLib_test.py => path/path_test.py} | 0 6 files changed, 61 insertions(+), 55 deletions(-) create mode 100644 Lib/fontTools/svgLib/path/__init__.py rename Lib/fontTools/svgLib/{ => path}/parser.py (100%) rename Tests/svgLib/{ => path}/__init__.py (100%) rename Tests/svgLib/{ => path}/parser_test.py (100%) rename Tests/svgLib/{svgLib_test.py => path/path_test.py} (100%) diff --git a/Lib/fontTools/svgLib/__init__.py b/Lib/fontTools/svgLib/__init__.py index 4f17e7662..b301a3bab 100644 --- a/Lib/fontTools/svgLib/__init__.py +++ b/Lib/fontTools/svgLib/__init__.py @@ -1,58 +1,6 @@ -from __future__ import ( - print_function, division, absolute_import, unicode_literals) +from __future__ import print_function, division, absolute_import from fontTools.misc.py23 import * -from fontTools.pens.transformPen import TransformPen -from .parser import parse_path +from .path import SVGPath, parse_path -try: - from xml.etree import cElementTree as ElementTree # python 2 -except ImportError: # pragma nocover - from xml.etree import ElementTree # python 3 - - -__all__ = [tostr(s) for s in ("SVGPath", "parse_path")] - - -class SVGPath(object): - """ Parse SVG ``path`` elements from a file or string, and draw them - onto a glyph object that supports the FontTools Pen protocol. - - For example, reading from an SVG file and drawing to a Defcon Glyph: - - import defcon - glyph = defcon.Glyph() - pen = glyph.getPen() - svg = SVGPath("path/to/a.svg") - svg.draw(pen) - - Or reading from a string containing SVG data, using the alternative - 'fromstring' (a class method): - - data = '