Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Get file metadata in Linux

Tags:

linux

fonts

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?

like image 592
Obto Avatar asked Oct 14 '25 18:10

Obto


2 Answers

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!

like image 93
another.anon.coward Avatar answered Oct 17 '25 11:10

another.anon.coward


You would use FreeType to load the font and then look at the family_name member of the loaded face.

like image 22
Ignacio Vazquez-Abrams Avatar answered Oct 17 '25 12:10

Ignacio Vazquez-Abrams