I have a script on my server that parses fonts so I can use them in my application.
Sadly, a lot of times the name of the font file itself is wrong (e.g., the file may be named _FONT1.ttf). On windows however, when i open up the file's properties, I see that inside the fonts Details tab (i.e., its metadata) the correct name is stored in a field called 'Title'.
How would I extract this piece of metadata from my file?
You can use fc-query
utility provided as part of fontconfig
to get the information. fc-query
on the .ttf file will provide you with lot of information. The information which you need can be obtained by getting the fullname of the ttf file. You can try fc-query <.ttf file> --format=%{fullname}
man fc-query
will give you more details regarding the same.
Hope this helps!
You would use FreeType to load the font and then look at the family_name
member of the loaded face.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With