Browse Source
[truetype, snft] Add service methods for `DeltaSetIdxMap` and `VarStore`.
[truetype, snft] Add service methods for `DeltaSetIdxMap` and `VarStore`.
This will be needed for 'COLR' v1 variation support. * src/truetype/ttgxvar.h (GX_ItemVarData, GX_AxisCoords, GX_VarRegion, GX_VarItemStore, GX_DeltaSetIdxMap): Move structures to... * include/freetype/internal/ftmmtypes.h: ... this new file. * include/freetype/internal/service/svmm.h (MultiMasters): Include `ftmmtypes.h`. (FT_Var_Load_Delta_Set_Idx_Map_Func, FT_Var_Load_Item_Var_Store_Func, FT_Var_Get_Item_Delta_Func, FT_Var_Done_Item_Var_Store_Func, FT_Var_Done_Delta_Set_Idx_Map_Func): New function typedefs. (MultiMasters): Add them. (FT_DEFINE_SERVICE_MULTIMASTERSREC): Updated. * src/cff/cffdrivr.c (cff_load_item_variation_store, cff_load_delta_set_index_mapping, cff_get_item_delta, cff_done_item_variation_store, cff_done_delta_set_index_map): New wrapper methods calling into mm service. (cff_service_multi_masters): Updated. * src/truetype/ttgxvar.c (ft_var_load_item_variation_store, ft_var_load_delta_set_index_mapping, ft_var_get_item_delta, ft_var_done_item_variation_store, ft_var_done_delta_set_index_map): Renamed to ... (tt_var_load_item_variation_store, tt_var_load_delta_set_index_mapping, tt_var_get_item_delta, tt_var_done_item_variation_store, tt_var_done_delta_set_index_map): ... this for consistency. Mark them as non-static. * src/truetype/ttgxvar.h: Add corresponding prototypes. * src/truetype/ttdriver.c (tt_service_gx_multi_masters): Updated. * src/type1/t1driver.c (t1_service_multi_masters): Updated.clean-gxvar
committed by
Werner Lemberg
7 changed files with 365 additions and 156 deletions
-
83include/freetype/internal/ftmmtypes.h
-
122include/freetype/internal/services/svmm.h
-
109src/cff/cffdrivr.c
-
41src/truetype/ttdriver.c
-
50src/truetype/ttgxvar.c
-
79src/truetype/ttgxvar.h
-
37src/type1/t1driver.c
@ -0,0 +1,83 @@ |
|||
/**************************************************************************** |
|||
* |
|||
* ftmmtypes.h |
|||
* |
|||
* OpenType Variations type definitions for internal use |
|||
* with the multi-masters service (specification). |
|||
* |
|||
* Copyright (C) 2022 by |
|||
* David Turner, Robert Wilhelm, Werner Lemberg, George Williams, and |
|||
* Dominik Röttsches. |
|||
* |
|||
* This file is part of the FreeType project, and may only be used, |
|||
* modified, and distributed under the terms of the FreeType project |
|||
* license, LICENSE.TXT. By continuing to use, modify, or distribute |
|||
* this file you indicate that you have read the license and |
|||
* understand and accept it fully. |
|||
* |
|||
*/ |
|||
|
|||
|
|||
#ifndef FTMMTYPES_H_ |
|||
#define FTMMTYPES_H_ |
|||
|
|||
FT_BEGIN_HEADER |
|||
|
|||
|
|||
typedef struct GX_ItemVarDataRec_ |
|||
{ |
|||
FT_UInt itemCount; /* number of delta sets per item */ |
|||
FT_UInt regionIdxCount; /* number of region indices in this data */ |
|||
FT_UInt* regionIndices; /* array of `regionCount' indices; */ |
|||
/* these index `varRegionList' */ |
|||
FT_Short* deltaSet; /* array of `itemCount' deltas */ |
|||
/* use `innerIndex' for this array */ |
|||
|
|||
} GX_ItemVarDataRec, *GX_ItemVarData; |
|||
|
|||
|
|||
/* contribution of one axis to a region */ |
|||
typedef struct GX_AxisCoordsRec_ |
|||
{ |
|||
FT_Fixed startCoord; |
|||
FT_Fixed peakCoord; /* zero means no effect (factor = 1) */ |
|||
FT_Fixed endCoord; |
|||
|
|||
} GX_AxisCoordsRec, *GX_AxisCoords; |
|||
|
|||
|
|||
typedef struct GX_VarRegionRec_ |
|||
{ |
|||
GX_AxisCoords axisList; /* array of axisCount records */ |
|||
|
|||
} GX_VarRegionRec, *GX_VarRegion; |
|||
|
|||
|
|||
/* item variation store */ |
|||
typedef struct GX_ItemVarStoreRec_ |
|||
{ |
|||
FT_UInt dataCount; |
|||
GX_ItemVarData varData; /* array of dataCount records; */ |
|||
/* use `outerIndex' for this array */ |
|||
FT_UShort axisCount; |
|||
FT_UInt regionCount; /* total number of regions defined */ |
|||
GX_VarRegion varRegionList; |
|||
|
|||
} GX_ItemVarStoreRec, *GX_ItemVarStore; |
|||
|
|||
|
|||
typedef struct GX_DeltaSetIdxMapRec_ |
|||
{ |
|||
FT_ULong mapCount; |
|||
FT_UInt* outerIndex; /* indices to item var data */ |
|||
FT_UInt* innerIndex; /* indices to delta set */ |
|||
|
|||
} GX_DeltaSetIdxMapRec, *GX_DeltaSetIdxMap; |
|||
|
|||
|
|||
FT_END_HEADER |
|||
|
|||
#endif /* FTMMTYPES_H_ */ |
|||
|
|||
|
|||
/* END */ |
Write
Preview
Loading…
Cancel
Save
Reference in new issue