freetype-devel
[Top][All Lists]
Advanced

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

Re: [Devel] FT_Set_Pixel_Sizes() problem with BDF/PCF drivers


From: Werner LEMBERG
Subject: Re: [Devel] FT_Set_Pixel_Sizes() problem with BDF/PCF drivers
Date: Wed, 21 Jul 2004 07:47:57 +0200 (CEST)

[I'm citing almost the whole email to make it easier to understand
the problem.]

> I'm using the FreeType2 font/size/glyph cache and call
> FTC_Manager_LookupSize() to get a font size object.  With BDF and
> PCF bitmap font formats that contain one bitmap size per face I do
> set up the scaler structure passed as argument to
> 
>   scaler.width  = face->available_sizes->width;
>   scaler.height = face->available_sizes->height;
>   scaler.pixel  = TRUE;
> 
> Then FTC_Manager_LookupSize() calls FT_Set_Pixel_Sizes() with the
> width and height passed in the scaler structure, this calls e.g.
> BDF_Set_Pixel_Size() and this function compares something completely
> different from a pixel size and fails for many BDF fonts:
> 
>   FT_CALLBACK_DEF( FT_Error )
>   BDF_Set_Pixel_Size( FT_Size  size,
>                       FT_UInt  char_width,
>                       FT_UInt  char_height )
>   {
>     BDF_Face  face = (BDF_Face)FT_SIZE_FACE( size );
>     FT_Face   root = FT_FACE( face );
> 
>     FT_UNUSED( char_width );
>     FT_UNUSED( char_height );
>     [...]
>     if ( size->metrics.y_ppem == root->available_sizes->y_ppem >> 6 )
>     {
>       [...]
>       return BDF_Err_Ok;
>     }
>     else
>       return BDF_Err_Invalid_Pixel_Size;
>   }
> 
> OTOH, BDF_Set_Point_Size looks like this:
> 
>   FT_CALLBACK_DEF( FT_Error )
>   BDF_Set_Point_Size( FT_Size     size,
>                       FT_F26Dot6  char_width,
>                       FT_F26Dot6  char_height,
>                       FT_UInt     horz_resolution,
>                       FT_UInt     vert_resolution )
>   {
>     FT_UNUSED( char_width );
>     FT_UNUSED( char_height );
>     FT_UNUSED( horz_resolution );
>     FT_UNUSED( vert_resolution );
> 
>     return BDF_Set_Pixel_Size( size, 0, 0 );
>   }
> 
> IMHO the current content of BDF_Set_Pixel_Size() should be copied to
> BDF_Set_Point_Size(), and then BDF_Set_Pixel_Size should be changed
> to something like
> 
>   FT_CALLBACK_DEF( FT_Error )
>   BDF_Set_Pixel_Size( FT_Size  size,
>                       FT_UInt  char_width,
>                       FT_UInt  char_height )
>   {
>     BDF_Face  face = (BDF_Face)FT_SIZE_FACE( size );
>     FT_Face   root = FT_FACE( face );
> 
>     FT_UNUSED( char_width );
> 
> 
>     if ( char_height == (FT_UInt)root->available_sizes->height )
>     {
>       [...] /* Set size metrics here */
>       return BDF_Err_Ok;
>     }
>     else
>       return BDF_Err_Invalid_Pixel_Size;
>   }
> 
> that compares the pixel height.  The same for the PCF driver,
> although with that format the problem did not appear here yet,
> probably because the PCF metrics are normally more accurate than the
> BDF metrics or I didnt test enough fonts.
>
> To reproduce the problem, I have a courR08.bdf [from X11's
> xc/fonts/bdf/100dpi] here where the available_sizes object contains
> height 10, width 6, size 7, x_ppem 11, y_ppem 11, comparing height
> 10 with y_ppem 11 always fails. Can send that font via private mail
> on demand.

I agree with your analysis.  Keith, any comments on this?  Detlef, I
assume that you've tested your changes, and it works for you for both
PCF and BDF.  Can you provide a patch (or new code) based on the
current CVS which I can easily integrate?


    Werner



reply via email to

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