* 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).
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96
diff --git a/ChangeLog b/ChangeLog
index 3aeffcf..e9a636c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,12 @@
2006-01-31 Chia-I Wu <b90201047@ntu.edu.tw>
+ * 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 <b90201047@ntu.edu.tw>
+
* include/freetype/internal/t1types.h (AFM_FontInfo),
src/psaux/afmparse.c, src/tools/test_afm.c: Read `FontBBox',
`Ascender', and `Descender' from an AFM.
diff --git a/src/cff/cffobjs.c b/src/cff/cffobjs.c
index 623b5d7..a90afb4 100644
--- a/src/cff/cffobjs.c
+++ b/src/cff/cffobjs.c
@@ -461,16 +461,18 @@
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 );
cffface->underline_thickness =
diff --git a/src/cid/cidobjs.c b/src/cid/cidobjs.c
index d6b0a2d..16ddc47 100644
--- 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;
diff --git a/src/pfr/pfrobjs.c b/src/pfr/pfrobjs.c
index 60191e8..3e2beee 100644
--- 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 )
{
diff --git a/src/type1/t1objs.c b/src/type1/t1objs.c
index ae715f5..c7636ef 100644
--- 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 =