[sfnt] If `COLR' is present, don't assume that all glyphs use it.

* src/sfnt/ttcolr.c (tt_face_load_colr_layers): Return FT_Err_Ok if
current glyph is not a `COLR' base glyph.

* src/truetype/ttgload.c (TT_Load_Glyph): Don't allocate
`color_layers' if there are no color layers.
This commit is contained in:
Werner Lemberg 2018-05-15 09:05:53 +02:00
parent 06820637e2
commit 2dd2091611
4 changed files with 26 additions and 8 deletions

View File

@ -1,3 +1,13 @@
2018-05-15 Werner Lemberg <wl@gnu.org>
[sfnt] If `COLR' is present, don't assume that all glyphs use it.
* src/sfnt/ttcolr.c (tt_face_load_colr_layers): Return FT_Err_Ok if
current glyph is not a `COLR' base glyph.
* src/truetype/ttgload.c (TT_Load_Glyph): Don't allocate
`color_layers' if there are no color layers.
2018-05-14 Werner Lemberg <wl@gnu.org>
* src/base/ftobjs.c (FT_Load_Glyph): Fix signature of `pixel_modes'.

View File

@ -4526,7 +4526,7 @@
break;
default:
if ( slot->internal->color_layers != NULL )
if ( slot->internal->color_layers )
{
FT_Face face = slot->face;

View File

@ -315,7 +315,12 @@
colr->num_base_glyphs,
glyph_id,
&glyph_record ) )
return FT_THROW ( Invalid_Table );
{
*ret_layers = NULL;
*ret_num_layers = 0;
return FT_Err_Ok;
}
/* Load all colors for the glyphs; this would be stored in the slot. */
layer_record_ptr = colr->layers +

View File

@ -2913,14 +2913,17 @@
if ( error )
return error;
if ( FT_NEW( color_layers ) )
return error;
if ( num_glyph_layers )
{
if ( FT_NEW( color_layers ) )
return error;
color_layers->layers = glyph_layers;
color_layers->num_layers = num_glyph_layers;
color_layers->load_flags = load_flags;
color_layers->layers = glyph_layers;
color_layers->num_layers = num_glyph_layers;
color_layers->load_flags = load_flags;
glyph->internal->color_layers = color_layers;
glyph->internal->color_layers = color_layers;
}
}
Exit: