shithub: freetype+ttf2subf

Download patch

ref: 2541a40d953dfa386a0756fcc536b38675215596
parent: 91d0f1ebbe214379f2bb87f1709c350400fa9f61
author: Werner Lemberg <[email protected]>
date: Sun Jul 25 17:18:29 EDT 2004

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

git/fs: mount .git/fs: mount/attach disallowed
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,14 @@
+2004-07-25  Detlef W�rkner  <[email protected]>
+
+	* 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  <[email protected]>
 
 	* src/sfnt/sfobjs.c (sfnt_load_face): Handle
--- a/src/bdf/bdfdrivr.c
+++ b/src/bdf/bdfdrivr.c
@@ -586,13 +586,9 @@
     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 @@
                       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 @@
                   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 );
 
--- a/src/pcf/pcfdrivr.c
+++ b/src/pcf/pcfdrivr.c
@@ -369,13 +369,9 @@
     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 @@
     }
     else
     {
-      FT_TRACE4(( "size WRONG\n" ));
+      FT_TRACE4(( "pixel size WRONG\n" ));
       return PCF_Err_Invalid_Pixel_Size;
     }
   }
@@ -404,12 +400,37 @@
                       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;
+    }
   }