Commit e6a429e2c7c3126d3ff46b6d69bd21d645ecccd5

Werner Lemberg 2016-12-21T20:27:48

[cff, truetype] Another try for #49829. * src/cff/cffdrivr.c: Don't include `FT_SERVICE_METRICS_VARIATIONS_H'. (cff_get_advances): Use `ttface->variation_support'. * src/truetype/ttdriver.c (tt_get_advances): Use `ttface->variation_support'. * src/truetype/ttgload.c (TT_Process_Simple_Glyph, load_truetype_glyph): Use `ttface->variation_support'.

diff --git a/ChangeLog b/ChangeLog
index 93397fd..8b71086 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,19 @@
 2016-12-21  Werner Lemberg  <wl@gnu.org>
 
+	[cff, truetype] Another try for #49829.
+
+	* src/cff/cffdrivr.c: Don't include
+	`FT_SERVICE_METRICS_VARIATIONS_H'.
+	(cff_get_advances): Use `ttface->variation_support'.
+
+	* src/truetype/ttdriver.c (tt_get_advances): Use
+	`ttface->variation_support'.
+
+	* src/truetype/ttgload.c (TT_Process_Simple_Glyph,
+	load_truetype_glyph): Use `ttface->variation_support'.
+
+2016-12-21  Werner Lemberg  <wl@gnu.org>
+
 	[truetype, sfnt] Introduce font variation flags to `TT_Face'.
 
 	* include/freetype/internal/tttypes.h (TT_FACE_FLAG_VAR_XXX):
diff --git a/src/cff/cffdrivr.c b/src/cff/cffdrivr.c
index 3f426c6..05d5fb8 100644
--- a/src/cff/cffdrivr.c
+++ b/src/cff/cffdrivr.c
@@ -34,7 +34,6 @@
 
 #ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT
 #include FT_SERVICE_MULTIPLE_MASTERS_H
-#include FT_SERVICE_METRICS_VARIATIONS_H
 #endif
 
 #include "cfferrs.h"
@@ -209,18 +208,13 @@
       TT_Face   ttface = (TT_Face)face;
       FT_Short  dummy;
 
-#ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT
-      FT_Service_MetricsVariations  var =
-        (FT_Service_MetricsVariations)ttface->var;
-#endif
-
 
       if ( flags & FT_LOAD_VERTICAL_LAYOUT )
       {
 #ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT
         /* no fast retrieval for blended MM fonts without VVAR table */
-        if ( !ttface->is_default_instance     &&
-             !( var && var->vadvance_adjust ) )
+        if ( !ttface->is_default_instance                               &&
+             !( ttface->variation_support & TT_FACE_FLAG_VAR_VADVANCE ) )
           return FT_THROW( Unimplemented_Feature );
 #endif
 
@@ -251,8 +245,8 @@
       {
 #ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT
         /* no fast retrieval for blended MM fonts without HVAR table */
-        if ( !ttface->is_default_instance     &&
-             !( var && var->hadvance_adjust ) )
+        if ( !ttface->is_default_instance                               &&
+             !( ttface->variation_support & TT_FACE_FLAG_VAR_HADVANCE ) )
           return FT_THROW( Unimplemented_Feature );
 #endif
 
diff --git a/src/truetype/ttdriver.c b/src/truetype/ttdriver.c
index 91ddff5..e7f3c0e 100644
--- a/src/truetype/ttdriver.c
+++ b/src/truetype/ttdriver.c
@@ -226,11 +226,6 @@
     FT_UInt  nn;
     TT_Face  face = (TT_Face)ttface;
 
-#ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT
-    FT_Service_MetricsVariations  var =
-      (FT_Service_MetricsVariations)face->var;
-#endif
-
 
     /* XXX: TODO: check for sbits */
 
@@ -238,8 +233,8 @@
     {
 #ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT
       /* no fast retrieval for blended MM fonts without VVAR table */
-      if ( !face->is_default_instance       &&
-           !( var && var->vadvance_adjust ) )
+      if ( !face->is_default_instance                               &&
+           !( face->variation_support & TT_FACE_FLAG_VAR_VADVANCE ) )
         return FT_THROW( Unimplemented_Feature );
 #endif
 
@@ -258,8 +253,8 @@
     {
 #ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT
       /* no fast retrieval for blended MM fonts without HVAR table */
-      if ( !face->is_default_instance       &&
-           !( var && var->hadvance_adjust ) )
+      if ( !face->is_default_instance                               &&
+           !( face->variation_support & TT_FACE_FLAG_VAR_HADVANCE ) )
         return FT_THROW( Unimplemented_Feature );
 #endif
 
diff --git a/src/truetype/ttgload.c b/src/truetype/ttgload.c
index 06e8621..ce53983 100644
--- a/src/truetype/ttgload.c
+++ b/src/truetype/ttgload.c
@@ -888,10 +888,6 @@
 
     if ( loader->face->doblend && !loader->face->is_default_instance )
     {
-      FT_Service_MetricsVariations  var =
-        (FT_Service_MetricsVariations)loader->face->var;
-
-
       /* Deltas apply to the unscaled data. */
       error = TT_Vary_Apply_Glyph_Deltas( loader->face,
                                           loader->glyph_index,
@@ -900,10 +896,10 @@
 
       /* recalculate linear horizontal and vertical advances */
       /* if we don't have HVAR and VVAR, respectively        */
-      if ( !( var && var->hadvance_adjust ) )
+      if ( !( loader->face->variation_support & TT_FACE_FLAG_VAR_HADVANCE ) )
         loader->linear = outline->points[n_points - 3].x -
                          outline->points[n_points - 4].x;
-      if ( !( var && var->vadvance_adjust ) )
+      if ( !( loader->face->variation_support & TT_FACE_FLAG_VAR_VADVANCE ) )
         loader->vadvance = outline->points[n_points - 1].x -
                            outline->points[n_points - 2].x;
 
@@ -1580,10 +1576,6 @@
 
       if ( loader->face->doblend && !loader->face->is_default_instance )
       {
-        FT_Service_MetricsVariations  var =
-          (FT_Service_MetricsVariations)loader->face->var;
-
-
         /* a small outline structure with four elements for */
         /* communication with `TT_Vary_Apply_Glyph_Deltas'  */
         FT_Vector   points[4];
@@ -1629,9 +1621,9 @@
 
         /* recalculate linear horizontal and vertical advances */
         /* if we don't have HVAR and VVAR, respectively        */
-        if ( !( var && var->hadvance_adjust ) )
+        if ( !( loader->face->variation_support & TT_FACE_FLAG_VAR_HADVANCE ) )
           loader->linear = loader->pp2.x - loader->pp1.x;
-        if ( !( var && var->vadvance_adjust ) )
+        if ( !( loader->face->variation_support & TT_FACE_FLAG_VAR_VADVANCE ) )
           loader->vadvance = loader->pp4.x - loader->pp3.x;
       }
 
@@ -1755,10 +1747,6 @@
 
       if ( face->doblend && !face->is_default_instance )
       {
-        FT_Service_MetricsVariations  var =
-          (FT_Service_MetricsVariations)face->var;
-
-
         short        i, limit;
         FT_SubGlyph  subglyph;
 
@@ -1856,9 +1844,9 @@
 
         /* recalculate linear horizontal and vertical advances */
         /* if we don't have HVAR and VVAR, respectively        */
-        if ( !( var && var->hadvance_adjust ) )
+        if ( !( face->variation_support & TT_FACE_FLAG_VAR_HADVANCE ) )
           loader->linear = loader->pp2.x - loader->pp1.x;
-        if ( !( var && var->vadvance_adjust ) )
+        if ( !( face->variation_support & TT_FACE_FLAG_VAR_VADVANCE ) )
           loader->vadvance = loader->pp4.x - loader->pp3.x;
 
       Exit1: