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
|