shithub: freetype+ttf2subf

Download patch

ref: 79180ad049b3e1ecf9f0348fb284d3b49554b568
parent: 72e976d41565bdae7025cb4fda4f25acec92b022
author: Alexei Podtelezhnikov <[email protected]>
date: Tue Nov 27 16:36:20 EST 2012

[cid, type1, type42] Clean up units_per_EM calculations.

* src/cid/cidload.c (cid_parse_font_matrix): Updated.
* src/type1/t1load.c (t1_parse_font_matrix): Updated.
* src/type42/t42parse.c (t42_parse_font_matrix): Updated.

git/fs: mount .git/fs: mount/attach disallowed
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,14 @@
 2012-11-27  Alexei Podtelezhnikov  <[email protected]>
 
+	[cid, type1, type42] Clean up units_per_EM calculations.
+
+	* src/cid/cidload.c (cid_parse_font_matrix): Updated.
+	* src/type1/t1load.c (t1_parse_font_matrix): Updated.
+	* src/type42/t42parse.c (t42_parse_font_matrix): Updated.
+
+
+2012-11-27  Alexei Podtelezhnikov  <[email protected]>
+
 	[ftstroke] Minor improvement.
 
 	* src/base/ftstroke.c: Replace nested FT_DivFix and FT_MulFix with
--- a/src/cid/cidload.c
+++ b/src/cid/cidload.c
@@ -168,11 +168,11 @@
 
       temp_scale = FT_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_UShort)( FT_DivFix( 0x10000L,
-                                        FT_DivFix( temp_scale, 1000 ) ) );
+      /* 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] */
       if ( temp_scale != 0x10000L )
--- a/src/type1/t1load.c
+++ b/src/type1/t1load.c
@@ -1131,8 +1131,7 @@
     /* 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 * 0x10000L,
-                                                 temp_scale ) >> 16 );
+    root->units_per_EM = (FT_UShort)FT_DivFix( 1000, temp_scale );
 
     /* we need to scale the values by 1.0/temp_scale */
     if ( temp_scale != 0x10000L )
--- a/src/type42/t42parse.c
+++ b/src/type42/t42parse.c
@@ -265,8 +265,7 @@
     /* 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 * 0x10000L,
-                                                 temp_scale ) >> 16 );
+    root->units_per_EM = (FT_UShort)FT_DivFix( 1000, temp_scale );
 
     /* we need to scale the values by 1.0/temp_scale */
     if ( temp_scale != 0x10000L )