6

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!

4

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.