From a37da21a494f975e4307e62b105aae026092390d Mon Sep 17 00:00:00 2001 From: Alexei Podtelezhnikov Date: Mon, 10 Aug 2015 23:05:02 -0400 Subject: [PATCH] [type1,cid,type42] Minor improvements. * src/type1/t1load.c (t1_parse_font_matrix): Scale units per EM only when necessary. Refresh comments. * src/cid/cidload.c (cid_parse_font_matrix): Ditto. * src/type42/t42parse.c (t42_parse_font_matrix): Refresh comments. --- ChangeLog | 9 +++++++++ src/cid/cidload.c | 12 +++++------- src/type1/t1load.c | 12 +++++------- src/type42/t42parse.c | 2 +- 4 files changed, 20 insertions(+), 15 deletions(-) diff --git a/ChangeLog b/ChangeLog index 0e707674a..b27202807 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +2015-08-10 Alexei Podtelezhnikov + + [type1,cid,type42] Minor improvements. + + * src/type1/t1load.c (t1_parse_font_matrix): Scale units per EM only + when necessary. Refresh comments. + * src/cid/cidload.c (cid_parse_font_matrix): Ditto. + * src/type42/t42parse.c (t42_parse_font_matrix): Refresh comments. + 2015-08-08 Werner Lemberg [type42] Fix glyph access. diff --git a/src/cid/cidload.c b/src/cid/cidload.c index 6f3586055..676527478 100644 --- a/src/cid/cidload.c +++ b/src/cid/cidload.c @@ -167,6 +167,7 @@ matrix = &dict->font_matrix; offset = &dict->font_offset; + /* input is scaled by 1000 to accomodate default FontMatrix */ result = cid_parser_to_fixed_array( parser, 6, temp, 3 ); if ( result < 6 ) @@ -180,15 +181,12 @@ return FT_THROW( Invalid_File_Format ); } - /* 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_UShort)FT_DivFix( 1000, temp_scale ); - - /* we need to scale the values by 1.0/temp[3] */ + /* atypical case */ if ( temp_scale != 0x10000L ) { + /* set units per EM based on FontMatrix values */ + root->units_per_EM = (FT_UShort)FT_DivFix( 1000, temp_scale ); + temp[0] = FT_DivFix( temp[0], temp_scale ); temp[1] = FT_DivFix( temp[1], temp_scale ); temp[2] = FT_DivFix( temp[2], temp_scale ); diff --git a/src/type1/t1load.c b/src/type1/t1load.c index 376c90ce2..d94356753 100644 --- a/src/type1/t1load.c +++ b/src/type1/t1load.c @@ -1107,6 +1107,7 @@ FT_Int result; + /* input is scaled by 1000 to accomodate default FontMatrix */ result = T1_ToFixedArray( parser, 6, temp, 3 ); if ( result < 6 ) @@ -1124,15 +1125,12 @@ return; } - /* 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_UShort)FT_DivFix( 1000, temp_scale ); - - /* we need to scale the values by 1.0/temp_scale */ + /* atypical case */ if ( temp_scale != 0x10000L ) { + /* set units per EM based on FontMatrix values */ + root->units_per_EM = (FT_UShort)FT_DivFix( 1000, temp_scale ); + temp[0] = FT_DivFix( temp[0], temp_scale ); temp[1] = FT_DivFix( temp[1], temp_scale ); temp[2] = FT_DivFix( temp[2], temp_scale ); diff --git a/src/type42/t42parse.c b/src/type42/t42parse.c index f0dfde8d3..fadbf21ab 100644 --- a/src/type42/t42parse.c +++ b/src/type42/t42parse.c @@ -268,7 +268,7 @@ return; } - /* we need to scale the values by 1.0/temp_scale */ + /* atypical case */ if ( temp_scale != 0x10000L ) { temp[0] = FT_DivFix( temp[0], temp_scale );