From 2a790a9f4937c3950028bd3de29e63c6b0d419ce Mon Sep 17 00:00:00 2001 From: Ben Wanger Date: Wed, 28 Feb 2024 17:45:19 -0500 Subject: [PATCH] [cff, truetype] Always set up default variable instance. For default variable instances `cff_face_init` did not set the blend. This mostly worked as later use of the unset blend produced the default variation. However, if a user called `TT_Get_MM_Var` the blend would be partially set up, but not fully. In particular the number of axes, the axis definitions, and the instance locations would be set up, but not the current instance location (`coords` and `normalizedcoords`). This could lead to the default instances of CFF2 fonts erroring on any use of `blend`. Ensure the default variable instance is fully set up by always calling `FT_Set_Named_Instance` on a variable face. * src/cff/cffobjs.c (cff_face_init): Call `FT_Set_Named_Instance` on default instances. * src/truetype/ttobjs.c (tt_face_init): Ditto. Fixes #1268. --- src/cff/cffobjs.c | 3 +-- src/truetype/ttobjs.c | 3 +-- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/src/cff/cffobjs.c b/src/cff/cffobjs.c index 7764a7edd..7c6713739 100644 --- a/src/cff/cffobjs.c +++ b/src/cff/cffobjs.c @@ -694,8 +694,7 @@ FT_UInt instance_index = (FT_UInt)face_index >> 16; - if ( FT_HAS_MULTIPLE_MASTERS( cffface ) && - instance_index > 0 ) + if ( FT_HAS_MULTIPLE_MASTERS( cffface ) ) { error = FT_Set_Named_Instance( cffface, instance_index ); if ( error ) diff --git a/src/truetype/ttobjs.c b/src/truetype/ttobjs.c index 71d11c9c1..3cdbfff1b 100644 --- a/src/truetype/ttobjs.c +++ b/src/truetype/ttobjs.c @@ -784,8 +784,7 @@ FT_UInt instance_index = (FT_UInt)face_index >> 16; - if ( FT_HAS_MULTIPLE_MASTERS( ttface ) && - instance_index > 0 ) + if ( FT_HAS_MULTIPLE_MASTERS( ttface ) ) { error = FT_Set_Named_Instance( ttface, instance_index ); if ( error )