Skip to content

Instantly share code, notes, and snippets.

@miguelsousa
Created June 10, 2016 22:36
Show Gist options
  • Select an option

  • Save miguelsousa/a67497ab2c9dbd11d8e9bb98b16a0a2f to your computer and use it in GitHub Desktop.

Select an option

Save miguelsousa/a67497ab2c9dbd11d8e9bb98b16a0a2f to your computer and use it in GitHub Desktop.
from fontTools import ttLib
from fontTools.pens.areaPen import AreaPen
fontFileName = "areatestfont.otf"
gNamesList = "testA testB testC testD".split()
ttFont = ttLib.TTFont(fontFileName)
gSet = ttFont.getGlyphSet()
for gName in gNamesList:
g = gSet[gName]
aPen = AreaPen(g)
g.draw(aPen)
area = aPen.value
print area
@miguelsousa
Copy link
Author

@behdad
Copy link

behdad commented Jun 10, 2016

Right. Seems to be an issue with CFF fonts, but TrueType. Fixed in symfont. I'll let Cosimo finish up areaPen and merge.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment