[MultipleSubst] Rewrite serialize() in terms of iterators
Unused still, and hence untested
This commit is contained in:
parent
b57ea3b053
commit
65d28bc5a7
|
@ -35,19 +35,19 @@ struct MultipleSubst
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* TODO This function is unused and not updated to 24bit GIDs. Should be done by using
|
template<typename GlyphIterator, typename SequenceIterator,
|
||||||
* iterators. While at it perhaps using iterator of arrays of hb_codepoint_t instead. */
|
hb_requires (hb_is_sorted_source_of (GlyphIterator, hb_codepoint_t)),
|
||||||
|
hb_requires (hb_is_source_of (typename SequenceIterator::item_t, hb_codepoint_t))>
|
||||||
bool serialize (hb_serialize_context_t *c,
|
bool serialize (hb_serialize_context_t *c,
|
||||||
hb_sorted_array_t<const HBGlyphID16> glyphs,
|
GlyphIterator glyphs,
|
||||||
hb_array_t<const unsigned int> substitute_len_list,
|
SequenceIterator sequences)
|
||||||
hb_array_t<const HBGlyphID16> substitute_glyphs_list)
|
|
||||||
{
|
{
|
||||||
TRACE_SERIALIZE (this);
|
TRACE_SERIALIZE (this);
|
||||||
if (unlikely (!c->extend_min (u.format))) return_trace (false);
|
if (unlikely (!c->extend_min (u.format))) return_trace (false);
|
||||||
unsigned int format = 1;
|
unsigned int format = 1;
|
||||||
u.format = format;
|
u.format = format;
|
||||||
switch (u.format) {
|
switch (u.format) {
|
||||||
case 1: return_trace (u.format1.serialize (c, glyphs, substitute_len_list, substitute_glyphs_list));
|
case 1: return_trace (u.format1.serialize (c, glyphs, sequences));
|
||||||
default:return_trace (false);
|
default:return_trace (false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -71,22 +71,24 @@ struct MultipleSubstFormat1_2
|
||||||
return_trace ((this+sequence[index]).apply (c));
|
return_trace ((this+sequence[index]).apply (c));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template<typename GlyphIterator, typename SequenceIterator,
|
||||||
|
hb_requires (hb_is_sorted_source_of (GlyphIterator, hb_codepoint_t)),
|
||||||
|
hb_requires (hb_is_source_of (typename SequenceIterator::item_t, hb_codepoint_t))>
|
||||||
bool serialize (hb_serialize_context_t *c,
|
bool serialize (hb_serialize_context_t *c,
|
||||||
hb_sorted_array_t<const HBGlyphID16> glyphs,
|
GlyphIterator glyphs,
|
||||||
hb_array_t<const unsigned int> substitute_len_list,
|
SequenceIterator sequences)
|
||||||
hb_array_t<const HBGlyphID16> substitute_glyphs_list)
|
|
||||||
{
|
{
|
||||||
TRACE_SERIALIZE (this);
|
TRACE_SERIALIZE (this);
|
||||||
if (unlikely (!c->extend_min (this))) return_trace (false);
|
if (unlikely (!c->extend_min (this))) return_trace (false);
|
||||||
if (unlikely (!sequence.serialize (c, glyphs.length))) return_trace (false);
|
if (unlikely (!sequence.serialize (c, glyphs.length))) return_trace (false);
|
||||||
for (unsigned int i = 0; i < glyphs.length; i++)
|
|
||||||
|
for (auto& pair : hb_zip (sequences, sequence))
|
||||||
{
|
{
|
||||||
unsigned int substitute_len = substitute_len_list[i];
|
if (unlikely (!pair.second
|
||||||
if (unlikely (!sequence[i]
|
.serialize_serialize (c, pair.first)))
|
||||||
.serialize_serialize (c, substitute_glyphs_list.sub_array (0, substitute_len))))
|
|
||||||
return_trace (false);
|
return_trace (false);
|
||||||
substitute_glyphs_list += substitute_len;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return_trace (coverage.serialize_serialize (c, glyphs));
|
return_trace (coverage.serialize_serialize (c, glyphs));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -119,19 +119,20 @@ struct SubstLookup : Lookup
|
||||||
return_trace (false);
|
return_trace (false);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool serialize_multiple (hb_serialize_context_t *c,
|
template<typename GlyphIterator, typename SequenceIterator,
|
||||||
uint32_t lookup_props,
|
hb_requires (hb_is_sorted_source_of (GlyphIterator, hb_codepoint_t)),
|
||||||
hb_sorted_array_t<const HBGlyphID16> glyphs,
|
hb_requires (hb_is_source_of (typename SequenceIterator::item_t, hb_codepoint_t))>
|
||||||
hb_array_t<const unsigned int> substitute_len_list,
|
bool serialize (hb_serialize_context_t *c,
|
||||||
hb_array_t<const HBGlyphID16> substitute_glyphs_list)
|
uint32_t lookup_props,
|
||||||
|
GlyphIterator glyphs,
|
||||||
|
SequenceIterator sequences)
|
||||||
{
|
{
|
||||||
TRACE_SERIALIZE (this);
|
TRACE_SERIALIZE (this);
|
||||||
if (unlikely (!Lookup::serialize (c, SubTable::Multiple, lookup_props, 1))) return_trace (false);
|
if (unlikely (!Lookup::serialize (c, SubTable::Multiple, lookup_props, 1))) return_trace (false);
|
||||||
if (c->push<SubTable> ()->u.multiple.
|
if (c->push<SubTable> ()->u.multiple.
|
||||||
serialize (c,
|
serialize (c,
|
||||||
glyphs,
|
glyphs,
|
||||||
substitute_len_list,
|
sequences))
|
||||||
substitute_glyphs_list))
|
|
||||||
{
|
{
|
||||||
c->add_link (get_subtables<SubTable> ()[0], c->pop_pack ());
|
c->add_link (get_subtables<SubTable> ()[0], c->pop_pack ());
|
||||||
return_trace (true);
|
return_trace (true);
|
||||||
|
|
Loading…
Reference in New Issue