summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWerner Lemberg <wl@gnu.org>2017-05-27 15:50:25 +0200
committerWerner Lemberg <wl@gnu.org>2017-05-27 15:50:25 +0200
commita9331c0f4d17a86251f7b16343af03e8055191af (patch)
tree7e54f3647184d3d3a2bc3a3ec1e31b259dc456c0
parent082f2faf5007812bac6a1f783c7dcc6f49d761fe (diff)
downloadfreetype2-a9331c0f4d17a86251f7b16343af03e8055191af.tar.gz
[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.
-rw-r--r--ChangeLog9
-rw-r--r--src/truetype/ttgxvar.c28
2 files changed, 34 insertions, 3 deletions
diff --git a/ChangeLog b/ChangeLog
index 4d13109f9..f4f64d1c3 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2017-05-27 Werner Lemberg <wl@gnu.org>
+
+ [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 <wl@gnu.org>
[bdf, pcf] Support ISO646.1991-IRV character encoding (aka ASCII).
diff --git a/src/truetype/ttgxvar.c b/src/truetype/ttgxvar.c
index 0cedb6bdf..16a2e56ba 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 )
{