freetype-commit
[Top][All Lists]
Advanced

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

[freetype2] master a9331c0: [truetype] Fix handling of design coordinate


From: Werner LEMBERG
Subject: [freetype2] master a9331c0: [truetype] Fix handling of design coordinates (#51127).
Date: Sat, 27 May 2017 09:51:08 -0400 (EDT)

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

    [truetype] Fix handling of design coordinates (#51127).
    
    * src/truetype/ttgxvar.c (tt_set_mm_blend): Compute all design
    coordinates if we have to create the `blends->coord' array.
    (TT_Get_MM_Blend, TT_Get_Var_Design): Select default instance
    coordinates if no instance is selected yet.
---
 ChangeLog              |  9 +++++++++
 src/truetype/ttgxvar.c | 28 +++++++++++++++++++++++++---
 2 files changed, 34 insertions(+), 3 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 4d13109..f4f64d1 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2017-05-27  Werner Lemberg  <address@hidden>
+
+       [truetype] Fix handling of design coordinates (#51127).
+
+       * src/truetype/ttgxvar.c (tt_set_mm_blend): Compute all design
+       coordinates if we have to create the `blends->coord' array.
+       (TT_Get_MM_Blend, TT_Get_Var_Design): Select default instance
+       coordinates if no instance is selected yet.
+
 2017-05-24  Werner Lemberg  <address@hidden>
 
        [bdf, pcf] Support ISO646.1991-IRV character encoding (aka ASCII).
diff --git a/src/truetype/ttgxvar.c b/src/truetype/ttgxvar.c
index 0cedb6b..16a2e56 100644
--- a/src/truetype/ttgxvar.c
+++ b/src/truetype/ttgxvar.c
@@ -2281,7 +2281,10 @@
     GX_Blend    blend;
     FT_MM_Var*  mmvar;
     FT_UInt     i, j;
-    FT_Bool     is_default_instance = 1;
+
+    FT_Bool     is_default_instance = TRUE;
+    FT_Bool     all_design_coords   = FALSE;
+
     FT_Memory   memory = face->root.memory;
 
     enum
@@ -2327,7 +2330,7 @@
       }
 
       if ( coords[i] != 0 )
-        is_default_instance = 0;
+        is_default_instance = FALSE;
     }
 
     FT_TRACE5(( "\n" ));
@@ -2340,6 +2343,9 @@
     {
       if ( FT_NEW_ARRAY( blend->coords, mmvar->num_axis ) )
         goto Exit;
+
+      /* the first time we have to compute all design coordinates */
+      all_design_coords = TRUE;
     }
 
     if ( !blend->normalizedcoords )
@@ -2388,7 +2394,7 @@
 
     if ( set_design_coords )
       ft_var_to_design( face,
-                        num_coords,
+                        all_design_coords ? blend->num_axis : num_coords,
                         blend->normalizedcoords,
                         blend->coords );
 
@@ -2529,6 +2535,14 @@
 
     blend = face->blend;
 
+    if ( !blend->coords )
+    {
+      /* select default instance coordinates */
+      /* if no instance is selected yet      */
+      if ( FT_SET_ERROR( tt_set_mm_blend( face, 0, NULL, 1 ) ) )
+        return error;
+    }
+
     nc = num_coords;
     if ( num_coords > blend->num_axis )
     {
@@ -2686,6 +2700,14 @@
 
     blend = face->blend;
 
+    if ( !blend->coords )
+    {
+      /* select default instance coordinates */
+      /* if no instance is selected yet      */
+      if ( FT_SET_ERROR( tt_set_mm_blend( face, 0, NULL, 1 ) ) )
+        return error;
+    }
+
     nc = num_coords;
     if ( num_coords > blend->num_axis )
     {



reply via email to

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