freetype-devel
[Top][All Lists]
Advanced

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

Re: [Devel] 2.0.8 released


From: Detlef Würkner
Subject: Re: [Devel] 2.0.8 released
Date: Sun, 10 Mar 2002 19:57:39 +0100

address@hidden (David Turner) wrote:

>   Now is time to add the relevant PCF patches.

Hm, 2.0.9 is out and no PCF patch in there.

IMHO we all agreed that there is a bug in the PCF accelerator table
metrics parsing routine. And IMHO we had a consensus that the character
height in face->available_sizes should be computed from
face->accel.maxbounds.ascent + face->accel.maxbounds.descent after
the fixed accel parsing guarantees correct accelerator tables.

The only open question IMHO was whether the width should be
face->accel.maxbounds.characterWidth or the same as the height, my
opinion was it should be the pixel width of the global bounding box
similar to the winfnt driver, Keith' opinion was it should be the same as
the height. But both would be better than the current behaviour IMHO.

Here's my favorite patch against 2.0.9:
----8<----
--- freetype-2.0.9/src/pcf/pcfread.c.ori        Fri Feb  8 06:23:50 2002
+++ freetype-2.0.9/src/pcf/pcfread.c    Sun Mar 10 18:39:36 2002
@@ -205,12 +205,13 @@
   static FT_Error
   pcf_get_metric( FT_Stream   stream,
                   FT_ULong    format,
-                  PCF_Metric  metric )
+                  PCF_Metric  metric,
+                  FT_Bool     uncompressed )
   {
     FT_Error  error = PCF_Err_Ok;
 
 
-    if ( PCF_FORMAT_MATCH( format, PCF_DEFAULT_FORMAT ) )
+    if ( uncompressed || PCF_FORMAT_MATCH( format, PCF_DEFAULT_FORMAT ) )
     {
       const FT_Frame_Field*   fields; 
   
@@ -520,7 +521,7 @@
     metrics = face->metrics;
     for ( i = 0; i < nmetrics; i++ )
     {
-      pcf_get_metric( stream, format, metrics + i );
+      pcf_get_metric( stream, format, metrics + i, 0 );
 
       metrics[i].bits = 0;
 
@@ -821,21 +822,21 @@
         goto Bail;
     }
 
-    error = pcf_get_metric( stream, format, &(accel->minbounds) );
+    error = pcf_get_metric( stream, format, &(accel->minbounds), 1 );
     if ( error )
       goto Bail;
 
-    error = pcf_get_metric( stream, format, &(accel->maxbounds) );
+    error = pcf_get_metric( stream, format, &(accel->maxbounds), 1 );
     if ( error )
       goto Bail;
 
     if ( PCF_FORMAT_MATCH( format, PCF_ACCEL_W_INKBOUNDS ) )
     {
-      error = pcf_get_metric( stream, format, &(accel->ink_minbounds) );
+      error = pcf_get_metric( stream, format, &(accel->ink_minbounds), 1 );
       if ( error )
         goto Bail;
 
-      error = pcf_get_metric( stream, format, &(accel->ink_maxbounds) );
+      error = pcf_get_metric( stream, format, &(accel->ink_maxbounds), 1 );
       if ( error )
         goto Bail;
     }
@@ -908,7 +909,6 @@
     {
       FT_Face       root = FT_FACE( face );
       PCF_Property  prop;
-      int           size_set = 0;
 
 
       root->num_faces = 1;
@@ -967,54 +967,19 @@
       if ( ALLOC_ARRAY( root->available_sizes, 1, FT_Bitmap_Size ) )
         goto Bail;
 
-      prop = pcf_find_property( face, "PIXEL_SIZE" );
-      if ( prop != NULL )
-      {
-        root->available_sizes->height = 
-        root->available_sizes->width  = (FT_Short)( prop->value.integer );
-
-#if 0  /* average width property support removed until maturation */
-        prop = pcf_find_property( face, "AVERAGE_WIDTH" );
-        if ( prop != NULL )
-          root->available_sizes->width = (FT_Short)( prop->value.integer / 10 
);
-#endif
-        
-        size_set = 1;
-      }
-      else 
+      if ( ( face->accel.maxbounds.characterWidth >  0 ) &&
+           ( face->accel.maxbounds.ascent         >  0 ) &&
+           ( face->accel.maxbounds.descent        >= 0 ) )
       {
-        prop = pcf_find_property( face, "POINT_SIZE" );
-        if ( prop != NULL )
-        {
-          PCF_Property  xres, yres, avgw;
-
-
-          xres = pcf_find_property( face, "RESOLUTION_X" );
-          yres = pcf_find_property( face, "RESOLUTION_Y" );
-          avgw = pcf_find_property( face, "AVERAGE_WIDTH" );
-
-          if ( ( yres != NULL ) && ( xres != NULL ) )
-          {
-            root->available_sizes->height =
-              (FT_Short)( prop->value.integer *  
-                          yres->value.integer / 720 ); 
-
-#if 0  /* average width property support removed until maturation */
-            if ( avgw != NULL )
-              root->available_sizes->width =
-                (FT_Short)( avgw->value.integer / 10 );
-            else
-#endif            
-              root->available_sizes->width =
-                (FT_Short)( prop->value.integer *  
-                            xres->value.integer / 720 );
-                  
-            size_set = 1;
-          }
-        }
+        /* bbox, units_per_EM, ascender, descender, height, max_advance_width,
+         * max_advance_height, underline_position and underline_thickness
+         * are only relevant for scalable formats.
+         */
+        root->available_sizes->width  = face->accel.maxbounds.characterWidth;
+        root->available_sizes->height =
+          face->accel.maxbounds.ascent + face->accel.maxbounds.descent;
       }
-
-      if (size_set == 0 )
+      else
       {
 #if 0
         printf( "PCF Warning: Pixel Size undefined, assuming 12\n");
----8<----

Ciao, Detlef
-- 
_ // address@hidden
\X/  Detlef Wuerkner, Langgoens/Germany



reply via email to

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