[base] Fill 'COLR' v1 API templates to make them work (#59703).
* src/base/ftobjs.c (FT_Get_Color_Glyph_Paint, FT_Get_Paint_Layers, FT_Get_Paint, FT_Get_Colorline_Stops): Add basic sanity checks, check for existence of `FT_Face`, check arguments and delegate calls for the respective 'COLR' v1 API to the SFNT driver.
This commit is contained in:
parent
d3e95d97a0
commit
4b58cf47cc
|
@ -1,3 +1,12 @@
|
||||||
|
2020-12-16 Dominik Röttsches <drott@chromium.org>
|
||||||
|
|
||||||
|
[base] Fill 'COLR' v1 API templates to make them work (#59703).
|
||||||
|
|
||||||
|
* src/base/ftobjs.c (FT_Get_Color_Glyph_Paint, FT_Get_Paint_Layers,
|
||||||
|
FT_Get_Paint, FT_Get_Colorline_Stops): Add basic sanity checks,
|
||||||
|
check for existence of `FT_Face`, check arguments and delegate calls
|
||||||
|
for the respective 'COLR' v1 API to the SFNT driver.
|
||||||
|
|
||||||
2020-12-16 Dominik Röttsches <drott@chromium.org>
|
2020-12-16 Dominik Röttsches <drott@chromium.org>
|
||||||
|
|
||||||
[sfnt] Register 'COLR' v1 API in driver (#59703).
|
[sfnt] Register 'COLR' v1 API in driver (#59703).
|
||||||
|
|
|
@ -5568,39 +5568,111 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* documentation is in freetype.h */
|
||||||
|
|
||||||
FT_EXPORT_DEF ( FT_Bool )
|
FT_EXPORT_DEF ( FT_Bool )
|
||||||
FT_Get_Color_Glyph_Paint( FT_Face face,
|
FT_Get_Color_Glyph_Paint( FT_Face face,
|
||||||
FT_UInt base_glyph,
|
FT_UInt base_glyph,
|
||||||
FT_OpaquePaint* paint )
|
FT_OpaquePaint* paint )
|
||||||
{
|
{
|
||||||
return 0;
|
TT_Face ttface;
|
||||||
|
SFNT_Service sfnt;
|
||||||
|
|
||||||
|
|
||||||
|
if ( !face || !paint )
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
if ( !FT_IS_SFNT( face ) )
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
ttface = (TT_Face)face;
|
||||||
|
sfnt = (SFNT_Service)ttface->sfnt;
|
||||||
|
|
||||||
|
if ( sfnt->get_colr_layer )
|
||||||
|
return sfnt->get_colr_glyph_paint( ttface, base_glyph, paint );
|
||||||
|
else
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* documentation is in freetype.h */
|
||||||
|
|
||||||
FT_EXPORT_DEF ( FT_Bool )
|
FT_EXPORT_DEF ( FT_Bool )
|
||||||
FT_Get_Paint_Layers( FT_Face face,
|
FT_Get_Paint_Layers( FT_Face face,
|
||||||
FT_LayerIterator* layer_iterator,
|
FT_LayerIterator* layer_iterator,
|
||||||
FT_OpaquePaint* paint )
|
FT_OpaquePaint* paint )
|
||||||
{
|
{
|
||||||
return 0;
|
TT_Face ttface;
|
||||||
|
SFNT_Service sfnt;
|
||||||
|
|
||||||
|
|
||||||
|
if ( !face || !paint || !layer_iterator )
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
if ( !FT_IS_SFNT( face ) )
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
ttface = (TT_Face)face;
|
||||||
|
sfnt = (SFNT_Service)ttface->sfnt;
|
||||||
|
|
||||||
|
if ( sfnt->get_paint_layers )
|
||||||
|
return sfnt->get_paint_layers( ttface, layer_iterator, paint );
|
||||||
|
else
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* documentation is in freetype.h */
|
||||||
|
|
||||||
FT_EXPORT_DEF( FT_Bool )
|
FT_EXPORT_DEF( FT_Bool )
|
||||||
FT_Get_Paint( FT_Face face,
|
FT_Get_Paint( FT_Face face,
|
||||||
FT_OpaquePaint opaque_paint,
|
FT_OpaquePaint opaque_paint,
|
||||||
FT_COLR_Paint* paint )
|
FT_COLR_Paint* paint )
|
||||||
{
|
{
|
||||||
return 0;
|
TT_Face ttface;
|
||||||
|
SFNT_Service sfnt;
|
||||||
|
|
||||||
|
|
||||||
|
if ( !face || !paint || !paint )
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
if ( !FT_IS_SFNT( face ) )
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
ttface = (TT_Face)face;
|
||||||
|
sfnt = (SFNT_Service)ttface->sfnt;
|
||||||
|
|
||||||
|
if ( sfnt->get_paint )
|
||||||
|
return sfnt->get_paint( ttface, opaque_paint, paint );
|
||||||
|
else
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* documentation is in freetype.h */
|
||||||
|
|
||||||
FT_EXPORT_DEF ( FT_Bool )
|
FT_EXPORT_DEF ( FT_Bool )
|
||||||
FT_Get_Colorline_Stops ( FT_Face face,
|
FT_Get_Colorline_Stops ( FT_Face face,
|
||||||
FT_ColorStop * color_stop,
|
FT_ColorStop * color_stop,
|
||||||
FT_ColorStopIterator *iterator )
|
FT_ColorStopIterator *iterator )
|
||||||
{
|
{
|
||||||
return 0;
|
TT_Face ttface;
|
||||||
|
SFNT_Service sfnt;
|
||||||
|
|
||||||
|
|
||||||
|
if ( !face || !color_stop || !iterator )
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
if ( !FT_IS_SFNT( face ) )
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
ttface = (TT_Face)face;
|
||||||
|
sfnt = (SFNT_Service)ttface->sfnt;
|
||||||
|
|
||||||
|
if ( sfnt->get_colorline_stops )
|
||||||
|
return sfnt->get_colorline_stops ( ttface, color_stop, iterator );
|
||||||
|
else
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue