Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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

1 Answer 1

up vote 2 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

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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