[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Freetype] unicode in ttf
From: |
Werner LEMBERG |
Subject: |
Re: [Freetype] unicode in ttf |
Date: |
Mon, 17 Dec 2001 01:21:58 +0100 (CET) |
> How do I find out a glyph index of characters>128 in TrueType Fonts when
> the character is not ASCII but in Latin2 or CP1250 codepage ?
You have to use the cmap.
> FT_Get_Char_Index(face, char) simply doesn't work, because it (I
> believe) knows nothing about the codepage the char is encoded in.
> If I translate char to unicode representation and do a
> FT_Get_Name_Index(face, char*), it returns 0 because name_index is
> NOT IMPLEMENTED in TrueType driver.
This is the wrong solution. TrueType fonts are *not* handled by
glyph names but with character codes only. The glyph name
information is optional; there are a lot of fonts which don't have
the corresponding font table.
The correct way is to activate a Unicode cmap (i.e. PID,EID=3,1), then
convert the character code of your encoding to Unicode, and finally
using FT_Get_Char_Index() to convert the Unicode encoded character
into a glyph index.
> I'm using version 2.0.5, I checked the source code thoroughly and I
> think that FT_Get_Name_Index works only for PostScript and CCF
> fonts. Is that true?
Yes. It makes not much sense for other font formats.
Werner