Commit a37da21a494f975e4307e62b105aae026092390d

Alexei Podtelezhnikov 2015-08-10T23:05:02

[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.

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 );