shithub: freetype+ttf2subf

Download patch

ref: d8723b4fb21fb2093641a8eeb0d81e8b0a53eb06
parent: 1216e434cc9f1d2e79bfbd007516da314edec43b
author: David Turner <[email protected]>
date: Fri Apr 14 07:29:14 EDT 2000

fixed another small bug. The metrics were not computed
correctly..

git/fs: mount .git/fs: mount/attach disallowed
--- a/src/type1z/t1gload.c
+++ b/src/type1z/t1gload.c
@@ -1302,23 +1302,6 @@
         FT_BBox           cbox;
         FT_Glyph_Metrics* metrics = &glyph->root.metrics;
   
-        FT_Outline_Get_CBox( &glyph->root.outline, &cbox );
-  
-        /* grid fit the bounding box if necessary */
-        if (hinting)
-        {
-          cbox.xMin &= -64;
-          cbox.yMin &= -64;
-          cbox.xMax = ( cbox.xMax+63 ) & -64;
-          cbox.yMax = ( cbox.yMax+63 ) & -64;
-        }
-  
-        metrics->width  = cbox.xMax - cbox.xMin;
-        metrics->height = cbox.yMax - cbox.yMin;
-  
-        metrics->horiBearingX = cbox.xMin;
-        metrics->horiBearingY = cbox.yMax;
-  
         /* copy the _unscaled_ advance width */
         metrics->horiAdvance  = decoder.builder.advance.x;
   
@@ -1330,7 +1313,7 @@
         glyph->root.format = ft_glyph_format_outline;
   
         glyph->root.outline.flags &= ft_outline_owner;
-        if ( size->root.metrics.y_ppem < 24 )
+        if ( size && size->root.metrics.y_ppem < 24 )
           glyph->root.outline.flags |= ft_outline_high_precision;
 
         glyph->root.outline.flags |= ft_outline_reverse_fill;
@@ -1356,13 +1339,10 @@
             vec->x = FT_MulFix( vec->x, x_scale );
             vec->y = FT_MulFix( vec->y, y_scale );
           }
-  
+
+          FT_Outline_Get_CBox( &glyph->root.outline, &cbox );
+    
           /* Then scale the metrics */
-          metrics->width  = FT_MulFix( metrics->width,  x_scale );
-          metrics->height = FT_MulFix( metrics->height, y_scale );
-  
-          metrics->horiBearingX = FT_MulFix( metrics->horiBearingX, x_scale );
-          metrics->horiBearingY = FT_MulFix( metrics->horiBearingY, y_scale );
           metrics->horiAdvance  = FT_MulFix( metrics->horiAdvance,  x_scale );
   
           metrics->vertBearingX = FT_MulFix( metrics->vertBearingX, x_scale );
@@ -1369,6 +1349,24 @@
           metrics->vertBearingY = FT_MulFix( metrics->vertBearingY, y_scale );
           metrics->vertAdvance  = FT_MulFix( metrics->vertAdvance,  x_scale );
         }
+
+        /* compute the other metrics */
+        FT_Outline_Get_CBox( &glyph->root.outline, &cbox );
+        
+        /* grid fit the bounding box if necessary */
+        if (hinting)
+        {
+          cbox.xMin &= -64;
+          cbox.yMin &= -64;
+          cbox.xMax = ( cbox.xMax+63 ) & -64;
+          cbox.yMax = ( cbox.yMax+63 ) & -64;
+        }
+
+        metrics->width  = cbox.xMax - cbox.xMin;
+        metrics->height = cbox.yMax - cbox.yMin;
+
+        metrics->horiBearingX = cbox.xMin;
+        metrics->horiBearingY = cbox.yMax;
       }
     }
     return error;