[svgPathPen] Document coordinate system
Fixes https://github.com/fonttools/fonttools/issues/2388
This commit is contained in:
parent
82a523cc17
commit
5674a0bfc8
@ -23,6 +23,18 @@ class SVGPathPen(BasePen):
|
||||
used to resolve component references in composite glyphs.
|
||||
ntos: a callable that takes a number and returns a string, to
|
||||
customize how numbers are formatted (default: str).
|
||||
|
||||
Note:
|
||||
Fonts have a coordinate system where Y grows up, whereas in SVG,
|
||||
Y grows down. As such, rendering path data from this pen in
|
||||
SVG typically results in upside-down glyphs. You can fix this
|
||||
by wrapping the data from this pen in an SVG group element with
|
||||
transform, or wrap this pen in a transform pen. For example:
|
||||
|
||||
spen = svgPathPen.SVGPathPen(glyphset)
|
||||
pen= TransformPen(spen , (1, 0, 0, -1, 0, 0))
|
||||
glyphset[glyphname].draw(pen)
|
||||
print(tpen.getCommands())
|
||||
"""
|
||||
def __init__(self, glyphSet, ntos: Callable[[float], str] = str):
|
||||
BasePen.__init__(self, glyphSet)
|
||||
|
Loading…
x
Reference in New Issue
Block a user