summaryrefslogtreecommitdiff
path: root/src/cid
diff options
context:
space:
mode:
authorTom Kacvinsky <tom.kacvinsky@3ds.com>2001-03-10 19:04:41 +0000
committerTom Kacvinsky <tom.kacvinsky@3ds.com>2001-03-10 19:04:41 +0000
commit025c2f3fb6c364845616b8eaa9847aa6e3dcd54b (patch)
treef5c48c6446096010fa67c4eea709f0dc21e97a15 /src/cid
parentc2f44c16083485ba28ad5115319106d8c5a9e8ce (diff)
downloadfreetype2-025c2f3fb6c364845616b8eaa9847aa6e3dcd54b.tar.gz
Added units_per_EM processing to parse_font_matrix, and added FT_Fixed
number handling to parse_font_bbox.
Diffstat (limited to 'src/cid')
-rw-r--r--src/cid/cidload.c34
1 files changed, 21 insertions, 13 deletions
diff --git a/src/cid/cidload.c b/src/cid/cidload.c
index 057bead53..5fa4c6114 100644
--- a/src/cid/cidload.c
+++ b/src/cid/cidload.c
@@ -160,15 +160,15 @@
FT_Error parse_font_bbox( CID_Face face,
CID_Parser* parser )
{
- FT_Short temp[4];
+ FT_Fixed temp[4];
FT_BBox* bbox = &face->cid.font_bbox;
- (void)CID_ToCoordArray( parser, 4, temp );
- bbox->xMin = temp[0];
- bbox->yMin = temp[1];
- bbox->xMax = temp[2];
- bbox->yMax = temp[3];
+ (void)CID_ToFixedArray( parser, 4, temp, 0 );
+ bbox->xMin = FT_RoundFix( temp[0] );
+ bbox->yMin = FT_RoundFix( temp[1] );
+ bbox->xMax = FT_RoundFix( temp[2] );
+ bbox->yMax = FT_RoundFix( temp[3] );
return T1_Err_Ok; /* this is a callback function; */
/* we must return an error code */
@@ -182,8 +182,9 @@
FT_Matrix* matrix;
FT_Vector* offset;
CID_FontDict* dict;
+ FT_Face root = (FT_Face)&face->root;
FT_Fixed temp[6];
-
+ FT_Fixed temp_scale;
if ( parser->num_dict >= 0 )
{
@@ -193,14 +194,21 @@
(void)CID_ToFixedArray( parser, 6, temp, 3 );
+ temp_scale = ABS( temp[3] );
+
+ /* Set Units per EM based on FontMatrix values. We set the value to */
+ /* 1000 / temp_scale, because temp_scale was already multiplied by */
+ /* 1000 (in t1_tofixed, from psobjs.c). */
+ root->units_per_EM = FT_DivFix( 0x10000L, FT_DivFix( temp_scale, 1000 ) );
+
/* we need to scale the values by 1.0/temp[3] */
- if ( temp[3] != 0x10000L )
+ if ( temp_scale != 0x10000L )
{
- temp[0] = FT_DivFix( temp[0], temp[3] );
- temp[1] = FT_DivFix( temp[1], temp[3] );
- temp[2] = FT_DivFix( temp[2], temp[3] );
- temp[4] = FT_DivFix( temp[4], temp[3] );
- temp[5] = FT_DivFix( temp[5], temp[3] );
+ temp[0] = FT_DivFix( temp[0], temp_scale );
+ temp[1] = FT_DivFix( temp[1], temp_scale );
+ temp[2] = FT_DivFix( temp[2], temp_scale );
+ temp[4] = FT_DivFix( temp[4], temp_scale );
+ temp[5] = FT_DivFix( temp[5], temp_scale );
temp[3] = 0x10000L;
}