summaryrefslogtreecommitdiff
path: root/src/truetype/ttgxvar.c
diff options
context:
space:
mode:
authorWerner Lemberg <wl@gnu.org>2023-04-27 23:06:51 +0200
committerWerner Lemberg <wl@gnu.org>2023-04-28 13:45:49 +0200
commit36e9878cc271a7f43d562152b9d602ed2cfdce18 (patch)
tree43d7992d59522149c2f3c62aa1f32b4230276390 /src/truetype/ttgxvar.c
parentd7551af0986d2098f23899301f152039bd428ad6 (diff)
downloadfreetype2-dev/wl/VF-fixes.tar.gz
[truetype] Fix style name handling for variation fonts.dev/wl/VF-infodev/wl/VF-fixes
* include/freetype/internal/tttypes.h (TT_FaceRec): New field `non_var_style_name`. * src/sfnt/sfobjs.c (sfnt_load_face): Initialize `non_var_style_name`. (sfnt_done_face): Free `non_var_style_name`. * src/truetype/ttgxvar.c (TT_Set_Named_Instance): Restore non-VF style name if switching back to non-VF mode.
Diffstat (limited to 'src/truetype/ttgxvar.c')
-rw-r--r--src/truetype/ttgxvar.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/src/truetype/ttgxvar.c b/src/truetype/ttgxvar.c
index aec43c851..249ef316a 100644
--- a/src/truetype/ttgxvar.c
+++ b/src/truetype/ttgxvar.c
@@ -3306,6 +3306,8 @@
GX_Blend blend;
FT_MM_Var* mmvar;
+ FT_Memory memory = face->root.memory;
+
FT_UInt num_instances;
@@ -3329,8 +3331,7 @@
if ( instance_index > 0 )
{
- FT_Memory memory = face->root.memory;
- SFNT_Service sfnt = (SFNT_Service)face->sfnt;
+ SFNT_Service sfnt = (SFNT_Service)face->sfnt;
FT_Var_Named_Style* named_style;
FT_String* style_name;
@@ -3354,7 +3355,13 @@
named_style->coords );
}
else
+ {
+ /* restore non-VF style name */
+ FT_FREE( face->root.style_name );
+ if ( FT_STRDUP( face->root.style_name, face->non_var_style_name ) )
+ goto Exit;
error = TT_Set_Var_Design( face, 0, NULL );
+ }
Exit:
return error;