Commit 2541a40d953dfa386a0756fcc536b38675215596

Werner Lemberg 2004-07-25T21:18:29

* 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.

diff --git a/ChangeLog b/ChangeLog
index 4265a78..59155c0 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,14 @@
+2004-07-25  Detlef Würkner  <TetiSoft@apg.lahn.de>
+
+	* 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  <peter@e-kadmon.net>
 
 	* src/sfnt/sfobjs.c (sfnt_load_face): Handle
diff --git a/src/bdf/bdfdrivr.c b/src/bdf/bdfdrivr.c
index 8f33d53..1aa3904 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 b6b04b9..ddb9b09 100644
--- a/src/pcf/pcfdrivr.c
+++ b/src/pcf/pcfdrivr.c
@@ -369,13 +369,9 @@ 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 ( 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);
@@ -391,7 +387,7 @@ THE SOFTWARE.
     }
     else
     {
-      FT_TRACE4(( "size WRONG\n" ));
+      FT_TRACE4(( "pixel size WRONG\n" ));
       return PCF_Err_Invalid_Pixel_Size;
     }
   }
@@ -404,12 +400,37 @@ THE SOFTWARE.
                       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 );
 
-    return PCF_Set_Pixel_Size( size, 0, 0 );
+
+    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 )
+    {
+      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(( "size WRONG\n" ));
+      return PCF_Err_Invalid_Pixel_Size;
+    }
   }