From 2541a40d953dfa386a0756fcc536b38675215596 Mon Sep 17 00:00:00 2001 From: Werner Lemberg Date: Sun, 25 Jul 2004 21:18:29 +0000 Subject: [PATCH] * src/pcf/pcfdrivr.c (PCF_Set_Pixel_Size): Compare heights, not ppem values. (PCF_Set_Point_Size): Don't call PCF_Set_Pixel_Size but provide own code to compare ppem values. * src/bdf/bdfdrivr.c (BDF_Set_Pixel_Size): Compare heights, not ppem values. (BDF_Set_Point_Size): Don't call BDF_Set_Pixel_Size but provide own code to compare ppem values. --- ChangeLog | 11 +++++++++ src/bdf/bdfdrivr.c | 40 +++++++++++++++++++++---------- src/pcf/pcfdrivr.c | 59 +++++++++++++++++++++++++++++++--------------- 3 files changed, 78 insertions(+), 32 deletions(-) diff --git a/ChangeLog b/ChangeLog index 4265a78ea..59155c09f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,14 @@ +2004-07-25 Detlef Würkner + + * src/pcf/pcfdrivr.c (PCF_Set_Pixel_Size): Compare heights, not + ppem values. + (PCF_Set_Point_Size): Don't call PCF_Set_Pixel_Size but provide own + code to compare ppem values. + * src/bdf/bdfdrivr.c (BDF_Set_Pixel_Size): Compare heights, not + ppem values. + (BDF_Set_Point_Size): Don't call BDF_Set_Pixel_Size but provide own + code to compare ppem values. + 2004-07-25 Kornfeld Eliyahu Peter * src/sfnt/sfobjs.c (sfnt_load_face): Handle diff --git a/src/bdf/bdfdrivr.c b/src/bdf/bdfdrivr.c index 8f33d537e..1aa3904a9 100644 --- a/src/bdf/bdfdrivr.c +++ b/src/bdf/bdfdrivr.c @@ -586,13 +586,9 @@ THE SOFTWARE. FT_Face root = FT_FACE( face ); FT_UNUSED( char_width ); - FT_UNUSED( char_height ); - FT_TRACE4(( "rec %d - pres %d\n", - size->metrics.y_ppem, root->available_sizes->y_ppem )); - - if ( size->metrics.y_ppem == root->available_sizes->y_ppem >> 6 ) + if ( char_height == (FT_UInt)root->available_sizes->height ) { size->metrics.ascender = face->bdffont->font_ascent << 6; size->metrics.descender = -face->bdffont->font_descent << 6; @@ -614,12 +610,30 @@ THE SOFTWARE. FT_UInt horz_resolution, FT_UInt vert_resolution ) { + BDF_Face face = (BDF_Face)FT_SIZE_FACE( size ); + FT_Face root = FT_FACE( face ); + FT_UNUSED( char_width ); FT_UNUSED( char_height ); FT_UNUSED( horz_resolution ); FT_UNUSED( vert_resolution ); - return BDF_Set_Pixel_Size( size, 0, 0 ); + + FT_TRACE4(( "rec %d - pres %d\n", + size->metrics.y_ppem, root->available_sizes->y_ppem )); + + if ( size->metrics.y_ppem == root->available_sizes->y_ppem >> 6 ) + { + size->metrics.ascender = face->bdffont->font_ascent << 6; + size->metrics.descender = -face->bdffont->font_descent << 6; + size->metrics.height = ( face->bdffont->font_ascent + + face->bdffont->font_descent ) << 6; + size->metrics.max_advance = face->bdffont->bbx.width << 6; + + return BDF_Err_Ok; + } + else + return BDF_Err_Invalid_Pixel_Size; } @@ -629,13 +643,13 @@ THE SOFTWARE. FT_UInt glyph_index, FT_Int32 load_flags ) { - BDF_Face face = (BDF_Face)FT_SIZE_FACE( size ); - FT_Error error = BDF_Err_Ok; - FT_Bitmap* bitmap = &slot->bitmap; - bdf_glyph_t glyph; - int bpp = face->bdffont->bpp; - int i, j, count; - unsigned char *p, *pp; + BDF_Face face = (BDF_Face)FT_SIZE_FACE( size ); + FT_Error error = BDF_Err_Ok; + FT_Bitmap* bitmap = &slot->bitmap; + bdf_glyph_t glyph; + int bpp = face->bdffont->bpp; + int i, j, count; + unsigned char *p, *pp; FT_UNUSED( load_flags ); diff --git a/src/pcf/pcfdrivr.c b/src/pcf/pcfdrivr.c index b6b04b98f..ddb9b093e 100644 --- a/src/pcf/pcfdrivr.c +++ b/src/pcf/pcfdrivr.c @@ -369,11 +369,48 @@ THE SOFTWARE. PCF_Face face = (PCF_Face)FT_SIZE_FACE( size ); FT_UNUSED( pixel_width ); - FT_UNUSED( pixel_height ); - FT_TRACE4(( "rec %d - pres %d\n", size->metrics.y_ppem, - face->root.available_sizes->y_ppem >> 6 )); + if ( pixel_height == (FT_UInt)face->root.available_sizes->height ) + { + size->metrics.ascender = face->accel.fontAscent << 6; + size->metrics.descender = face->accel.fontDescent * (-64); +#if 0 + size->metrics.height = face->accel.maxbounds.ascent << 6; +#endif + size->metrics.height = size->metrics.ascender - + size->metrics.descender; + + size->metrics.max_advance = face->accel.maxbounds.characterWidth << 6; + + return PCF_Err_Ok; + } + else + { + FT_TRACE4(( "pixel size WRONG\n" )); + return PCF_Err_Invalid_Pixel_Size; + } + } + + + FT_CALLBACK_DEF( FT_Error ) + PCF_Set_Point_Size( FT_Size size, + FT_F26Dot6 char_width, + FT_F26Dot6 char_height, + FT_UInt horz_resolution, + FT_UInt vert_resolution ) + { + PCF_Face face = (PCF_Face)FT_SIZE_FACE( size ); + + FT_UNUSED( char_width ); + FT_UNUSED( char_height ); + FT_UNUSED( horz_resolution ); + FT_UNUSED( vert_resolution ); + + + FT_TRACE4(( "rec %d - pres %d\n", + size->metrics.y_ppem, + face->root.available_sizes->y_ppem >> 6 )); if ( size->metrics.y_ppem == face->root.available_sizes->y_ppem >> 6 ) { @@ -397,22 +434,6 @@ THE SOFTWARE. } - FT_CALLBACK_DEF( FT_Error ) - PCF_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 PCF_Set_Pixel_Size( size, 0, 0 ); - } - - FT_CALLBACK_DEF( FT_Error ) PCF_Glyph_Load( FT_GlyphSlot slot, FT_Size size,