[sfnt] Register 'COLR' v1 API in driver (#59703).
* include/freetype/internal/sfnt.h (TT_Get_Color_Glyph_Paint_Func, TT_Get_Paint_Layers_Func, TT_Get_Colorline_Stops_Func, TT_Get_Paint_Func): New function pointer types. (SFNT_Interface): Add them. (FT_DEFINE_SFNT_INTERFACE): Updated. * src/sfnt/sfdriver.c (PUT_COLOR_LAYERS_V1): New macro. (sfnt_interface): Add new function pointers.
This commit is contained in:
parent
6260b4901c
commit
d3e95d97a0
13
ChangeLog
13
ChangeLog
|
@ -1,3 +1,16 @@
|
|||
2020-12-16 Dominik Röttsches <drott@chromium.org>
|
||||
|
||||
[sfnt] Register 'COLR' v1 API in driver (#59703).
|
||||
|
||||
* include/freetype/internal/sfnt.h (TT_Get_Color_Glyph_Paint_Func,
|
||||
TT_Get_Paint_Layers_Func, TT_Get_Colorline_Stops_Func,
|
||||
TT_Get_Paint_Func): New function pointer types.
|
||||
(SFNT_Interface): Add them.
|
||||
(FT_DEFINE_SFNT_INTERFACE): Updated.
|
||||
|
||||
* src/sfnt/sfdriver.c (PUT_COLOR_LAYERS_V1): New macro.
|
||||
(sfnt_interface): Add new function pointers.
|
||||
|
||||
2020-12-16 Dominik Röttsches <drott@chromium.org>
|
||||
|
||||
[sfnt] Add 'COLR' v1 API to retrieve color layers (#59703).
|
||||
|
|
|
@ -524,6 +524,131 @@ FT_BEGIN_HEADER
|
|||
FT_LayerIterator* iterator );
|
||||
|
||||
|
||||
/**************************************************************************
|
||||
*
|
||||
* @functype:
|
||||
* TT_Get_Color_Glyph_Paint_Func
|
||||
*
|
||||
* @description:
|
||||
* Find the root @FT_OpaquePaint object for a given glyph ID.
|
||||
*
|
||||
* @input:
|
||||
* face ::
|
||||
* The target face object.
|
||||
*
|
||||
* base_glyph ::
|
||||
* The glyph index the colored glyph layers are associated with.
|
||||
*
|
||||
* @output:
|
||||
* paint ::
|
||||
* The root @FT_OpaquePaint object.
|
||||
*
|
||||
* @return:
|
||||
* Value~1 if everything is OK. If no color glyph is found, or the root
|
||||
* paint could not be retrieved, value~0 gets returned. In case of an
|
||||
* error, value~0 is returned also.
|
||||
*/
|
||||
typedef FT_Bool
|
||||
( *TT_Get_Color_Glyph_Paint_Func )( TT_Face face,
|
||||
FT_UInt base_glyph,
|
||||
FT_OpaquePaint *paint );
|
||||
|
||||
|
||||
/**************************************************************************
|
||||
*
|
||||
* @functype:
|
||||
* TT_Get_Paint_Layers_Func
|
||||
*
|
||||
* @description:
|
||||
* Access the layers of a `PaintColrLayers` table.
|
||||
*
|
||||
* @input:
|
||||
* face ::
|
||||
* The target face object.
|
||||
*
|
||||
* @inout:
|
||||
* iterator ::
|
||||
* The @FT_LayerIterator from an @FT_PaintColrLayers object, for which
|
||||
* the layers are to be retrieved. The internal state of the iterator
|
||||
* is incremented after one call to this function for retrieving one
|
||||
* layer.
|
||||
*
|
||||
* @output:
|
||||
* paint ::
|
||||
* The root @FT_OpaquePaint object referencing the actual paint table.
|
||||
*
|
||||
* @return:
|
||||
* Value~1 if everything is OK. Value~0 gets returned when the paint
|
||||
* object can not be retrieved or any other error occurs.
|
||||
*/
|
||||
typedef FT_Bool
|
||||
( *TT_Get_Paint_Layers_Func )( TT_Face face,
|
||||
FT_LayerIterator* iterator,
|
||||
FT_OpaquePaint *paint );
|
||||
|
||||
|
||||
/**************************************************************************
|
||||
*
|
||||
* @functype:
|
||||
* TT_Get_Colorline_Stops_Func
|
||||
*
|
||||
* @description:
|
||||
* Get the gradient and solid fill information for a given glyph.
|
||||
*
|
||||
* @input:
|
||||
* face ::
|
||||
* The target face object.
|
||||
*
|
||||
* @inout:
|
||||
* iterator ::
|
||||
* An @FT_ColorStopIterator object. For the first call you should set
|
||||
* `iterator->p` to `NULL`. For all following calls, simply use the
|
||||
* same object again.
|
||||
*
|
||||
* @output:
|
||||
* color_stop ::
|
||||
* Color index and alpha value for the retrieved color stop.
|
||||
*
|
||||
* @return:
|
||||
* Value~1 if everything is OK. If there are no more color stops,
|
||||
* value~0 gets returned. In case of an error, value~0 is returned
|
||||
* also.
|
||||
*/
|
||||
typedef FT_Bool
|
||||
( *TT_Get_Colorline_Stops_Func )( TT_Face face,
|
||||
FT_ColorStop *color_stop,
|
||||
FT_ColorStopIterator* iterator );
|
||||
|
||||
|
||||
/**************************************************************************
|
||||
*
|
||||
* @functype:
|
||||
* TT_Get_Paint_Func
|
||||
*
|
||||
* @description:
|
||||
* Get the paint details for a given @FT_OpaquePaint object.
|
||||
*
|
||||
* @input:
|
||||
* face ::
|
||||
* The target face object.
|
||||
*
|
||||
* opaque_paint ::
|
||||
* The @FT_OpaquePaint object.
|
||||
*
|
||||
* @output:
|
||||
* paint ::
|
||||
* An @FT_COLR_Paint object holding the details on `opaque_paint`.
|
||||
*
|
||||
* @return:
|
||||
* Value~1 if everything is OK. Value~0 if no details can be found for
|
||||
* this paint or any other error occured.
|
||||
*/
|
||||
typedef FT_Bool
|
||||
( *TT_Get_Paint_Func )( TT_Face face,
|
||||
FT_OpaquePaint opaque_paint,
|
||||
FT_COLR_Paint *paint );
|
||||
|
||||
|
||||
/**************************************************************************
|
||||
*
|
||||
* @functype:
|
||||
|
@ -770,6 +895,10 @@ FT_BEGIN_HEADER
|
|||
TT_Free_Table_Func free_colr;
|
||||
TT_Set_Palette_Func set_palette;
|
||||
TT_Get_Colr_Layer_Func get_colr_layer;
|
||||
TT_Get_Color_Glyph_Paint_Func get_colr_glyph_paint;
|
||||
TT_Get_Paint_Layers_Func get_paint_layers;
|
||||
TT_Get_Colorline_Stops_Func get_colorline_stops;
|
||||
TT_Get_Paint_Func get_paint;
|
||||
TT_Blend_Colr_Func colr_blend;
|
||||
|
||||
TT_Get_Metrics_Func get_metrics;
|
||||
|
@ -820,6 +949,10 @@ FT_BEGIN_HEADER
|
|||
free_colr_, \
|
||||
set_palette_, \
|
||||
get_colr_layer_, \
|
||||
get_colr_glyph_paint_, \
|
||||
get_paint_layers_, \
|
||||
get_colorline_stops_, \
|
||||
get_paint_, \
|
||||
colr_blend_, \
|
||||
get_metrics_, \
|
||||
get_name_, \
|
||||
|
@ -860,6 +993,10 @@ FT_BEGIN_HEADER
|
|||
free_colr_, \
|
||||
set_palette_, \
|
||||
get_colr_layer_, \
|
||||
get_colr_glyph_paint_, \
|
||||
get_paint_layers_, \
|
||||
get_colorline_stops_, \
|
||||
get_paint_, \
|
||||
colr_blend_, \
|
||||
get_metrics_, \
|
||||
get_name_, \
|
||||
|
|
|
@ -1213,6 +1213,8 @@
|
|||
#define PUT_COLOR_LAYERS( a ) NULL
|
||||
#endif
|
||||
|
||||
#define PUT_COLOR_LAYERS_V1( a ) PUT_COLOR_LAYERS( a )
|
||||
|
||||
#ifdef TT_CONFIG_OPTION_POSTSCRIPT_NAMES
|
||||
#define PUT_PS_NAMES( a ) a
|
||||
#else
|
||||
|
@ -1287,6 +1289,16 @@
|
|||
/* TT_Set_Palette_Func set_palette */
|
||||
PUT_COLOR_LAYERS( tt_face_get_colr_layer ),
|
||||
/* TT_Get_Colr_Layer_Func get_colr_layer */
|
||||
|
||||
PUT_COLOR_LAYERS_V1( tt_face_get_colr_glyph_paint ),
|
||||
/* TT_Get_Colr_Glyph_Paint_Func get_colr_glyph_paint */
|
||||
PUT_COLOR_LAYERS_V1( tt_face_get_paint_layers ),
|
||||
/* TT_Get_Paint_Layers_Func get_paint_layers */
|
||||
PUT_COLOR_LAYERS_V1( tt_face_get_colorline_stops ),
|
||||
/* TT_Get_Paint get_paint */
|
||||
PUT_COLOR_LAYERS_V1( tt_face_get_paint ),
|
||||
/* TT_Get_Colorline_Stops_Func get_colorline_stops */
|
||||
|
||||
PUT_COLOR_LAYERS( tt_face_colr_blend_layer ),
|
||||
/* TT_Blend_Colr_Func colr_blend */
|
||||
|
||||
|
|
Loading…
Reference in New Issue