[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.
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
diff --git a/ChangeLog b/ChangeLog
index 0e70767..b272028 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2015-08-10 Alexei Podtelezhnikov <apodtele@gmail.com>
+
+ [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 <wl@gnu.org>
[type42] Fix glyph access.
diff --git a/src/cid/cidload.c b/src/cid/cidload.c
index 6f35860..6765274 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 376c90c..d943567 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 f0dfde8..fadbf21 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 );