[truetype] Variation font API stability issues. Make some functions work before a call to `TT_Set_MM_Blend'. * src/truetype/ttgxvar.c (tt_hadvance_adjust): Exit immediately if we don't blend. (TT_Get_MM_Blend, TT_Get_Var_Design): Return default values if we don't blend.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73
diff --git a/ChangeLog b/ChangeLog
index d26fa3f..aa0fd99 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,16 @@
2016-12-29 Werner Lemberg <wl@gnu.org>
+ [truetype] Variation font API stability issues.
+
+ Make some functions work before a call to `TT_Set_MM_Blend'.
+
+ * src/truetype/ttgxvar.c (tt_hadvance_adjust): Exit immediately if
+ we don't blend.
+ (TT_Get_MM_Blend, TT_Get_Var_Design): Return default values if we
+ don't blend.
+
+2016-12-29 Werner Lemberg <wl@gnu.org>
+
* src/truetype/ttgxvar.c (TT_Get_MM_Var): Check axis data.
Reported as
diff --git a/src/truetype/ttgxvar.c b/src/truetype/ttgxvar.c
index cdf4183..cf4f7b1 100644
--- a/src/truetype/ttgxvar.c
+++ b/src/truetype/ttgxvar.c
@@ -786,7 +786,7 @@
FT_Fixed delta;
- if ( !face->blend )
+ if ( !face->doblend || !face->blend )
goto Exit;
if ( !face->blend->hvar_loaded )
@@ -1745,8 +1745,17 @@
nc = blend->num_axis;
}
- for ( i = 0; i < nc; i++ )
- coords[i] = blend->normalizedcoords[i];
+ if ( face->doblend )
+ {
+ for ( i = 0; i < nc; i++ )
+ coords[i] = blend->normalizedcoords[i];
+ }
+ else
+ {
+ for ( i = 0; i < nc; i++ )
+ coords[i] = 0;
+ }
+
for ( ; i < num_coords; i++ )
coords[i] = 0;
@@ -1947,8 +1956,16 @@
nc = blend->num_axis;
}
- for ( i = 0; i < nc; ++i )
- coords[i] = blend->normalizedcoords[i];
+ if ( face->doblend )
+ {
+ for ( i = 0; i < nc; i++ )
+ coords[i] = blend->normalizedcoords[i];
+ }
+ else
+ {
+ for ( i = 0; i < nc; i++ )
+ coords[i] = 0;
+ }
for ( ; i < num_coords; i++ )
coords[i] = 0;