freetype-devel
[Top][All Lists]
Advanced

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

Re: [ft-devel] Problem with OptaneCompactExtrabold.fam font suitcase


From: mpsuzuki
Subject: Re: [ft-devel] Problem with OptaneCompactExtrabold.fam font suitcase
Date: Thu, 14 Feb 2008 16:19:45 +0900

Hi,

Thank you for very very quick reply.

Umm, in the viewpoint of coding at atomic level,
your suggestion to check the pointer returned by
GetResource() is good idea, definitely.

However, it makes me afraid there are more similar
bugs are left that I have to fix. Following is my
understanding of the crashing scenario.

--

* OptaneCompactExtraBold.fam includes multiple faces.
  The FOND references in OptaneCompactExtraBold.fam
  declare as if N (>= 7) sfnt faces are available
  in total.

* The declared total face number N is obtained by
  summing the faces counted by count_faces_sfnt().
  It parses memory image of each FOND header,
  so it's independent with how Carbon counts the
  included faces in given suitcase font file.

* When FT2 tries to get the handle for the 3rd sfnt
  resource by Carbon API GetResource() with sfnt_id
  (sfnt_id is also obtained by direct parsing of FOND
   image, independent with how Carbon calculates),
  GetResource() successfully returns NULL handle.

  The part you referred is slight confusing. The
  resource type 'sfnt' is apparently known, in fact,
  the 1st and 2nd sfnt resources could be accessed.
  So, I guess, sfnt_id is invalid, or
  sfnt_id is valid but the offset to access the sfnt
  resource for given sfnt_id is broken, or
  the data structure of the sfnt resource for the given
  sfnt_id is broken, in the scope of Carbon implementation.

--

Anyway, FT2 is crashed when NULL sfnt handle is
successfully returned. Your suggestion improves
that FT2 can stand with such case.

I will apply your suggestion, but I think that
such broken faces should be excluded when the
available faces in suitcase font file is being
counted. If cannot exclude (or too expensive to
check), appropriate error should be printed.

So here are my 2 questions.

* The NULL handle for 3rd sfnt resource is
  casued by any problems in font file?
  Or, caused by any reason out of font file?

* After your fix, the 7 faces accessed by FT2
  are all different? I'm afraid that 3rd and
  4th faces are same.

Regards,
mpsuzuki

On Wed, 13 Feb 2008 20:32:00 -0700
Deron Kazmaier <address@hidden> wrote:

>Hello,
>
>I have no idea where the font can be obtained legally. The user was not 
>clear as to copyright and I deleted the font after getting it to work. I 
>can recontact him about getting any details you might need such as 
>copyright holder for the font.
>
>I also should mention that the Apple Docs for GetResource states:
>
>"... If you call GetResource with a resource type that can’t be found in 
>any of the resource maps of the open resource forks, the function 
>returns NULL, but ResError returns the result code noErr. You should 
>always check that the value of the returned handle is not NULL...."
>
>Let me know what I can do to help,
>
>Deron
>
>
>address@hidden wrote:
>> Hi,
>>
>> I checked google but all OptaneCompactExtraBold I could
>> download were for Windows TTF (including only 1 face).
>> Could you tell me where I can download the suitcase version?
>>
>> Regards,
>> mpsuzuki
>>
>> On Sat, 02 Feb 2008 12:42:06 -0700
>> Deron Kazmaier <address@hidden> wrote:
>>   
>>> A Mac user provided to me a font suitcase file 
>>> (OptaneCompactExtrabold.fam) that crashes FreeType (2.3.5 and latest 
>>> CVS) when referencing face index #3. I tracked it down to the first call 
>>> in FT_New_Face_From_SFNT (ftmac.c).
>>>
>>>    sfnt = GetResource( FT_MAKE_TAG( 's', 'f', 'n', 't' ), sfnt_id );
>>>    if ( ResError() )
>>>      return FT_Err_Invalid_Handle;
>>>
>>> GetResource would return 0, but ResError did not return true. Checking 
>>> for a NULL handle was required to get FreeType to skip it without crashing.
>>>
>>>    if ( sfnt == NULL || ResError() )
>>>      return FT_Err_Invalid_Handle;
>>>
>>> I can now access the 7 faces that is reported to be inside with this change.
>>> Hope that is helpful.




reply via email to

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