Search code examples
rubyubuntufontstruetype

Find FontName from a TTF file in UBUNTU


I need to programmatically install (In Ubuntu) few hundreds of fonts for my application (Developed in Ruby on rails) and track the font names installed while installing.

So i need a tool or some library in UBUNTU which takes TTF file as input and provide the Font-Name as output.

Even if there is some way in ruby (GEM OR anything which can help) to find the font-name with given TTF file, will be great help.

Thanks in Advance.


Solution

  • Basically i used fop-ttfreader to get the details from a TTF file..

    fop-ttfreader fontfile.ttf xmlfile.xml
    

    http://manpages.ubuntu.com/manpages/natty/man1/fop-ttfreader.1.html

    So now this xml file can be parsed and get the font details.

    This looks like its increased to 2 steps, instead as suggested by djangodude, it can be done in a simple code by parsing ourself. In my case it will be a one time process like a rake.. So this helped me to finish my job.. :P

    Hope this may help someone.