TrueType font

Juliusz Chroboczek Juliusz.Chroboczek at pps.jussieu.fr
Mon Jan 15 13:50:09 PST 2007


> How can I check from my C++ program that a font is a TrueType font?

What do you mean by ``font''?  A font file, an X11 core font instance,
a FontConfig FcPattern or an XftFont, or something else?

TrueType font files have a signature in the first four bytes.  These
bytes should be

  00 01 00 00 for a TrueType font;
  4F 54 54 4F for an OpenType/CFF font.

(OpenType/TTF is just another name for TrueType.)

If it's a core font instance you want to know about (a thingie
returned by XLoadFont), check for the value of the property FONT_TYPE.

If it's an FcPattern you want to look at, check the value of the
property ``fontformat''.

If it's an XftFont, a g_font, a Qt font, or something else, I've got no idea.

                                        Juliusz





More information about the xorg mailing list