shithub: freetype+ttf2subf

Download patch

ref: 5d146851dfa8d542a363dbcdc309e2471cc87cbe
parent: 98d802b83a3e4f6a62ef58dcc2269e199b13a27a
author: Wu, Chia-I (吳佳一) <[email protected]>
date: Tue Jan 31 05:29:44 EST 2006

* src/cff/cffobjs.c (cff_face_init), src/cid/cidobjs.c
(cid_face_init), src/pfr/pfrobjs.c (pfr_face_init), src/type1/t1objs.c
(T1_Face_Init): Set face->height to
MAX(1.2 * units_per_EM, ascender - descender).

git/fs: mount .git/fs: mount/attach disallowed
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,12 @@
 2006-01-31  Chia-I Wu  <[email protected]>
 
+	* src/cff/cffobjs.c (cff_face_init), src/cid/cidobjs.c
+	(cid_face_init), src/pfr/pfrobjs.c (pfr_face_init), src/type1/t1objs.c
+	(T1_Face_Init): Set face->height to
+	MAX(1.2 * units_per_EM, ascender - descender).
+
+2006-01-31  Chia-I Wu  <[email protected]>
+
 	* include/freetype/internal/t1types.h (AFM_FontInfo),
 	src/psaux/afmparse.c, src/tools/test_afm.c: Read `FontBBox',
 	`Ascender', and `Descender' from an AFM.
--- a/src/cff/cffobjs.c
+++ b/src/cff/cffobjs.c
@@ -461,15 +461,17 @@
         cffface->bbox.xMax = ( dict->font_bbox.xMax + 0xFFFFU ) >> 16;
         cffface->bbox.yMax = ( dict->font_bbox.yMax + 0xFFFFU ) >> 16;
 
-        cffface->ascender  = (FT_Short)( cffface->bbox.yMax );
-        cffface->descender = (FT_Short)( cffface->bbox.yMin );
-        cffface->height    = (FT_Short)(
-          ( ( cffface->ascender - cffface->descender ) * 12 ) / 10 );
-
         if ( !dict->units_per_em )
           dict->units_per_em = 1000;
 
         cffface->units_per_EM = dict->units_per_em;
+
+        cffface->ascender  = (FT_Short)( cffface->bbox.yMax );
+        cffface->descender = (FT_Short)( cffface->bbox.yMin );
+
+        cffface->height = (FT_Short)( ( cffface->units_per_EM * 12 ) / 10 );
+        if ( cffface->height < cffface->ascender - cffface->descender )
+          cffface->height = cffface->ascender - cffface->descender;
 
         cffface->underline_position  =
           (FT_Short)( dict->underline_position >> 16 );
--- a/src/cid/cidobjs.c
+++ b/src/cid/cidobjs.c
@@ -422,8 +422,10 @@
 
       cidface->ascender  = (FT_Short)( cidface->bbox.yMax );
       cidface->descender = (FT_Short)( cidface->bbox.yMin );
-      cidface->height    = (FT_Short)(
-        ( ( cidface->ascender - cidface->descender ) * 12 ) / 10 );
+
+      cidface->height = (FT_Short)( ( cidface->units_per_EM * 12 ) / 10 );
+      if ( cidface->height < cidface->ascender - cidface->descender )
+        cidface->height = cidface->ascender - cidface->descender;
 
       cidface->underline_position  = (FT_Short)info->underline_position;
       cidface->underline_thickness = (FT_Short)info->underline_thickness;
--- a/src/pfr/pfrobjs.c
+++ b/src/pfr/pfrobjs.c
@@ -165,8 +165,10 @@
       pfrface->units_per_EM = (FT_UShort)phy_font->outline_resolution;
       pfrface->ascender     = (FT_Short) phy_font->bbox.yMax;
       pfrface->descender    = (FT_Short) phy_font->bbox.yMin;
-      pfrface->height       = (FT_Short)(
-        ( ( pfrface->ascender - pfrface->descender ) * 12 ) / 10 );
+
+      pfrface->height = (FT_Short)( ( pfrface->units_per_EM * 12 ) / 10 );
+      if ( pfrface->height < pfrface->ascender - pfrface->descender )
+        pfrface->height = pfrface->ascender - pfrface->descender;
 
       if ( phy_font->num_strikes > 0 )
       {
--- a/src/type1/t1objs.c
+++ b/src/type1/t1objs.c
@@ -414,8 +414,10 @@
 
       root->ascender  = (FT_Short)( root->bbox.yMax );
       root->descender = (FT_Short)( root->bbox.yMin );
-      root->height    = (FT_Short)(
-        ( ( root->ascender - root->descender ) * 12 ) / 10 );
+
+      root->height = (FT_Short)( ( root->units_per_EM * 12 ) / 10 );
+      if ( root->height < root->ascender - root->descender )
+        root->height = root->ascender - root->descender;
 
       /* now compute the maximum advance width */
       root->max_advance_width =