[subset] fix failing colrv0 subsetting when font has composite glyphs.
Composite glyph collection was happening along side colrv0 glyph collection which meant it was possible to miss grabbing the component glyphs for a glyph added by colrv0.
This commit is contained in:
parent
b54d9b695a
commit
a08900b721
@ -254,18 +254,26 @@ _populate_gids_to_retain (hb_subset_plan_t* plan,
|
||||
#endif
|
||||
_remove_invalid_gids (plan->_glyphset_gsub, plan->source->get_num_glyphs ());
|
||||
|
||||
// Collect all glyphs referenced by COLRv0
|
||||
hb_set_t* cur_glyphset = plan->_glyphset_gsub;
|
||||
hb_set_t glyphset_colrv0;
|
||||
if (colr.is_valid ())
|
||||
{
|
||||
glyphset_colrv0.union_ (cur_glyphset);
|
||||
for (hb_codepoint_t gid : cur_glyphset->iter ())
|
||||
colr.closure_glyphs (gid, &glyphset_colrv0);
|
||||
cur_glyphset = &glyphset_colrv0;
|
||||
}
|
||||
|
||||
// Populate a full set of glyphs to retain by adding all referenced
|
||||
// composite glyphs.
|
||||
hb_codepoint_t gid = HB_SET_VALUE_INVALID;
|
||||
while (plan->_glyphset_gsub->next (&gid))
|
||||
for (hb_codepoint_t gid : cur_glyphset->iter ())
|
||||
{
|
||||
glyf.add_gid_and_children (gid, plan->_glyphset);
|
||||
#ifndef HB_NO_SUBSET_CFF
|
||||
if (cff.is_valid ())
|
||||
_add_cff_seac_components (cff, gid, plan->_glyphset);
|
||||
#endif
|
||||
if (colr.is_valid ())
|
||||
colr.closure_glyphs (gid, plan->_glyphset);
|
||||
}
|
||||
|
||||
_remove_invalid_gids (plan->_glyphset, plan->source->get_num_glyphs ());
|
||||
|
@ -36,6 +36,7 @@ EXTRA_DIST += \
|
||||
expected/cmap14 \
|
||||
expected/sbix \
|
||||
expected/colr \
|
||||
expected/colr_with_components \
|
||||
expected/cbdt \
|
||||
expected/variable \
|
||||
fonts \
|
||||
|
@ -6,6 +6,7 @@ TESTS = \
|
||||
tests/cmap.tests \
|
||||
tests/cmap14.tests \
|
||||
tests/colr.tests \
|
||||
tests/colr_with_components.tests \
|
||||
tests/full-font.tests \
|
||||
tests/japanese.tests \
|
||||
tests/layout.context.tests \
|
||||
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
test/subset/data/fonts/colr-table.ttf
Normal file
BIN
test/subset/data/fonts/colr-table.ttf
Normal file
Binary file not shown.
11
test/subset/data/tests/colr_with_components.tests
Normal file
11
test/subset/data/tests/colr_with_components.tests
Normal file
@ -0,0 +1,11 @@
|
||||
FONTS:
|
||||
colr-table.ttf
|
||||
|
||||
PROFILES:
|
||||
default.txt
|
||||
drop-hints.txt
|
||||
drop-hints-retain-gids.txt
|
||||
retain-gids.txt
|
||||
|
||||
SUBSETS:
|
||||
k
|
@ -28,6 +28,7 @@ tests = [
|
||||
'cmap14',
|
||||
'sbix',
|
||||
'colr',
|
||||
'colr_with_components',
|
||||
'cbdt',
|
||||
'variable',
|
||||
]
|
||||
|
Loading…
Reference in New Issue
Block a user