Linux – how to check all available characters in a font file

fontconfiglinuxtruetype-fonts

I have some truetype fonts which support UTF-8 characters. I can use "fc-list" to find certain font. How can I check all available characters in some font? Such as how many characters supported in "AR PL New Sung ExtB".

Best Answer

  • You could use a different commandline tool, ttfdump, assuming you're looking at a TTF font file. It should also work for OTF fonts, if they belong to the TTF variety:

    ttfdump /path/to/your/file.ttf  \
       | grep -E '(Number of Glyphs:|numGlyphs:|numberOfHMetrics:)'
    

    This should get you the number of glyphs. You'll possibly see up to four different numbers, if the TTF is in some way b0rken. Sane TTF will return identical numbers for all three entries, in which case you may be pretty confident that you got the correct number:

    ttfdump /Library/Fonts/WeidemannStd-Book.otf  \
      | grep -E '(Number of Glyphs:|numGlyphs:|numberOfHMetrics:)'
    
        numberOfHMetrics:      253
        numGlyphs:             253
    

    Another example:

    ttfdump /Library/Fonts/DroidSerif-Regular.ttf \
       | grep -E '(Number of Glyphs:|numGlyphs:|numberOfHMetrics:)'
    
         numberOfHMetrics:     609
         numGlyphs:            609
         numGlyphs:            609
         Number of Glyphs:     609