Skip to content

Commit ec3e92f

Browse files
committed
Use PointPen when extracting TrueType glyphs
1 parent d99e6e6 commit ec3e92f

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

Lib/extractor/formats/opentype.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -317,6 +317,7 @@ def extractOpenTypeGlyphs(source, destination):
317317
vmtx = source.get("vmtx")
318318
vorg = source.get("VORG")
319319
cmap = source.getBestCmap()
320+
is_ttf = "glyf" in source
320321
reversedMapping = source.get("cmap").buildReversed()
321322
# grab the glyphs
322323
glyphSet = source.getGlyphSet()
@@ -326,8 +327,12 @@ def extractOpenTypeGlyphs(source, destination):
326327
destination.newGlyph(glyphName)
327328
destinationGlyph = destination[glyphName]
328329
# outlines
329-
pen = destinationGlyph.getPen()
330-
sourceGlyph.draw(pen)
330+
if is_ttf:
331+
pen = destinationGlyph.getPointPen()
332+
sourceGlyph.drawPoints(pen)
333+
else:
334+
pen = destinationGlyph.getPen()
335+
sourceGlyph.draw(pen)
331336
# width
332337
destinationGlyph.width = sourceGlyph.width
333338
# height and vertical origin

0 commit comments

Comments
 (0)