freetype-devel
[Top][All Lists]
Advanced

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

[Devel] Freetype Mac .dfont issues?


From: Dan Williams
Subject: [Devel] Freetype Mac .dfont issues?
Date: Fri, 24 Jan 2003 00:55:50 -0600

Hi,

I'm working on native Mac font support for OpenOffice.org. OOo uses Freetype extensively for its font discovery and rendering, and in working with Mac fonts I'm having a couple problems with it. Please correct me if I'm wrong anywhere here...

From my reading of the source code, FreeType will only pull out the _first_ 'sfnt' resource from a FOND. Say you pass a face_index of 2 to FT_New_Face(). Presumably, this gets passed down the line to FT_New_Face_dfont(). The following snippet I don't quite understand the logic of.

    /* face_index may be -1, in which case we
       just need to do a sanity check */
    if ( face_index < 0 )
      res_index = 1;
    else
    {
      res_index = (short)( face_index + 1 );
      face_index = 0;
    }
    fond = Get1IndResource( 'FOND', res_index );

So what it is doing here is to, if the face_index passed in to FT_New_Face() originally is > -1 (in our case its 2), sets res_index to that # + 1, then face_index to 0? So res_index is correct to get the indexed resource out of the file, but now face_index is 0. This should result in _only_ the first 'sfnt' resource for that font getting pulled out, correct?

The call chain looks like it goes like this:

FT_New_Face( face_index = 2 for example )
...
FT_New_Face_dfont( face_index = 2 )
  face_index is not < 0
  res_index = 3
  face_index = 0
FT_New_Face_FOND( face_index = 0 )
parse_fond( face_index = 0 )
  returns first sfnt resource ID in FOND
FT_New_Face_SFNT
  grabs that sfnt resource and creates the face

So whenever a face_index of > 0 is passed in to FT_New_Face(), you'll only ever get that first SFNT resource because face_index is always going to be 0. There's the provision of getting another face from the file in parse_fond with the "assoc += face_index" statement, but since face_index always is 0 when parse_fond() gets called, only the first face is returned, correct?

Would it be a correct modification, since the face_index is an FT_Long (assuming FT_Long is 32 bits), to use the upper 8 or 16 bits as a FOND index, and the lower 24 or 16 as the SFNT index into that FOND?

Thanks,
Dan

PS - Please copy me in on any responses to this message posted to the address@hidden mailing list as I'm not subscribed. Thanks.




reply via email to

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