shithub: freetype+ttf2subf

Download patch

ref: a37da21a494f975e4307e62b105aae026092390d
parent: bd75a517dcf87b620e8dd7fcd07992b881f0e234
author: Alexei Podtelezhnikov <[email protected]>
date: Mon Aug 10 19:05:02 EDT 2015

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

git/fs: mount .git/fs: mount/attach disallowed
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2015-08-10  Alexei Podtelezhnikov  <[email protected]>
+
+	[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  <[email protected]>
 
 	[type42] Fix glyph access.
--- 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 );
--- 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 );
--- 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 );