[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.
This commit is contained in:
parent
5f19f49c81
commit
a4c4566b6d
|
@ -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 */
|
|
@ -5,7 +5,7 @@
|
|||
* The FreeType Multiple Masters and GX var services (specification).
|
||||
*
|
||||
* Copyright (C) 2003-2022 by
|
||||
* David Turner, Robert Wilhelm, and Werner Lemberg.
|
||||
* David Turner, Robert Wilhelm, Werner Lemberg, 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
|
||||
|
@ -20,6 +20,7 @@
|
|||
#define SVMM_H_
|
||||
|
||||
#include <freetype/internal/ftserv.h>
|
||||
#include <freetype/internal/ftmmtypes.h>
|
||||
|
||||
|
||||
FT_BEGIN_HEADER
|
||||
|
@ -96,53 +97,94 @@ FT_BEGIN_HEADER
|
|||
FT_UInt* len,
|
||||
FT_Fixed* weight_vector );
|
||||
|
||||
typedef FT_Error
|
||||
(*FT_Var_Load_Delta_Set_Idx_Map_Func)( FT_Face face,
|
||||
FT_ULong offset,
|
||||
GX_DeltaSetIdxMap map,
|
||||
GX_ItemVarStore itemStore,
|
||||
FT_ULong table_len );
|
||||
|
||||
typedef FT_Error
|
||||
(*FT_Var_Load_Item_Var_Store_Func)( FT_Face face,
|
||||
FT_ULong offset,
|
||||
GX_ItemVarStore itemStore );
|
||||
|
||||
typedef FT_Int
|
||||
(*FT_Var_Get_Item_Delta_Func)( FT_Face face,
|
||||
GX_ItemVarStore itemStore,
|
||||
FT_UInt outerIndex,
|
||||
FT_UInt innerIndex );
|
||||
|
||||
typedef void
|
||||
(*FT_Var_Done_Item_Var_Store_Func)( FT_Face face,
|
||||
GX_ItemVarStore itemStore );
|
||||
|
||||
typedef void
|
||||
(*FT_Var_Done_Delta_Set_Idx_Map_Func)( FT_Face face,
|
||||
GX_DeltaSetIdxMap deltaSetIdxMap );
|
||||
|
||||
|
||||
FT_DEFINE_SERVICE( MultiMasters )
|
||||
{
|
||||
FT_Get_MM_Func get_mm;
|
||||
FT_Set_MM_Design_Func set_mm_design;
|
||||
FT_Set_MM_Blend_Func set_mm_blend;
|
||||
FT_Get_MM_Blend_Func get_mm_blend;
|
||||
FT_Get_MM_Var_Func get_mm_var;
|
||||
FT_Set_Var_Design_Func set_var_design;
|
||||
FT_Get_Var_Design_Func get_var_design;
|
||||
FT_Set_Instance_Func set_instance;
|
||||
FT_Set_MM_WeightVector_Func set_mm_weightvector;
|
||||
FT_Get_MM_WeightVector_Func get_mm_weightvector;
|
||||
FT_Get_MM_Func get_mm;
|
||||
FT_Set_MM_Design_Func set_mm_design;
|
||||
FT_Set_MM_Blend_Func set_mm_blend;
|
||||
FT_Get_MM_Blend_Func get_mm_blend;
|
||||
FT_Get_MM_Var_Func get_mm_var;
|
||||
FT_Set_Var_Design_Func set_var_design;
|
||||
FT_Get_Var_Design_Func get_var_design;
|
||||
FT_Set_Instance_Func set_instance;
|
||||
FT_Set_MM_WeightVector_Func set_mm_weightvector;
|
||||
FT_Get_MM_WeightVector_Func get_mm_weightvector;
|
||||
|
||||
/* for internal use; only needed for code sharing between modules */
|
||||
FT_Get_Var_Blend_Func get_var_blend;
|
||||
FT_Done_Blend_Func done_blend;
|
||||
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;
|
||||
FT_Var_Done_Item_Var_Store_Func done_item_var_store;
|
||||
FT_Var_Done_Delta_Set_Idx_Map_Func done_delta_set_idx_map;
|
||||
FT_Get_Var_Blend_Func get_var_blend;
|
||||
FT_Done_Blend_Func done_blend;
|
||||
};
|
||||
|
||||
|
||||
#define FT_DEFINE_SERVICE_MULTIMASTERSREC( class_, \
|
||||
get_mm_, \
|
||||
set_mm_design_, \
|
||||
set_mm_blend_, \
|
||||
get_mm_blend_, \
|
||||
get_mm_var_, \
|
||||
set_var_design_, \
|
||||
get_var_design_, \
|
||||
set_instance_, \
|
||||
set_weightvector_, \
|
||||
get_weightvector_, \
|
||||
get_var_blend_, \
|
||||
done_blend_ ) \
|
||||
static const FT_Service_MultiMastersRec class_ = \
|
||||
{ \
|
||||
get_mm_, \
|
||||
set_mm_design_, \
|
||||
set_mm_blend_, \
|
||||
get_mm_blend_, \
|
||||
get_mm_var_, \
|
||||
set_var_design_, \
|
||||
get_var_design_, \
|
||||
set_instance_, \
|
||||
set_weightvector_, \
|
||||
get_weightvector_, \
|
||||
get_var_blend_, \
|
||||
done_blend_ \
|
||||
#define FT_DEFINE_SERVICE_MULTIMASTERSREC( class_, \
|
||||
get_mm_, \
|
||||
set_mm_design_, \
|
||||
set_mm_blend_, \
|
||||
get_mm_blend_, \
|
||||
get_mm_var_, \
|
||||
set_var_design_, \
|
||||
get_var_design_, \
|
||||
set_instance_, \
|
||||
set_weightvector_, \
|
||||
get_weightvector_, \
|
||||
load_delta_set_idx_map_, \
|
||||
load_item_var_store_, \
|
||||
get_item_delta_, \
|
||||
done_item_var_store_, \
|
||||
done_delta_set_idx_map_, \
|
||||
get_var_blend_, \
|
||||
done_blend_ ) \
|
||||
static const FT_Service_MultiMastersRec class_ = \
|
||||
{ \
|
||||
get_mm_, \
|
||||
set_mm_design_, \
|
||||
set_mm_blend_, \
|
||||
get_mm_blend_, \
|
||||
get_mm_var_, \
|
||||
set_var_design_, \
|
||||
get_var_design_, \
|
||||
set_instance_, \
|
||||
set_weightvector_, \
|
||||
get_weightvector_, \
|
||||
load_delta_set_idx_map_, \
|
||||
load_item_var_store_, \
|
||||
get_item_delta_, \
|
||||
done_item_var_store_, \
|
||||
done_delta_set_idx_map_, \
|
||||
get_var_blend_, \
|
||||
done_blend_ \
|
||||
};
|
||||
|
||||
/* */
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
* OpenType font driver implementation (body).
|
||||
*
|
||||
* Copyright (C) 1996-2022 by
|
||||
* David Turner, Robert Wilhelm, and Werner Lemberg.
|
||||
* David Turner, Robert Wilhelm, Werner Lemberg, 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
|
||||
|
@ -936,22 +936,103 @@
|
|||
}
|
||||
|
||||
|
||||
static FT_Error
|
||||
cff_load_item_variation_store( CFF_Face face,
|
||||
FT_ULong offset,
|
||||
GX_ItemVarStore itemStore )
|
||||
{
|
||||
FT_Service_MultiMasters mm = (FT_Service_MultiMasters)face->mm;
|
||||
|
||||
|
||||
return mm->load_item_var_store( FT_FACE(face), offset, itemStore );
|
||||
}
|
||||
|
||||
|
||||
static FT_Error
|
||||
cff_load_delta_set_index_mapping( CFF_Face face,
|
||||
FT_ULong offset,
|
||||
GX_DeltaSetIdxMap map,
|
||||
GX_ItemVarStore itemStore,
|
||||
FT_ULong table_len )
|
||||
{
|
||||
FT_Service_MultiMasters mm = (FT_Service_MultiMasters)face->mm;
|
||||
|
||||
|
||||
return mm->load_delta_set_idx_map( FT_FACE( face ), offset, map,
|
||||
itemStore, table_len );
|
||||
}
|
||||
|
||||
|
||||
static FT_Int
|
||||
cff_get_item_delta( CFF_Face face,
|
||||
GX_ItemVarStore itemStore,
|
||||
FT_UInt outerIndex,
|
||||
FT_UInt innerIndex )
|
||||
{
|
||||
FT_Service_MultiMasters mm = (FT_Service_MultiMasters)face->mm;
|
||||
|
||||
|
||||
return mm->get_item_delta( FT_FACE( face ), itemStore,
|
||||
outerIndex, innerIndex );
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
cff_done_item_variation_store( CFF_Face face,
|
||||
GX_ItemVarStore itemStore )
|
||||
{
|
||||
FT_Service_MultiMasters mm = (FT_Service_MultiMasters)face->mm;
|
||||
|
||||
|
||||
mm->done_item_var_store( FT_FACE( face ), itemStore );
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
cff_done_delta_set_index_map( CFF_Face face,
|
||||
GX_DeltaSetIdxMap deltaSetIdxMap )
|
||||
{
|
||||
FT_Service_MultiMasters mm = (FT_Service_MultiMasters)face->mm;
|
||||
|
||||
|
||||
mm->done_delta_set_idx_map( FT_FACE ( face ), deltaSetIdxMap );
|
||||
}
|
||||
|
||||
|
||||
|
||||
FT_DEFINE_SERVICE_MULTIMASTERSREC(
|
||||
cff_service_multi_masters,
|
||||
|
||||
(FT_Get_MM_Func) NULL, /* get_mm */
|
||||
(FT_Set_MM_Design_Func) NULL, /* set_mm_design */
|
||||
(FT_Set_MM_Blend_Func) cff_set_mm_blend, /* set_mm_blend */
|
||||
(FT_Get_MM_Blend_Func) cff_get_mm_blend, /* get_mm_blend */
|
||||
(FT_Get_MM_Var_Func) cff_get_mm_var, /* get_mm_var */
|
||||
(FT_Set_Var_Design_Func) cff_set_var_design, /* set_var_design */
|
||||
(FT_Get_Var_Design_Func) cff_get_var_design, /* get_var_design */
|
||||
(FT_Set_Instance_Func) cff_set_instance, /* set_instance */
|
||||
(FT_Set_MM_WeightVector_Func)cff_set_mm_weightvector, /* set_mm_weightvector */
|
||||
(FT_Get_MM_WeightVector_Func)cff_get_mm_weightvector, /* get_mm_weightvector */
|
||||
|
||||
(FT_Get_Var_Blend_Func) cff_get_var_blend, /* get_var_blend */
|
||||
(FT_Done_Blend_Func) cff_done_blend /* done_blend */
|
||||
(FT_Get_MM_Func) NULL, /* get_mm */
|
||||
(FT_Set_MM_Design_Func) NULL, /* set_mm_design */
|
||||
(FT_Set_MM_Blend_Func) cff_set_mm_blend, /* set_mm_blend */
|
||||
(FT_Get_MM_Blend_Func) cff_get_mm_blend, /* get_mm_blend */
|
||||
(FT_Get_MM_Var_Func) cff_get_mm_var, /* get_mm_var */
|
||||
(FT_Set_Var_Design_Func)cff_set_var_design, /* set_var_design */
|
||||
(FT_Get_Var_Design_Func)cff_get_var_design, /* get_var_design */
|
||||
(FT_Set_Instance_Func) cff_set_instance, /* set_instance */
|
||||
(FT_Set_MM_WeightVector_Func)
|
||||
cff_set_mm_weightvector,
|
||||
/* set_mm_weightvector */
|
||||
(FT_Get_MM_WeightVector_Func)
|
||||
cff_get_mm_weightvector,
|
||||
/* get_mm_weightvector */
|
||||
(FT_Var_Load_Delta_Set_Idx_Map_Func)
|
||||
cff_load_delta_set_index_mapping,
|
||||
/* load_delta_set_idx_map */
|
||||
(FT_Var_Load_Item_Var_Store_Func)
|
||||
cff_load_item_variation_store,
|
||||
/* load_item_variation_store */
|
||||
(FT_Var_Get_Item_Delta_Func)
|
||||
cff_get_item_delta, /* get_item_delta */
|
||||
(FT_Var_Done_Item_Var_Store_Func)
|
||||
cff_done_item_variation_store,
|
||||
/* done_item_variation_store */
|
||||
(FT_Var_Done_Delta_Set_Idx_Map_Func)
|
||||
cff_done_delta_set_index_map,
|
||||
/* done_delta_set_index_map */
|
||||
(FT_Get_Var_Blend_Func) cff_get_var_blend, /* get_var_blend */
|
||||
(FT_Done_Blend_Func) cff_done_blend /* done_blend */
|
||||
)
|
||||
|
||||
|
||||
|
|
|
@ -507,19 +507,34 @@
|
|||
FT_DEFINE_SERVICE_MULTIMASTERSREC(
|
||||
tt_service_gx_multi_masters,
|
||||
|
||||
(FT_Get_MM_Func) NULL, /* get_mm */
|
||||
(FT_Set_MM_Design_Func) NULL, /* set_mm_design */
|
||||
(FT_Set_MM_Blend_Func) TT_Set_MM_Blend, /* set_mm_blend */
|
||||
(FT_Get_MM_Blend_Func) TT_Get_MM_Blend, /* get_mm_blend */
|
||||
(FT_Get_MM_Var_Func) TT_Get_MM_Var, /* get_mm_var */
|
||||
(FT_Set_Var_Design_Func) TT_Set_Var_Design, /* set_var_design */
|
||||
(FT_Get_Var_Design_Func) TT_Get_Var_Design, /* get_var_design */
|
||||
(FT_Set_Instance_Func) TT_Set_Named_Instance, /* set_instance */
|
||||
(FT_Set_MM_WeightVector_Func)NULL, /* set_mm_weightvector */
|
||||
(FT_Get_MM_WeightVector_Func)NULL, /* get_mm_weightvector */
|
||||
|
||||
(FT_Get_Var_Blend_Func) tt_get_var_blend, /* get_var_blend */
|
||||
(FT_Done_Blend_Func) tt_done_blend /* done_blend */
|
||||
(FT_Get_MM_Func) NULL, /* get_mm */
|
||||
(FT_Set_MM_Design_Func) NULL, /* set_mm_design */
|
||||
(FT_Set_MM_Blend_Func) TT_Set_MM_Blend, /* set_mm_blend */
|
||||
(FT_Get_MM_Blend_Func) TT_Get_MM_Blend, /* get_mm_blend */
|
||||
(FT_Get_MM_Var_Func) TT_Get_MM_Var, /* get_mm_var */
|
||||
(FT_Set_Var_Design_Func)TT_Set_Var_Design, /* set_var_design */
|
||||
(FT_Get_Var_Design_Func)TT_Get_Var_Design, /* get_var_design */
|
||||
(FT_Set_Instance_Func) TT_Set_Named_Instance, /* set_instance */
|
||||
(FT_Set_MM_WeightVector_Func)
|
||||
NULL, /* set_mm_weightvector */
|
||||
(FT_Get_MM_WeightVector_Func)
|
||||
NULL, /* get_mm_weightvector */
|
||||
(FT_Var_Load_Delta_Set_Idx_Map_Func)
|
||||
tt_var_load_delta_set_index_mapping,
|
||||
/* load_delta_set_idx_map */
|
||||
(FT_Var_Load_Item_Var_Store_Func)
|
||||
tt_var_load_item_variation_store,
|
||||
/* load_item_variation_store */
|
||||
(FT_Var_Get_Item_Delta_Func)
|
||||
tt_var_get_item_delta, /* get_item_delta */
|
||||
(FT_Var_Done_Item_Var_Store_Func)
|
||||
tt_var_done_item_variation_store,
|
||||
/* done_item_variation_store */
|
||||
(FT_Var_Done_Delta_Set_Idx_Map_Func)
|
||||
tt_var_done_delta_set_index_map,
|
||||
/* done_delta_set_index_map */
|
||||
(FT_Get_Var_Blend_Func) tt_get_var_blend, /* get_var_blend */
|
||||
(FT_Done_Blend_Func) tt_done_blend /* done_blend */
|
||||
)
|
||||
|
||||
FT_DEFINE_SERVICE_METRICSVARIATIONSREC(
|
||||
|
|
|
@ -438,8 +438,8 @@
|
|||
}
|
||||
|
||||
|
||||
static FT_Error
|
||||
ft_var_load_item_variation_store( TT_Face face,
|
||||
FT_LOCAL_DEF( FT_Error )
|
||||
tt_var_load_item_variation_store( TT_Face face,
|
||||
FT_ULong offset,
|
||||
GX_ItemVarStore itemStore )
|
||||
{
|
||||
|
@ -465,7 +465,7 @@
|
|||
|
||||
if ( format != 1 )
|
||||
{
|
||||
FT_TRACE2(( "ft_var_load_item_variation_store: bad store format %d\n",
|
||||
FT_TRACE2(( "tt_var_load_item_variation_store: bad store format %d\n",
|
||||
format ));
|
||||
error = FT_THROW( Invalid_Table );
|
||||
goto Exit;
|
||||
|
@ -479,7 +479,7 @@
|
|||
/* we need at least one entry in `itemStore->varData' */
|
||||
if ( !itemStore->dataCount )
|
||||
{
|
||||
FT_TRACE2(( "ft_var_load_item_variation_store: missing varData\n" ));
|
||||
FT_TRACE2(( "tt_var_load_item_variation_store: missing varData\n" ));
|
||||
error = FT_THROW( Invalid_Table );
|
||||
goto Exit;
|
||||
}
|
||||
|
@ -515,7 +515,7 @@
|
|||
|
||||
if ( itemStore->axisCount != (FT_Long)blend->mmvar->num_axis )
|
||||
{
|
||||
FT_TRACE2(( "ft_var_load_item_variation_store:"
|
||||
FT_TRACE2(( "tt_var_load_item_variation_store:"
|
||||
" number of axes in item variation store\n" ));
|
||||
FT_TRACE2(( " "
|
||||
" and `fvar' table are different\n" ));
|
||||
|
@ -526,7 +526,7 @@
|
|||
/* new constraint in OpenType 1.8.4 */
|
||||
if ( itemStore->regionCount >= 32768U )
|
||||
{
|
||||
FT_TRACE2(( "ft_var_load_item_variation_store:"
|
||||
FT_TRACE2(( "tt_var_load_item_variation_store:"
|
||||
" too many variation region tables\n" ));
|
||||
error = FT_THROW( Invalid_Table );
|
||||
goto Exit;
|
||||
|
@ -680,8 +680,8 @@
|
|||
}
|
||||
|
||||
|
||||
static FT_Error
|
||||
ft_var_load_delta_set_index_mapping( TT_Face face,
|
||||
FT_LOCAL_DEF( FT_Error )
|
||||
tt_var_load_delta_set_index_mapping( TT_Face face,
|
||||
FT_ULong offset,
|
||||
GX_DeltaSetIdxMap map,
|
||||
GX_ItemVarStore itemStore,
|
||||
|
@ -738,7 +738,7 @@
|
|||
/* rough sanity check */
|
||||
if ( map->mapCount * entrySize > table_len )
|
||||
{
|
||||
FT_TRACE1(( "ft_var_load_delta_set_index_mapping:"
|
||||
FT_TRACE1(( "tt_var_load_delta_set_index_mapping:"
|
||||
" invalid number of delta-set index mappings\n" ));
|
||||
error = FT_THROW( Invalid_Table );
|
||||
goto Exit;
|
||||
|
@ -907,7 +907,7 @@
|
|||
table = blend->hvar_table;
|
||||
}
|
||||
|
||||
error = ft_var_load_item_variation_store(
|
||||
error = tt_var_load_item_variation_store(
|
||||
face,
|
||||
table_offset + store_offset,
|
||||
&table->itemStore );
|
||||
|
@ -916,7 +916,7 @@
|
|||
|
||||
if ( widthMap_offset )
|
||||
{
|
||||
error = ft_var_load_delta_set_index_mapping(
|
||||
error = tt_var_load_delta_set_index_mapping(
|
||||
face,
|
||||
table_offset + widthMap_offset,
|
||||
&table->widthMap,
|
||||
|
@ -958,8 +958,8 @@
|
|||
}
|
||||
|
||||
|
||||
static FT_Int
|
||||
ft_var_get_item_delta( TT_Face face,
|
||||
FT_LOCAL_DEF( FT_Int )
|
||||
tt_var_get_item_delta( TT_Face face,
|
||||
GX_ItemVarStore itemStore,
|
||||
FT_UInt outerIndex,
|
||||
FT_UInt innerIndex )
|
||||
|
@ -1157,7 +1157,7 @@
|
|||
}
|
||||
else
|
||||
{
|
||||
delta = ft_var_get_item_delta( face,
|
||||
delta = tt_var_get_item_delta( face,
|
||||
&table->itemStore,
|
||||
outerIndex,
|
||||
innerIndex );
|
||||
|
@ -1337,7 +1337,7 @@
|
|||
|
||||
records_offset = FT_STREAM_POS();
|
||||
|
||||
error = ft_var_load_item_variation_store(
|
||||
error = tt_var_load_item_variation_store(
|
||||
face,
|
||||
table_offset + store_offset,
|
||||
&blend->mvar_table->itemStore );
|
||||
|
@ -1466,7 +1466,7 @@
|
|||
continue;
|
||||
}
|
||||
|
||||
delta = ft_var_get_item_delta( face,
|
||||
delta = tt_var_get_item_delta( face,
|
||||
&blend->mvar_table->itemStore,
|
||||
value->outerIndex,
|
||||
value->innerIndex );
|
||||
|
@ -4349,8 +4349,8 @@
|
|||
}
|
||||
|
||||
|
||||
static void
|
||||
ft_var_done_item_variation_store( TT_Face face,
|
||||
FT_LOCAL_DEF( void )
|
||||
tt_var_done_item_variation_store( TT_Face face,
|
||||
GX_ItemVarStore itemStore )
|
||||
{
|
||||
FT_Memory memory = FT_FACE_MEMORY( face );
|
||||
|
@ -4378,8 +4378,8 @@
|
|||
}
|
||||
|
||||
|
||||
static void
|
||||
ft_var_done_delta_set_index_map( TT_Face face,
|
||||
FT_LOCAL_DEF( void )
|
||||
tt_var_done_delta_set_index_map( TT_Face face,
|
||||
GX_DeltaSetIdxMap deltaSetIdxMap )
|
||||
{
|
||||
FT_Memory memory = FT_FACE_MEMORY( face );
|
||||
|
@ -4427,27 +4427,27 @@
|
|||
|
||||
if ( blend->hvar_table )
|
||||
{
|
||||
ft_var_done_item_variation_store( face,
|
||||
tt_var_done_item_variation_store( face,
|
||||
&blend->hvar_table->itemStore );
|
||||
|
||||
ft_var_done_delta_set_index_map( face,
|
||||
tt_var_done_delta_set_index_map( face,
|
||||
&blend->hvar_table->widthMap );
|
||||
FT_FREE( blend->hvar_table );
|
||||
}
|
||||
|
||||
if ( blend->vvar_table )
|
||||
{
|
||||
ft_var_done_item_variation_store( face,
|
||||
tt_var_done_item_variation_store( face,
|
||||
&blend->vvar_table->itemStore );
|
||||
|
||||
ft_var_done_delta_set_index_map( face,
|
||||
tt_var_done_delta_set_index_map( face,
|
||||
&blend->vvar_table->widthMap );
|
||||
FT_FREE( blend->vvar_table );
|
||||
}
|
||||
|
||||
if ( blend->mvar_table )
|
||||
{
|
||||
ft_var_done_item_variation_store( face,
|
||||
tt_var_done_item_variation_store( face,
|
||||
&blend->mvar_table->itemStore );
|
||||
|
||||
FT_FREE( blend->mvar_table->values );
|
||||
|
|
|
@ -62,57 +62,6 @@ FT_BEGIN_HEADER
|
|||
} GX_AVarSegmentRec, *GX_AVarSegment;
|
||||
|
||||
|
||||
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;
|
||||
|
||||
|
||||
/**************************************************************************
|
||||
*
|
||||
* @Struct:
|
||||
|
@ -431,6 +380,34 @@ FT_BEGIN_HEADER
|
|||
FT_LOCAL( void )
|
||||
tt_apply_mvar( TT_Face face );
|
||||
|
||||
|
||||
FT_LOCAL( FT_Error )
|
||||
tt_var_load_item_variation_store( TT_Face face,
|
||||
FT_ULong offset,
|
||||
GX_ItemVarStore itemStore );
|
||||
|
||||
FT_LOCAL( FT_Error )
|
||||
tt_var_load_delta_set_index_mapping( TT_Face face,
|
||||
FT_ULong offset,
|
||||
GX_DeltaSetIdxMap map,
|
||||
GX_ItemVarStore itemStore,
|
||||
FT_ULong table_len );
|
||||
|
||||
FT_LOCAL( FT_Int )
|
||||
tt_var_get_item_delta( TT_Face face,
|
||||
GX_ItemVarStore itemStore,
|
||||
FT_UInt outerIndex,
|
||||
FT_UInt innerIndex );
|
||||
|
||||
FT_LOCAL( void )
|
||||
tt_var_done_item_variation_store( TT_Face face,
|
||||
GX_ItemVarStore itemStore );
|
||||
|
||||
FT_LOCAL( void )
|
||||
tt_var_done_delta_set_index_map( TT_Face face,
|
||||
GX_DeltaSetIdxMap deltaSetIdxMap );
|
||||
|
||||
|
||||
FT_LOCAL( FT_Error )
|
||||
tt_get_var_blend( TT_Face face,
|
||||
FT_UInt *num_coords,
|
||||
|
|
|
@ -121,19 +121,30 @@
|
|||
#ifndef T1_CONFIG_OPTION_NO_MM_SUPPORT
|
||||
static const FT_Service_MultiMastersRec t1_service_multi_masters =
|
||||
{
|
||||
(FT_Get_MM_Func) T1_Get_Multi_Master, /* get_mm */
|
||||
(FT_Set_MM_Design_Func) T1_Set_MM_Design, /* set_mm_design */
|
||||
(FT_Set_MM_Blend_Func) T1_Set_MM_Blend, /* set_mm_blend */
|
||||
(FT_Get_MM_Blend_Func) T1_Get_MM_Blend, /* get_mm_blend */
|
||||
(FT_Get_MM_Var_Func) T1_Get_MM_Var, /* get_mm_var */
|
||||
(FT_Set_Var_Design_Func) T1_Set_Var_Design, /* set_var_design */
|
||||
(FT_Get_Var_Design_Func) T1_Get_Var_Design, /* get_var_design */
|
||||
(FT_Set_Instance_Func) T1_Reset_MM_Blend, /* set_instance */
|
||||
(FT_Set_MM_WeightVector_Func)T1_Set_MM_WeightVector, /* set_mm_weightvector */
|
||||
(FT_Get_MM_WeightVector_Func)T1_Get_MM_WeightVector, /* get_mm_weightvector */
|
||||
|
||||
(FT_Get_Var_Blend_Func) NULL, /* get_var_blend */
|
||||
(FT_Done_Blend_Func) T1_Done_Blend /* done_blend */
|
||||
(FT_Get_MM_Func) T1_Get_Multi_Master, /* get_mm */
|
||||
(FT_Set_MM_Design_Func) T1_Set_MM_Design, /* set_mm_design */
|
||||
(FT_Set_MM_Blend_Func) T1_Set_MM_Blend, /* set_mm_blend */
|
||||
(FT_Get_MM_Blend_Func) T1_Get_MM_Blend, /* get_mm_blend */
|
||||
(FT_Get_MM_Var_Func) T1_Get_MM_Var, /* get_mm_var */
|
||||
(FT_Set_Var_Design_Func)T1_Set_Var_Design, /* set_var_design */
|
||||
(FT_Get_Var_Design_Func)T1_Get_Var_Design, /* get_var_design */
|
||||
(FT_Set_Instance_Func) T1_Reset_MM_Blend, /* set_instance */
|
||||
(FT_Set_MM_WeightVector_Func)
|
||||
T1_Set_MM_WeightVector, /* set_mm_weightvector */
|
||||
(FT_Get_MM_WeightVector_Func)
|
||||
T1_Get_MM_WeightVector, /* get_mm_weightvector */
|
||||
(FT_Var_Load_Delta_Set_Idx_Map_Func)
|
||||
NULL, /* load_delta_set_idx_map */
|
||||
(FT_Var_Load_Item_Var_Store_Func)
|
||||
NULL, /* load_item_variation_store */
|
||||
(FT_Var_Get_Item_Delta_Func)
|
||||
NULL, /* get_item_delta */
|
||||
(FT_Var_Done_Item_Var_Store_Func)
|
||||
NULL, /* done_item_variation_store */
|
||||
(FT_Var_Done_Delta_Set_Idx_Map_Func)
|
||||
NULL, /* done_delta_set_index_map */
|
||||
(FT_Get_Var_Blend_Func) NULL, /* get_var_blend */
|
||||
(FT_Done_Blend_Func) T1_Done_Blend /* done_blend */
|
||||
};
|
||||
#endif
|
||||
|
||||
|
|
Loading…
Reference in New Issue