9

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

3 Answers 3

8

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

2
  • Where do I find the information about which range belongs to which block?
    – akaihola
    Nov 6, 2013 at 10:19
  • Ah, the line number gives the leftmost hex digits of the code point, and the position of the bit in the bit field gives the rightmost two hex digits. Right?
    – akaihola
    Nov 6, 2013 at 10:27
1

I'd recommend FontForge. It is available in Ubuntu's package manager simply as fontforge.

2
  • Yep, I Found this programm - but as I understand it has only GUI interface, but I need terminal, to automize this thing Apr 7, 2012 at 6:20
  • @ShockwaveNN: well, say so in your question then. Your chances of getting a fitting answer to your question increases if you state your actual question. Apr 7, 2012 at 9:00
1

Note for anyone finding this ..

fc-query isn't 100% reliable on the charset output.

For example Yogafont on dafont.com this shows an empty character set, though it definitely does have characters in it.

$ fc-query yogafont.TTF
Pattern has 20 elts (size 32)
    family: "Yogafont"(s)
    familylang: "en"(s)
    style: "Regular"(s)
    stylelang: "en"(s)
    fullname: "Yogafont"(s)
    fullnamelang: "en"(s)
    slant: 0(i)(s)
    weight: 80(i)(s)
    width: 100(i)(s)
    spacing: 100(i)(s)
    foundry: "unknown"(s)
    file: "yogafont.TTF"(s)
    index: 0(i)(s)
    outline: FcTrue(s)
    scalable: FcTrue(s)
    charset: 
(s)
    lang: (s)
    fontversion: 0(i)(s)
    fontformat: "TrueType"(s)
    decorative: FcFalse(s)

Other fonts with drawings in them such as WW1 show a limited character set.

$ fc-query WW1-A___.TTF 
Pattern has 19 elts (size 32)
    family: "WW1  A"(s)
    familylang: "en"(s)
    style: "Regular"(s)
    stylelang: "en"(s)
    fullname: "WW1  A"(s)
    fullnamelang: "en"(s)
    slant: 0(i)(s)
    weight: 80(i)(s)
    width: 100(i)(s)
    foundry: "unknown"(s)
    file: "WW1-A___.TTF"(s)
    index: 0(i)(s)
    outline: FcTrue(s)
    scalable: FcTrue(s)
    charset: 
    0000: 00000000 00000001 00000000 0001fffe 00000000 00000000 00000000 00000000
(s)
    lang: (s)
    fontversion: 65536(i)(s)
    fontformat: "TrueType"(s)
    decorative: FcFalse(s)

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .