summaryrefslogtreecommitdiff
path: root/src/truetype/ttgxvar.c
diff options
context:
space:
mode:
authorWerner Lemberg <wl@gnu.org>2023-04-26 12:03:04 +0200
committerWerner Lemberg <wl@gnu.org>2023-05-06 18:53:50 +0200
commit6713b1e41a147897887c3a9b0136104a3f9ed2cf (patch)
treedbfe192183f3f07907d6ac4d06589a6f15aa8766 /src/truetype/ttgxvar.c
parentfdcb14a2eebb48bb137f6e9afc27faac931967b6 (diff)
downloadfreetype2-6713b1e41a147897887c3a9b0136104a3f9ed2cf.tar.gz
[truetype] Fix deactivation of variation font handling.
According to the documentation, the functions `FT_Set_Named_Instance`, `FT_Set_MM_Design_Coordinates`, `FT_Set_Var_Design_Coordinates`, and `FT_Set_Var_Blend_Coordinates` can unset the `FT_FACE_FLAG_VARIATION` flag. (The same is true for `FT_Set_MM_WeightVector` but this information was accidentally omitted from the documentation.) However, if a call of these functions didn't change the axis values this could fail because internal shortcuts exited too early. This commit reorganizes the code to handle `FT_FACE_FLAG_VARIATION` in the top-level API functions, also taking care of the issue at hand. * src/base/ftmm.c (FT_Set_MM_Design_Coordinates, FT_Set_MM_WeightVector, FT_Set_Var_Design_Coordinates, FT_Set_MM_Blend_Coordinates, FT_Set_Var_Blend_Coordinates): Handle `FT_FACE_FLAG_VARIATION`. * src/truetype/ttgxvar.c (TT_Set_MM_Blend, TT_Set_Var_Design, TT_Set_Named_Instance) Don't handle `FT_FACE_FLAG_VARIATION`. * src/type1/t1load.c (T1_Set_MM_Blend, T1_Set_MM_WeightVector, T1_Set_MM_Design): Ditto. * src/cff/cffobjs.c (cff_face_init): Use `FT_Set_Named_Instance` instead of low-level functions. * src/truetype/ttobjs.c (tt_face_init): Ditto.
Diffstat (limited to 'src/truetype/ttgxvar.c')
-rw-r--r--src/truetype/ttgxvar.c15
1 files changed, 2 insertions, 13 deletions
diff --git a/src/truetype/ttgxvar.c b/src/truetype/ttgxvar.c
index d28cc245e..44483625a 100644
--- a/src/truetype/ttgxvar.c
+++ b/src/truetype/ttgxvar.c
@@ -2985,11 +2985,6 @@
if ( error )
return error;
- if ( num_coords )
- face->root.face_flags |= FT_FACE_FLAG_VARIATION;
- else
- face->root.face_flags &= ~FT_FACE_FLAG_VARIATION;
-
return FT_Err_Ok;
}
@@ -3208,11 +3203,6 @@
if ( error )
goto Exit;
- if ( num_coords )
- face->root.face_flags |= FT_FACE_FLAG_VARIATION;
- else
- face->root.face_flags &= ~FT_FACE_FLAG_VARIATION;
-
Exit:
FT_FREE( normalized );
return error;
@@ -3382,9 +3372,8 @@
else
error = TT_Set_Var_Design( face, 0, NULL );
- face->root.face_index = ( instance_index << 16 ) |
- ( face->root.face_index & 0xFFFFL );
- face->root.face_flags &= ~FT_FACE_FLAG_VARIATION;
+ face->root.face_index = ( instance_index << 16 ) |
+ ( face->root.face_index & 0xFFFFL );
Exit:
return error;