Hello all,
I am trying to accomplish what I thought would be a fairly easy task. I'd like to export the glyph width (as measured from leftmost to rightmost node, without advance width) from a font.
The OTMaster shows these values in the CFF table. I thought I would see them with TTX too, but there only seem to be values related to hinting.
I used the command
ttx -t "CFF " /pathtofont
and it seemed to work, but in the ttx file I can't find any node coordinates that I see in OTMaster. Can someone point me in the right direction? Thanks!
Comments
http://www.freetype.org/freetype2/docs/reference/ft2-glyph_management.html#FT_Glyph_Get_CBox
Or with the equivalent python binding of this freetype routine.
font = CurrentFont()
for glyph in font:
print glyph.name + ': ' + str(glyph.box[2] - glyph.box[0])
I must add that I couldn't code to save my life, Ben's Code gives me an error (CurrentFont not defined) in both Glyphs and FontLab and I don't know how to fix it
What platform are you on?
from robofab.world import CurrentFont
In Glyphs you need to check if RoboFab is installed (Preferences/AddOns/Modules).
For FL you also have to make sure that RoboFab is installed.
My python is a bit rusty, but almost every language's dictionary implementation never return keys in any particular order (that's the whole point of a dictionary - it is indexed by the keys, which is unordered), but in all the object oriented languages, keys() returns an array type which has a sort() method. You can probably do sort(<customcompare delegate>) for some fancy sorting in many languages too.
C# I think has an ordered dictionary type where keys() returns keys in insertion order.
It also works perfectly on Mac OS 10.9.5! Thank you very much, it's exactly what I needed The CSV thingy saves so much time. The sorting is kind of off, but it doesn't matter much.
Hin-Tak Leung said: I'm on a Mac, 10.9.5. If it's too much trouble to find that code, then nevermind, Vassil's script is great for my needs Thanks for looking into it!