Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

For a given ttf or otf font, how to get meta information? Information such as how many glyphs were used, what tool was used, what version of font we have, its label, etc? For windows machine, I have seen this tool. But for Ubuntu/Linux, I couldn't find any!

share|improve this question
up vote 3 down vote accepted

There is a simple solution that you can use. You will need Perl and libfont-ttf-perl package :

#! /usr/bin/perl 
use Font::TTF::Font; 

unless (defined $ARGV[0]) { 
    die <<'EOT'; 
    ttfnumglyphs infontfile ... 
Prints glyph count for each input TTF file 
EOT 
} 

foreach (@ARGV) { 
    $f = Font::TTF::Font->open($_) || die "Unable to open font file $_"; 
    $num = $f->{'maxp'}{'numGlyphs'}; 
    printf "%6d  %s\n", $num, $_; 
    $f->release; 
} 

The only thing you need to do is to save this script to a file, call it throught Perl and give it as a parameter the path of the font you want to count the glyphs :

$ perl glyphs_counter.pl /path/to/the/foo_font.ttf

It seems to work for TTF and OTF formats. Hope it helps.

share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .