Skip to content

Commit

Permalink
[svgPen] Write two digits after decimal by default
Browse files Browse the repository at this point in the history
  • Loading branch information
behdad committed Dec 17, 2023
1 parent 2db70bd commit d79e862
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions Lib/fontTools/pens/svgPathPen.py
Expand Up @@ -2,7 +2,7 @@
from fontTools.pens.basePen import BasePen


def pointToString(pt, ntos=str):
def pointToString(pt, ntos):
return " ".join(ntos(i) for i in pt)


Expand Down Expand Up @@ -37,7 +37,7 @@ class SVGPathPen(BasePen):
print(tpen.getCommands())
"""

def __init__(self, glyphSet, ntos: Callable[[float], str] = str):
def __init__(self, glyphSet, ntos: Callable[[float], str] = (lambda x: ("%.2f" % x) if x != int(x) else str(int(x)))):
BasePen.__init__(self, glyphSet)
self._commands = []
self._lastCommand = None
Expand Down

0 comments on commit d79e862

Please sign in to comment.