freetype-commit
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[freetype2-demos] master 9ddf47f: [ftmulti] Minor.


From: Werner LEMBERG
Subject: [freetype2-demos] master 9ddf47f: [ftmulti] Minor.
Date: Fri, 30 Dec 2016 20:03:47 +0000 (UTC)

branch: master
commit 9ddf47f9085674cecb6c5a5167c3ccfee001c541
Author: Werner Lemberg <address@hidden>
Commit: Werner Lemberg <address@hidden>

    [ftmulti] Minor.
    
    * src/ftmulti.c (Process_Event, main): If MM, round design
    coordinates.
---
 ChangeLog     |    7 +++++++
 src/ftmulti.c |   40 +++++++++++++++++++++++-----------------
 2 files changed, 30 insertions(+), 17 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 5c2076f..265a832 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2016-12-27  Werner Lemberg  <address@hidden>
+
+       [ftmulti] Minor.
+
+       * src/ftmulti.c (Process_Event, main): If MM, round design
+       coordinates.
+
 2016-12-25  Werner Lemberg  <address@hidden>
 
        Fixes for clang++.
diff --git a/src/ftmulti.c b/src/ftmulti.c
index 6807456..7eafde1 100644
--- a/src/ftmulti.c
+++ b/src/ftmulti.c
@@ -693,6 +693,10 @@
 
       design_pos[axis] = pos;
 
+      /* for MM fonts, round the design coordinates to integers */
+      if ( !FT_IS_SFNT( face ) )
+        design_pos[axis] &= (FT_Fixed)0xFFFF0000L;
+
       FT_Set_Var_Design_Coordinates( face, used_num_axis, design_pos );
     }
     return 1;
@@ -911,25 +915,27 @@
 
     /* if the user specified a position, use it, otherwise */
     /* set the current position to the median of each axis */
+    if ( multimaster->num_axis > MAX_MM_AXES )
     {
-      if ( multimaster->num_axis > MAX_MM_AXES )
-      {
-        fprintf( stderr, "only handling first %d GX axes (of %d)\n",
-                         MAX_MM_AXES, multimaster->num_axis );
-        used_num_axis = MAX_MM_AXES;
-      }
-      else
-        used_num_axis = multimaster->num_axis;
+      fprintf( stderr, "only handling first %d GX axes (of %d)\n",
+                       MAX_MM_AXES, multimaster->num_axis );
+      used_num_axis = MAX_MM_AXES;
+    }
+    else
+      used_num_axis = multimaster->num_axis;
 
-      for ( n = 0; n < used_num_axis; n++ )
-      {
-        design_pos[n] = n < requested_cnt ? requested_pos[n]
-                                          : multimaster->axis[n].def;
-        if ( design_pos[n] < multimaster->axis[n].minimum )
-          design_pos[n] = multimaster->axis[n].minimum;
-        else if ( design_pos[n] > multimaster->axis[n].maximum )
-          design_pos[n] = multimaster->axis[n].maximum;
-      }
+    for ( n = 0; n < used_num_axis; n++ )
+    {
+      design_pos[n] = n < requested_cnt ? requested_pos[n]
+                                        : multimaster->axis[n].def;
+      if ( design_pos[n] < multimaster->axis[n].minimum )
+        design_pos[n] = multimaster->axis[n].minimum;
+      else if ( design_pos[n] > multimaster->axis[n].maximum )
+        design_pos[n] = multimaster->axis[n].maximum;
+
+      /* for MM fonts, round the design coordinates to integers */
+      if ( !FT_IS_SFNT( face ) )
+        design_pos[n] &= (FT_Fixed)0xFFFF0000L;
     }
 
     error = FT_Set_Var_Design_Coordinates( face, used_num_axis, design_pos );



reply via email to

[Prev in Thread] Current Thread [Next in Thread]