Linux – Get Supported Unicode Ranges from Font *.ttf file on Ubuntu

fontslinuxUbuntuunicode

I have some fonts in 'ttf' format on my Ubuntu machine.

I want to know some metadata of those fonts, about which unicode ranges and which non-unicode codepages those font files are supporte.

How I can do it?

Added 1: Forgot to mention, that i want to get those information for several hundreds of fonts, so I need some kind of terminal utility, that can be automized

Best Answer

fc-query can show supported unicode character sets. I don't know of other codepages though.

For example, fc-query /usr/share/fonts/truetype/ttf-dejavu/DejaVuSans.ttf on my Debian shows this:

…
charset: 
    0000: 00000000 ffffffff ffffffff 7fffffff 00000000 ffffffff ffffffff ffffffff
    0001: ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff
    0002: ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff 008873ff
…

It shows the supported character ranges, although it doesn't which block it belongs to (you have to know which range belongs to which block).

For example, the fourth column of 0000, which corresponds to U+0060 - U+007F, has a hex value of 7fffffff. This has a bit value of 0111 1111 1111 1111 1111 1111 1111 1111, where the right most bit is U+0060, and the left most is U+007F. This means that U+007F is not supported in this font.

You'd probably need to write a script that makes bitwise operations on the information provided by fc-query.

P/S: My favorite go-to site for unicode information is FileFormat.Info

Related Question