Commit 79180ad049b3e1ecf9f0348fb284d3b49554b568

Alexei Podtelezhnikov 2012-11-27T21:36:20

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

diff --git a/ChangeLog b/ChangeLog
index 3116bc1..d1be2ad 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,14 @@
 2012-11-27  Alexei Podtelezhnikov  <apodtele@gmail.com>
 
+	[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  <apodtele@gmail.com>
+
 	[ftstroke] Minor improvement.
 
 	* src/base/ftstroke.c: Replace nested FT_DivFix and FT_MulFix with
diff --git a/src/cid/cidload.c b/src/cid/cidload.c
index 3b840b7..cbb5985 100644
--- 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 )
diff --git a/src/type1/t1load.c b/src/type1/t1load.c
index 4b4217c..76f0250 100644
--- 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 )
diff --git a/src/type42/t42parse.c b/src/type42/t42parse.c
index 468b463..2b28240 100644
--- 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 )