how to check all available characters in a font file?

3

2

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".

Vivodo

Posted 2012-05-29T11:06:52.623

Reputation: 347

1In the newer fontconfig, there is a fc-query program which can list the Unicode ranges that the font covers. – Dan D. – 2012-05-29T11:53:10.003

Answers

2

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

Kurt Pfeifle

Posted 2012-05-29T11:06:52.623

Reputation: 10 024

0

Here is a new (command line) method to determine the number of glyphs contained in a (TTF or OTF) font which I became aware of recently.

Use the luaotfload-tool which ships with the luaotfload package for LaTeX.

Run, for example:

 luaotfload-tool --find="fira mono" -I | grep glyphs
    number of glyphs: 1485

If you skip the | grep glyphs part and replace it by | less, you'll get a lot more info about the font's metadata, which is also interesting in itself, like copyright + license info, font creator name and built-in font features.

The tool can also find an installed font for you, based on its name:

 luaotfload-tool --find="fira mono"
  luaotfload | resolve : Font "fira mono" found!
  luaotfload | resolve : Resolved file name "/Users/kp/Library/Fonts/FiraMono-Regular.otf"

Kurt Pfeifle

Posted 2012-05-29T11:06:52.623

Reputation: 10 024