bugThe FreeType Project - Bugs: bug #21468, bug in src/winfonts/winfnt.c

 
 

bug #21468: bug in src/winfonts/winfnt.c

Submitted by:  None
Submitted on:  Mon 29 Oct 2007 08:45:19 PM UTC  
 
Severity: 3 - NormalItem Group: Incorrect behaviour
Status: FixedPrivacy: Public
Assigned to: Werner LEMBERG <wl>Open/Closed: Closed
Planned Release: 2.3.6

Add a New Comment(Rich Markup)
   

You are not logged in

Please log in, so followups can be emailed to you.

 

Mon 29 Oct 2007 10:00:38 PM UTC, comment #2:

Applied, thanks!

Werner LEMBERG <wl>
Project AdministratorIn charge of this item.
Mon 29 Oct 2007 08:50:49 PM UTC, comment #1:

first time I was not logged in, here is to mark who I am

Daniel Svoboda <dasvo>
Mon 29 Oct 2007 08:45:19 PM UTC, original submission:

There is a bug in FNT_Face_Init function which systematicaly returns FNT_Err_Bad_Argument for fonts which are not dll fonts and when face_index is > 0 instead of returning FNT_Err_Unknown_File_Format. This bug makes FreeType 2.3.5 unusable for any non-dll fonts with more then one face.

When drivers are applied one by one on font (in my case OSX dfont font), the drivers which doesn't handle the font should return FNT_Err_Unknown_File_Format, but because of the bug FNT_Face_Init returns FNT_Err_Bad_Argument which makes the FT_New_Face call fail with FNT_Err_Bad_Argument error.

I propose this change to resolve the problem:

Replace

if ( error == FNT_Err_Unknown_File_Format )
{
/* this didn't work; try to load a single FNT font */
FNT_Font font;

//vvv REMOVE THIS CONDITION vvv
if ( face_index > 0 )
{
error = FNT_Err_Bad_Argument;
goto Exit;
}

if ( FT_NEW( face->font ) )
goto Exit;

face->root.num_faces = 1;

font = face->font;
font->offset = 0;
font->fnt_size = stream->size;

error = fnt_font_load( font, stream );
}

by

if ( error == FNT_Err_Unknown_File_Format )
{
/* this didn't work; try to load a single FNT font */
FNT_Font font;

if ( FT_NEW( face->font ) )
goto Exit;

face->root.num_faces = 1;

font = face->font;
font->offset = 0;
font->fnt_size = stream->size;

error = fnt_font_load( font, stream );

//vvv MOVE IT HERE vvv
if (!error && face_index > 0 )
{
error = FNT_Err_Bad_Argument;
}
}

In other words, we shoul return FNT_Err_Bad_Argument only in the case, that we are sure the fnt_font_load succeeds, only then we can say, that error is asking about face_index > 0, because the font has only one.

I am ready to answer any question on dasvo [at] planeta [dot] cz

Thanks,

Daniel Svoboda

Anonymous

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach File(s):
   
   
Comment:
   

Attached Files
file #14248:  winfnt.c added by dasvo (32KiB - application/octet-stream - winfnt.c file with proposed solution implemented see lines 695-715)

 

Depends on the following items: None found

Digest:
   bug dependencies.

 

Carbon-Copy List
  • -unavailable- added by wl (Posted a comment)
  • -unavailable- added by dasvo (Posted a comment)
  •  

    Do you think this task is very important?
    If so, you can click here to add your encouragement to it.
    This task has 0 encouragements so far.

    Only logged-in users can vote.

     

    Please enter the title of George Orwell's famous dystopian book (it's a date):

     

     

    Follow 6 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Wed 19 Mar 2008 07:36:36 AM UTCwlDependencies-=>bugs #22664 is dependent
    Mon 29 Oct 2007 10:00:38 PM UTCwlStatusNone=>Fixed
      Assigned toNone=>wl
      Open/ClosedOpen=>Closed
      Planned ReleaseNone=>2.3.6
    Mon 29 Oct 2007 08:59:35 PM UTCdasvoAttached File-=>Added winfnt.c, #14248

    Back to the top


    Powered by Savane 3.1-cleanup1