freetype
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Freetype] Symbol encoding


From: Thomas Hudson
Subject: [Freetype] Symbol encoding
Date: Wed, 17 Oct 2001 15:39:26 -0700

I came across some fonts recently that had none of the
standard encodings and I thought I'd pass on my experience
to hopefully save someone else some time. In two cases
the fonts had two encodings; Apple Roman and Symbol.
In another case the only encoding was Symbol. I found
somewhere on the unicode site a mapping from Unicode
to Symbol, however this didn't work. After stepping 
though FT_Get_Char_Index I found that the file actually
used ASCII values for the low byte with the high byte
set to 0xf0. Or I should say, this is how windows 
applications such as Word map symbol glyphs to
keystrokes. So for example, 'a' (0x61) in Word
converts to greek alpha in the Symbol font, which
can be looked up with:

glyph_index = FT_Get_Char_Index(face, 0xf061);

or generalized as:

glyph_index = FT_Get_Char_Index(face, 
     (face->charmap->encoding == ft_encoding_symbol) ? c & 0xf000: c);

Of course you'll also need to set the charmap for the
face, since freetype won't set it to anything if
any of the standard maps (unicode, latin2, ascii) aren't
found. We use:

if (!face->charmap 
    && FT_Select_Charmap(face,ft_encoding_apple_roman)
    && FT_Select_Charmap(face,ft_encoding_symbol))
  FT_Set_Charmap(face,face->charmaps[0]); 


Thomas



reply via email to

[Prev in Thread] Current Thread [Next in Thread]