diff options
author | Werner Lemberg <wl@gnu.org> | 2023-04-27 11:40:46 +0200 |
---|---|---|
committer | Werner Lemberg <wl@gnu.org> | 2023-05-06 16:47:04 +0200 |
commit | cc79174dce3f95d2a64066a9c425690a4a4aae70 (patch) | |
tree | 54a090035d47509cf3cf5f9fbd56a18adf4223cc /include/freetype | |
parent | 3acf3cb8832a8312415158797c6d0e44d2001355 (diff) | |
download | freetype2-cc79174dce3f95d2a64066a9c425690a4a4aae70.tar.gz |
[truetype] Fix PostScript name handling for variation fonts.
A variation font's PostScript name of a named instance is usually different
from the PostScript name of an unnamed instance. However, if a change
between a named instance and an unnamed instance with exactly the same
design axis values happened, it was possible that the PostScript name wasn't
correctly updated.
This commit reorganizes the code to handle this issue within the top-level
API functions, using a new service to trigger recomputation of the
PostScript name.
* include/freetype/internal/services/svmm.h (FT_Construct_PS_Name_Func): New
typedef.
(FT_Service_MultiMasters): New field `construct_ps_name`.
(FT_DEFINE_SERVICE_MULTIMASTERSREC): Updated.
* src/base/ftmm.c (FT_Set_Var_Design_Coordinates,
FT_Set_MM_Blend_Coordinates, FT_Set_Var_Blend_Coordinates): Call
`mm->construct_ps_name` to handle `postscript_name`.
(FT_Set_Named_Instance): Call `mm->construct_ps_name` to handle
`postscript_name`.
Use shortcut.
* src/cff/cffdrivr.c (cff_construct_ps_name): New function.
(cff_service_multi_masters): Updated.
* src/truetype/ttgxvar.c (tt_set_mm_blend): Don't handle `postscript_name`.
(TT_Set_MM_Blend): Simplify.
(TT_Set_Named_Instance): Return -1 if axis values haven't changed.
Don't set `face_index`.
(tt_construct_ps_name): New function.
* src/truetype/ttgxvar.h: Updated.
* src/truetype/ttdriver.c (tt_service_gx_multi_masters): Updated.
* src/type1/t1driver.c (t1_service_multi_masters): Updated.
* src/type1/t1load.c (T1_Set_MM_Blend): Simplify.
Diffstat (limited to 'include/freetype')
-rw-r--r-- | include/freetype/internal/services/svmm.h | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/include/freetype/internal/services/svmm.h b/include/freetype/internal/services/svmm.h index 59910f2e3..982bb47db 100644 --- a/include/freetype/internal/services/svmm.h +++ b/include/freetype/internal/services/svmm.h @@ -102,6 +102,9 @@ FT_BEGIN_HEADER FT_UInt* len, FT_Fixed* weight_vector ); + typedef void + (*FT_Construct_PS_Name_Func)( FT_Face face ); + typedef FT_Error (*FT_Var_Load_Delta_Set_Idx_Map_Func)( FT_Face face, FT_ULong offset, @@ -144,6 +147,7 @@ FT_BEGIN_HEADER FT_Get_MM_WeightVector_Func get_mm_weightvector; /* for internal use; only needed for code sharing between modules */ + FT_Construct_PS_Name_Func construct_ps_name; FT_Var_Load_Delta_Set_Idx_Map_Func load_delta_set_idx_map; FT_Var_Load_Item_Var_Store_Func load_item_var_store; FT_Var_Get_Item_Delta_Func get_item_delta; @@ -166,6 +170,8 @@ FT_BEGIN_HEADER get_default_named_instance_, \ set_mm_weightvector_, \ get_mm_weightvector_, \ + \ + construct_ps_name_, \ load_delta_set_idx_map_, \ load_item_var_store_, \ get_item_delta_, \ @@ -186,6 +192,8 @@ FT_BEGIN_HEADER get_default_named_instance_, \ set_mm_weightvector_, \ get_mm_weightvector_, \ + \ + construct_ps_name_, \ load_delta_set_idx_map_, \ load_item_var_store_, \ get_item_delta_, \ |