[subset] Do not repeat COLR table closure

This commit is contained in:
Qunxin Liu 2022-07-20 14:59:02 -07:00 committed by Behdad Esfahbod
parent 9fc31db6fa
commit 0f80076937
1 changed files with 7 additions and 13 deletions

View File

@ -314,22 +314,16 @@ static void _colr_closure (hb_face_t *face,
OT::COLR::accelerator_t colr (face); OT::COLR::accelerator_t colr (face);
if (!colr.is_valid ()) return; if (!colr.is_valid ()) return;
unsigned iteration_count = 0;
hb_set_t palette_indices, layer_indices; hb_set_t palette_indices, layer_indices;
unsigned glyphs_num; // Collect all glyphs referenced by COLRv0
{ hb_set_t glyphset_colrv0;
glyphs_num = glyphs_colred->get_population (); for (hb_codepoint_t gid : *glyphs_colred)
// Collect all glyphs referenced by COLRv0 colr.closure_glyphs (gid, &glyphset_colrv0);
hb_set_t glyphset_colrv0;
for (hb_codepoint_t gid : glyphs_colred->iter ())
colr.closure_glyphs (gid, &glyphset_colrv0);
glyphs_colred->union_ (glyphset_colrv0); glyphs_colred->union_ (glyphset_colrv0);
//closure for COLRv1 //closure for COLRv1
colr.closure_forV1 (glyphs_colred, &layer_indices, &palette_indices); colr.closure_forV1 (glyphs_colred, &layer_indices, &palette_indices);
} while (iteration_count++ <= HB_CLOSURE_MAX_STAGES &&
glyphs_num != glyphs_colred->get_population ());
colr.closure_V0palette_indices (glyphs_colred, &palette_indices); colr.closure_V0palette_indices (glyphs_colred, &palette_indices);
_remap_indexes (&layer_indices, layers_map); _remap_indexes (&layer_indices, layers_map);