[ot-map] Use hb_array for a return value
This commit is contained in:
parent
a92d988d3d
commit
55a1e0bb11
|
@ -139,19 +139,15 @@ struct hb_ot_map_t
|
||||||
return map ? map->stage[table_index] : UINT_MAX;
|
return map ? map->stage[table_index] : UINT_MAX;
|
||||||
}
|
}
|
||||||
|
|
||||||
void get_stage_lookups (unsigned int table_index, unsigned int stage,
|
hb_array_t<const hb_ot_map_t::lookup_map_t>
|
||||||
const struct lookup_map_t **plookups, unsigned int *lookup_count) const
|
get_stage_lookups (unsigned int table_index, unsigned int stage) const
|
||||||
{
|
{
|
||||||
if (unlikely (stage > stages[table_index].length))
|
if (unlikely (stage > stages[table_index].length))
|
||||||
{
|
return hb_array<const hb_ot_map_t::lookup_map_t> (nullptr, 0);
|
||||||
*plookups = nullptr;
|
|
||||||
*lookup_count = 0;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
unsigned int start = stage ? stages[table_index][stage - 1].last_lookup : 0;
|
unsigned int start = stage ? stages[table_index][stage - 1].last_lookup : 0;
|
||||||
unsigned int end = stage < stages[table_index].length ? stages[table_index][stage].last_lookup : lookups[table_index].length;
|
unsigned int end = stage < stages[table_index].length ? stages[table_index][stage].last_lookup : lookups[table_index].length;
|
||||||
*plookups = end == start ? nullptr : &lookups[table_index][start];
|
return lookups[table_index].as_array ().sub_array (start, end - start);
|
||||||
*lookup_count = end - start;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
HB_INTERNAL void collect_lookups (unsigned int table_index, hb_set_t *lookups) const;
|
HB_INTERNAL void collect_lookups (unsigned int table_index, hb_set_t *lookups) const;
|
||||||
|
|
|
@ -92,24 +92,22 @@ struct hb_indic_would_substitute_feature_t
|
||||||
void init (const hb_ot_map_t *map, hb_tag_t feature_tag, bool zero_context_)
|
void init (const hb_ot_map_t *map, hb_tag_t feature_tag, bool zero_context_)
|
||||||
{
|
{
|
||||||
zero_context = zero_context_;
|
zero_context = zero_context_;
|
||||||
map->get_stage_lookups (0/*GSUB*/,
|
lookups = map->get_stage_lookups (0/*GSUB*/,
|
||||||
map->get_feature_stage (0/*GSUB*/, feature_tag),
|
map->get_feature_stage (0/*GSUB*/, feature_tag));
|
||||||
&lookups, &count);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool would_substitute (const hb_codepoint_t *glyphs,
|
bool would_substitute (const hb_codepoint_t *glyphs,
|
||||||
unsigned int glyphs_count,
|
unsigned int glyphs_count,
|
||||||
hb_face_t *face) const
|
hb_face_t *face) const
|
||||||
{
|
{
|
||||||
for (unsigned int i = 0; i < count; i++)
|
for (const auto &lookup : lookups)
|
||||||
if (hb_ot_layout_lookup_would_substitute (face, lookups[i].index, glyphs, glyphs_count, zero_context))
|
if (hb_ot_layout_lookup_would_substitute (face, lookup.index, glyphs, glyphs_count, zero_context))
|
||||||
return true;
|
return true;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
const hb_ot_map_t::lookup_map_t *lookups;
|
hb_array_t<const hb_ot_map_t::lookup_map_t> lookups;
|
||||||
unsigned int count;
|
|
||||||
bool zero_context;
|
bool zero_context;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue