J
John Hunter
I would like to extract the font and family name from a TTF file. I
have been looking at fontTools ttLib, which parses the ttf file and
provides lots of helpful information, but cannot find the name.
tt['head'] seems like a good place to find it, but I can't.
The data appear to be in the 'name' field
4197
But I still don't know how to extract this information if I don't know
the family/font name in advace. Any ideas on how to best extract this
info using fontTools or otherwise?
What I am trying to do is find the best ttf font file for a given
fontname, fontangle, and fontweight. I plan to write my own font
finder given a font name and font family from the ttf file, but if
there is a better way to find ttf fonts let me know. Eg, what I want
to do is
ttfile = findfont('Courier', 'Italic', 'Bold')
and have findfont search some PATH containing TTF files and return the
closest match, or a default if no good match is found.
Thanks,
John Hunter
have been looking at fontTools ttLib, which parses the ttf file and
provides lots of helpful information, but cannot find the name.
tt['head'] seems like a good place to find it, but I can't.
The data appear to be in the 'name' field
4197
But I still don't know how to extract this information if I don't know
the family/font name in advace. Any ideas on how to best extract this
info using fontTools or otherwise?
What I am trying to do is find the best ttf font file for a given
fontname, fontangle, and fontweight. I plan to write my own font
finder given a font name and font family from the ttf file, but if
there is a better way to find ttf fonts let me know. Eg, what I want
to do is
ttfile = findfont('Courier', 'Italic', 'Bold')
and have findfont search some PATH containing TTF files and return the
closest match, or a default if no good match is found.
Thanks,
John Hunter