[subset] add a new closure call to hb-ot-layout that can compute the closure over multiple lookups.
This commit is contained in:
parent
11f1f4131b
commit
57badadb76
|
@ -952,6 +952,32 @@ hb_ot_layout_lookup_substitute_closure (hb_face_t *face,
|
|||
l.closure (&c, lookup_index);
|
||||
}
|
||||
|
||||
/**
|
||||
* hb_ot_layout_lookups_substitute_closure:
|
||||
*
|
||||
* Compute the transitive closure of glyphs needed for all of the
|
||||
* provided lookups.
|
||||
*
|
||||
* Since: 1.8.1
|
||||
**/
|
||||
void
|
||||
hb_ot_layout_lookups_substitute_closure (hb_face_t *face,
|
||||
const hb_set_t *lookups,
|
||||
hb_set_t *glyphs)
|
||||
{
|
||||
hb_auto_t<hb_map_t> done_lookups;
|
||||
OT::hb_closure_context_t c (face, glyphs, &done_lookups);
|
||||
const OT::GSUB& gsub = _get_gsub (face);
|
||||
|
||||
unsigned int glyphs_length;
|
||||
do
|
||||
{
|
||||
glyphs_length = glyphs->get_population ();
|
||||
for (hb_codepoint_t lookup_index = HB_SET_VALUE_INVALID; hb_set_next (lookups, &lookup_index);)
|
||||
gsub.get_lookup (lookup_index).closure (&c, lookup_index);
|
||||
} while (glyphs_length != glyphs->get_population ());
|
||||
}
|
||||
|
||||
/*
|
||||
* OT::GPOS
|
||||
*/
|
||||
|
|
|
@ -277,6 +277,12 @@ hb_ot_layout_lookup_substitute_closure (hb_face_t *face,
|
|||
hb_set_t *glyphs
|
||||
/*TODO , hb_bool_t inclusive */);
|
||||
|
||||
HB_EXTERN void
|
||||
hb_ot_layout_lookups_substitute_closure (hb_face_t *face,
|
||||
const hb_set_t *lookups,
|
||||
hb_set_t *glyphs);
|
||||
|
||||
|
||||
#ifdef HB_NOT_IMPLEMENTED
|
||||
/* Note: You better have GDEF when using this API, or marks won't do much. */
|
||||
HB_EXTERN hb_bool_t
|
||||
|
|
|
@ -957,15 +957,7 @@ hb_ot_shape_glyphs_closure (hb_font_t *font,
|
|||
|
||||
hb_set_t *lookups = hb_set_create ();
|
||||
hb_ot_shape_plan_collect_lookups (shape_plan, HB_OT_TAG_GSUB, lookups);
|
||||
|
||||
/* And find transitive closure. */
|
||||
hb_set_t *copy = hb_set_create ();
|
||||
do {
|
||||
copy->set (glyphs);
|
||||
for (hb_codepoint_t lookup_index = HB_SET_VALUE_INVALID; hb_set_next (lookups, &lookup_index);)
|
||||
hb_ot_layout_lookup_substitute_closure (font->face, lookup_index, glyphs);
|
||||
} while (!copy->is_equal (glyphs));
|
||||
hb_set_destroy (copy);
|
||||
hb_ot_layout_lookups_substitute_closure (font->face, lookups, glyphs);
|
||||
|
||||
hb_set_destroy (lookups);
|
||||
|
||||
|
|
Loading…
Reference in New Issue