getting ttf font/family name; fontTools?

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,768
Messages
2,569,575
Members
45,053
Latest member
billing-software

Latest Threads

Top