[subset-plan] Simplify unicodes allocation
This commit is contained in:
parent
75b33cb04b
commit
a34a204bf7
|
@ -1414,7 +1414,7 @@ struct CmapSubtable
|
|||
switch (format) {
|
||||
case 4: return u.format4.serialize (c, it);
|
||||
case 12: return u.format12.serialize (c, it);
|
||||
case 14: return u.format14.serialize (c, plan->unicodes, &plan->glyphs_requested, plan->glyph_map, base);
|
||||
case 14: return u.format14.serialize (c, &plan->unicodes, &plan->glyphs_requested, plan->glyph_map, base);
|
||||
default: return;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -239,11 +239,11 @@ struct OS2
|
|||
/* when --gids option is not used, no need to do collect_mapping that is
|
||||
* iterating all codepoints in each subtable, which is not efficient */
|
||||
uint16_t min_cp, max_cp;
|
||||
find_min_and_max_codepoint (c->plan->unicodes, &min_cp, &max_cp);
|
||||
find_min_and_max_codepoint (&c->plan->unicodes, &min_cp, &max_cp);
|
||||
os2_prime->usFirstCharIndex = min_cp;
|
||||
os2_prime->usLastCharIndex = max_cp;
|
||||
|
||||
_update_unicode_ranges (c->plan->unicodes, os2_prime->ulUnicodeRange);
|
||||
_update_unicode_ranges (&c->plan->unicodes, os2_prime->ulUnicodeRange);
|
||||
|
||||
return_trace (true);
|
||||
}
|
||||
|
|
|
@ -576,7 +576,7 @@ _populate_unicodes_to_retain (const hb_set_t *unicodes,
|
|||
auto &arr = plan->unicode_to_new_gid_list;
|
||||
if (arr.length)
|
||||
{
|
||||
plan->unicodes->add_sorted_array (&arr.arrayZ->first, arr.length, sizeof (*arr.arrayZ));
|
||||
plan->unicodes.add_sorted_array (&arr.arrayZ->first, arr.length, sizeof (*arr.arrayZ));
|
||||
plan->_glyphset_gsub.add_array (&arr.arrayZ->second, arr.length, sizeof (*arr.arrayZ));
|
||||
}
|
||||
}
|
||||
|
@ -621,7 +621,7 @@ _populate_gids_to_retain (hb_subset_plan_t* plan,
|
|||
|
||||
plan->_glyphset_gsub.add (0); // Not-def
|
||||
|
||||
_cmap_closure (plan->source, plan->unicodes, &plan->_glyphset_gsub);
|
||||
_cmap_closure (plan->source, &plan->unicodes, &plan->_glyphset_gsub);
|
||||
|
||||
#ifndef HB_NO_SUBSET_LAYOUT
|
||||
if (!drop_tables->has (HB_OT_TAG_GSUB))
|
||||
|
@ -838,7 +838,6 @@ hb_subset_plan_create_or_fail (hb_face_t *face,
|
|||
|
||||
plan->successful = true;
|
||||
plan->flags = input->flags;
|
||||
plan->unicodes = hb_set_create ();
|
||||
|
||||
plan->unicode_to_new_gid_list.init ();
|
||||
|
||||
|
@ -939,7 +938,7 @@ hb_subset_plan_create_or_fail (hb_face_t *face,
|
|||
|
||||
hb_map_t &unicode_to_gid = *plan->codepoint_to_glyph;
|
||||
|
||||
for (auto unicode : *plan->unicodes)
|
||||
for (auto unicode : plan->unicodes)
|
||||
{
|
||||
auto gid = unicode_to_gid[unicode];
|
||||
gid_to_unicodes.add (gid, unicode);
|
||||
|
@ -948,7 +947,7 @@ hb_subset_plan_create_or_fail (hb_face_t *face,
|
|||
plan->inprogress_accelerator =
|
||||
hb_subset_accelerator_t::create (*plan->codepoint_to_glyph,
|
||||
gid_to_unicodes,
|
||||
*plan->unicodes,
|
||||
plan->unicodes,
|
||||
plan->has_seac);
|
||||
}
|
||||
|
||||
|
|
|
@ -48,7 +48,6 @@ struct hb_subset_plan_t
|
|||
|
||||
~hb_subset_plan_t()
|
||||
{
|
||||
hb_set_destroy (unicodes);
|
||||
hb_face_destroy (source);
|
||||
hb_face_destroy (dest);
|
||||
hb_map_destroy (codepoint_to_glyph);
|
||||
|
@ -82,7 +81,7 @@ struct hb_subset_plan_t
|
|||
bool force_long_loca = false;
|
||||
|
||||
// For each cp that we'd like to retain maps to the corresponding gid.
|
||||
hb_set_t *unicodes;
|
||||
hb_set_t unicodes;
|
||||
hb_sorted_vector_t<hb_pair_t<hb_codepoint_t, hb_codepoint_t>> unicode_to_new_gid_list;
|
||||
|
||||
// name_ids we would like to retain
|
||||
|
|
Loading…
Reference in New Issue