freetype-devel
[Top][All Lists]
Advanced

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

Re: FT_Get_Char_Index() returns 0 for char(0x020)


From: Tom Kacvinsky
Subject: Re: FT_Get_Char_Index() returns 0 for char(0x020)
Date: Sun, 15 Oct 2000 06:49:04 -0400 (EDT)

Hi Werner,

More below...

On Sun, 15 Oct 2000, Werner LEMBERG wrote:

> > The return value of FT_Get_Char_index is supposed to be a glyph
> > index.  In a TT font, this is used to get an offset from the loca a
> > table.  In a Type 1 font, there is no loca table, so the index is
> > used to access the elements of the CharStrings dictionary, which is
> > stored in a zero-based array.  Oops!  Does 0 means not defined, or
> > entry zero?
> 
> Sigh.  Two possibilities:
> 
>    1. Change the return type to FT_Long and return -1 for an undefined
>       glyph.
> 
>    2. Define the function as
> 
>         FT_Error  FT_Get_Char_Index( FT_Face   face,
>                                      FT_ULong  charcode,
>                                      FT_UInt*  index );
> 
> I prefer 2.

Option 2 sounds fine...

> > 
> > The other thing is that z1objs.c defines two charmaps:
> >
> > [...]
> > 
> > But z1driver.c only uses the first charmap (platform_id = 3,
> > encoding_id = 1).
> 
> ???  I can't follow.  Get_Char_Index() in z1driver.c uses the charmap
> selected in charmap->encoding which is passed as a parameter.
> 

Look in z1objs.c, lines 305 through 362.  The first thing that is done is
building a charmap from the glyph names in the CharStrings dictionary, and
assigning this to platform_id 3, encoding_id 1.  Then charmap is incremented,
and a charmap with one of platform_id 7, encoding_id 0, 1, or 2 is assigned
based on face->type1.encoding_type.

But in z1driver.c, function Get_Char_index (which is assigned as the callback
for FTDriver_getCharIndex in the type1z driver) uses the cmap which is passed to
it, which is face->charmap (face->charmap[0], not face->charmap[1]).  If I add
code to z1driver.c to use face->charmap[1], Ft_Get_Char_Index returns poper
values for CMEX10, etc...

Regards,

Tom




reply via email to

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