New to Typophile? Accounts are free, and easy to set up.
Hey Everyone,
I'm stumped. Does anyone here know how to detect reversed postscript hints using Python in FontLab?
Here's what I tried:
font = fl.font
glyphs = font.glyphs
for index in range(len(fl.font)):
glyph = fl.font[index]
vhw = glyph.vhints.width
if len(vhw) < 0:
print glyph.name, vhw
I find there are two things wrong here (but I don't know how to fix them).
1. FL py reports width as not being an attribute of hhints
2. len(vhw) < 0 returns nothing even when I know those instances are present
Any help is appreciated.
18 Mar 2010 — 12:27pm
Delve,
glyph.vhints is a list. You need to iterate through it as in:
for vhint in glyph.vhints:print vhint.width
Adam
19 Mar 2010 — 1:18pm
Thanks Adam!
That makes sense. I tried what you recommended and now it gives me an error that vhints is not an attribute of glyph (?).
D
19 Mar 2010 — 2:59pm
The Unofficial FontLab/Python Ref suggests it is ...
19 Mar 2010 — 5:59pm
You may need to define the list first as in:
for v in range len(glyph.vhints):
or
verthints = glyph.vhints
for v in range len(verthints):