freetype-commit
[Top][All Lists]
Advanced

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

[freetype2-demos] master 5d5f9de 1/3: [ftgrid] Properly handle named ins


From: Werner LEMBERG
Subject: [freetype2-demos] master 5d5f9de 1/3: [ftgrid] Properly handle named instances.
Date: Thu, 14 Jul 2016 13:03:05 +0000 (UTC)

branch: master
commit 5d5f9de60fe0334e96b072d5a2c1869d717c25cf
Author: Werner Lemberg <address@hidden>
Commit: Werner Lemberg <address@hidden>

    [ftgrid] Properly handle named instances.
    
    * src/ftgrid.c (event_font_change): Properly initialize the design
    positions with the named instance's value, if appropriate.
---
 ChangeLog    |    7 +++++++
 src/ftgrid.c |   10 +++++++++-
 2 files changed, 16 insertions(+), 1 deletion(-)

diff --git a/ChangeLog b/ChangeLog
index 83e7809..9dec897 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2016-07-14  Werner Lemberg  <address@hidden>
+
+       [ftgrid] Properly handle named instances.
+
+       * src/ftgrid.c (event_font_change): Properly initialize the design
+       positions with the named instance's value, if appropriate.
+
 2016-07-12  Werner Lemberg  <address@hidden>
 
        * Version 2.6.5 released.
diff --git a/src/ftgrid.c b/src/ftgrid.c
index 298c9fa..0fe48b8 100644
--- a/src/ftgrid.c
+++ b/src/ftgrid.c
@@ -1322,6 +1322,7 @@
     FT_Error         err;
     FT_Size          size;
     FT_UInt          n, num_names;
+    FT_Int           instance_index;
     FT_Multi_Master  dummy;
     int              num_indices, is_GX;
 
@@ -1364,6 +1365,9 @@
 
     num_names = FT_Get_Sfnt_Name_Count( size->face );
 
+    /* in `face_index', the instance index starts with value 1 */
+    instance_index = ( size->face->face_index >> 16 ) - 1;
+
     for ( n = 0; n < MAX_MM_AXES; n++ )
     {
       free( status.axis_name[n] );
@@ -1372,7 +1376,11 @@
 
     for ( n = 0; n < status.used_num_axis; n++ )
     {
-      status.design_pos[n] = status.mm->axis[n].def;
+      if ( FT_IS_NAMED_INSTANCE( size->face ) )
+        status.design_pos[n] = status.mm->namedstyle[instance_index].
+                                          coords[n];
+      else
+        status.design_pos[n] = status.mm->axis[n].def;
 
       if ( is_GX )
       {



reply via email to

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