[arrays] Rename Supplier to hb_supplier_t

This commit is contained in:
Behdad Esfahbod 2018-12-17 22:36:23 -05:00
parent 6b5eaa7530
commit cf39c24205
8 changed files with 87 additions and 87 deletions

View File

@ -269,10 +269,10 @@ inline hb_sorted_array_t<T> hb_sorted_array (T *array, unsigned int len)
typedef hb_array_t<const char> hb_bytes_t;
template <typename Type> struct Supplier : hb_array_t<const Type>
template <typename Type> struct hb_supplier_t : hb_array_t<const Type>
{
Supplier (const Type *array, unsigned int len) : hb_array_t<const Type> (array, len) {}
Supplier (hb_array_t<const Type> v) : hb_array_t<const Type> (v) {}
hb_supplier_t (const Type *array, unsigned int len) : hb_array_t<const Type> (array, len) {}
hb_supplier_t (hb_array_t<const Type> v) : hb_array_t<const Type> (v) {}
};

View File

@ -647,7 +647,7 @@ _hb_face_builder_data_reference_blob (hb_face_builder_data_t *data)
bool is_cff = data->tables.lsearch (HB_TAG ('C','F','F',' ')) || data->tables.lsearch (HB_TAG ('C','F','F','2'));
hb_tag_t sfnt_tag = is_cff ? OT::OpenTypeFontFile::CFFTag : OT::OpenTypeFontFile::TrueTypeTag;
Supplier<hb_face_builder_data_t::table_entry_t> supplier (data->tables);
hb_supplier_t<hb_face_builder_data_t::table_entry_t> supplier (data->tables);
bool ret = f->serialize_single (&c,
sfnt_tag,
supplier,

View File

@ -121,7 +121,7 @@ typedef struct OffsetTable
template <typename item_t>
bool serialize (hb_serialize_context_t *c,
hb_tag_t sfnt_tag,
Supplier<item_t> &items,
hb_supplier_t<item_t> &items,
unsigned int table_count)
{
TRACE_SERIALIZE (this);
@ -485,7 +485,7 @@ struct OpenTypeFontFile
template <typename item_t>
bool serialize_single (hb_serialize_context_t *c,
hb_tag_t sfnt_tag,
Supplier<item_t> &items,
hb_supplier_t<item_t> &items,
unsigned int table_count)
{
TRACE_SERIALIZE (this);

View File

@ -554,7 +554,7 @@ struct ArrayOf
return_trace (true);
}
bool serialize (hb_serialize_context_t *c,
Supplier<Type> &items,
hb_supplier_t<Type> &items,
unsigned int items_len)
{
TRACE_SERIALIZE (this);
@ -701,7 +701,7 @@ struct HeadlessArrayOf
{ return lenP1.static_size + (lenP1 ? lenP1 - 1 : 0) * Type::static_size; }
bool serialize (hb_serialize_context_t *c,
Supplier<Type> &items,
hb_supplier_t<Type> &items,
unsigned int items_len)
{
TRACE_SERIALIZE (this);

View File

@ -495,7 +495,7 @@ struct CmapSubtableLongSegmented
{
TRACE_SERIALIZE (this);
if (unlikely (!c->extend_min (*this))) return_trace (false);
Supplier<CmapSubtableLongGroup> supplier (group_data);
hb_supplier_t<CmapSubtableLongGroup> supplier (group_data);
if (unlikely (!groups.serialize (c, supplier, group_data.len))) return_trace (false);
return true;
}

View File

@ -827,7 +827,7 @@ struct CoverageFormat1
}
bool serialize (hb_serialize_context_t *c,
Supplier<GlyphID> &glyphs,
hb_supplier_t<GlyphID> &glyphs,
unsigned int num_glyphs)
{
TRACE_SERIALIZE (this);
@ -902,7 +902,7 @@ struct CoverageFormat2
}
bool serialize (hb_serialize_context_t *c,
Supplier<GlyphID> &glyphs,
hb_supplier_t<GlyphID> &glyphs,
unsigned int num_glyphs)
{
TRACE_SERIALIZE (this);
@ -1051,7 +1051,7 @@ struct Coverage
}
bool serialize (hb_serialize_context_t *c,
Supplier<GlyphID> &glyphs,
hb_supplier_t<GlyphID> &glyphs,
unsigned int num_glyphs)
{
TRACE_SERIALIZE (this);
@ -1189,8 +1189,8 @@ struct Coverage
*/
static inline void ClassDef_serialize (hb_serialize_context_t *c,
Supplier<GlyphID> &glyphs,
Supplier<HBUINT16> &klasses,
hb_supplier_t<GlyphID> &glyphs,
hb_supplier_t<HBUINT16> &klasses,
unsigned int num_glyphs);
struct ClassDefFormat1
@ -1204,8 +1204,8 @@ struct ClassDefFormat1
}
bool serialize (hb_serialize_context_t *c,
Supplier<HBUINT16> &glyphs,
Supplier<HBUINT16> &klasses,
hb_supplier_t<HBUINT16> &glyphs,
hb_supplier_t<HBUINT16> &klasses,
unsigned int num_glyphs)
{
TRACE_SERIALIZE (this);
@ -1256,8 +1256,8 @@ struct ClassDefFormat1
}
c->serializer->err (glyphs.in_error () || klasses.in_error ());
Supplier<GlyphID> glyphs_supplier (glyphs);
Supplier<HBUINT16> klasses_supplier (klasses);
hb_supplier_t<GlyphID> glyphs_supplier (glyphs);
hb_supplier_t<HBUINT16> klasses_supplier (klasses);
ClassDef_serialize (c->serializer,
glyphs_supplier,
klasses_supplier,
@ -1352,8 +1352,8 @@ struct ClassDefFormat2
}
bool serialize (hb_serialize_context_t *c,
Supplier<HBUINT16> &glyphs,
Supplier<HBUINT16> &klasses,
hb_supplier_t<HBUINT16> &glyphs,
hb_supplier_t<HBUINT16> &klasses,
unsigned int num_glyphs)
{
TRACE_SERIALIZE (this);
@ -1415,8 +1415,8 @@ struct ClassDefFormat2
}
c->serializer->err (glyphs.in_error () || klasses.in_error ());
Supplier<GlyphID> glyphs_supplier (glyphs);
Supplier<HBUINT16> klasses_supplier (klasses);
hb_supplier_t<GlyphID> glyphs_supplier (glyphs);
hb_supplier_t<HBUINT16> klasses_supplier (klasses);
ClassDef_serialize (c->serializer,
glyphs_supplier,
klasses_supplier,
@ -1509,8 +1509,8 @@ struct ClassDef
}
bool serialize (hb_serialize_context_t *c,
Supplier<GlyphID> &glyphs,
Supplier<HBUINT16> &klasses,
hb_supplier_t<GlyphID> &glyphs,
hb_supplier_t<HBUINT16> &klasses,
unsigned int num_glyphs)
{
TRACE_SERIALIZE (this);
@ -1610,8 +1610,8 @@ struct ClassDef
};
static inline void ClassDef_serialize (hb_serialize_context_t *c,
Supplier<GlyphID> &glyphs,
Supplier<HBUINT16> &klasses,
hb_supplier_t<GlyphID> &glyphs,
hb_supplier_t<HBUINT16> &klasses,
unsigned int num_glyphs)
{
c->start_embed<ClassDef> ()->serialize (c,

View File

@ -36,8 +36,8 @@ namespace OT {
static inline void SingleSubst_serialize (hb_serialize_context_t *c,
Supplier<GlyphID> &glyphs,
Supplier<GlyphID> &substitutes,
hb_supplier_t<GlyphID> &glyphs,
hb_supplier_t<GlyphID> &substitutes,
unsigned int num_glyphs);
struct SingleSubstFormat1
@ -95,7 +95,7 @@ struct SingleSubstFormat1
}
bool serialize (hb_serialize_context_t *c,
Supplier<GlyphID> &glyphs,
hb_supplier_t<GlyphID> &glyphs,
unsigned int num_glyphs,
int delta)
{
@ -122,8 +122,8 @@ struct SingleSubstFormat1
}
c->serializer->err (from.in_error () || to.in_error ());
Supplier<GlyphID> from_supplier (from);
Supplier<GlyphID> to_supplier (to);
hb_supplier_t<GlyphID> from_supplier (from);
hb_supplier_t<GlyphID> to_supplier (to);
SingleSubst_serialize (c->serializer,
from_supplier,
to_supplier,
@ -201,8 +201,8 @@ struct SingleSubstFormat2
}
bool serialize (hb_serialize_context_t *c,
Supplier<GlyphID> &glyphs,
Supplier<GlyphID> &substitutes,
hb_supplier_t<GlyphID> &glyphs,
hb_supplier_t<GlyphID> &substitutes,
unsigned int num_glyphs)
{
TRACE_SERIALIZE (this);
@ -227,8 +227,8 @@ struct SingleSubstFormat2
}
c->serializer->err (from.in_error () || to.in_error ());
Supplier<GlyphID> from_supplier (from);
Supplier<GlyphID> to_supplier (to);
hb_supplier_t<GlyphID> from_supplier (from);
hb_supplier_t<GlyphID> to_supplier (to);
SingleSubst_serialize (c->serializer,
from_supplier,
to_supplier,
@ -257,8 +257,8 @@ struct SingleSubstFormat2
struct SingleSubst
{
bool serialize (hb_serialize_context_t *c,
Supplier<GlyphID> &glyphs,
Supplier<GlyphID> &substitutes,
hb_supplier_t<GlyphID> &glyphs,
hb_supplier_t<GlyphID> &substitutes,
unsigned int num_glyphs)
{
TRACE_SERIALIZE (this);
@ -305,8 +305,8 @@ struct SingleSubst
static inline void
SingleSubst_serialize (hb_serialize_context_t *c,
Supplier<GlyphID> &glyphs,
Supplier<GlyphID> &substitutes,
hb_supplier_t<GlyphID> &glyphs,
hb_supplier_t<GlyphID> &substitutes,
unsigned int num_glyphs)
{
c->start_embed<SingleSubst> ()->serialize (c,
@ -364,7 +364,7 @@ struct Sequence
}
bool serialize (hb_serialize_context_t *c,
Supplier<GlyphID> &glyphs,
hb_supplier_t<GlyphID> &glyphs,
unsigned int num_glyphs)
{
TRACE_SERIALIZE (this);
@ -432,10 +432,10 @@ struct MultipleSubstFormat1
}
bool serialize (hb_serialize_context_t *c,
Supplier<GlyphID> &glyphs,
Supplier<unsigned int> &substitute_len_list,
hb_supplier_t<GlyphID> &glyphs,
hb_supplier_t<unsigned int> &substitute_len_list,
unsigned int num_glyphs,
Supplier<GlyphID> &substitute_glyphs_list)
hb_supplier_t<GlyphID> &substitute_glyphs_list)
{
TRACE_SERIALIZE (this);
if (unlikely (!c->extend_min (*this))) return_trace (false);
@ -477,10 +477,10 @@ struct MultipleSubstFormat1
struct MultipleSubst
{
bool serialize (hb_serialize_context_t *c,
Supplier<GlyphID> &glyphs,
Supplier<unsigned int> &substitute_len_list,
hb_supplier_t<GlyphID> &glyphs,
hb_supplier_t<unsigned int> &substitute_len_list,
unsigned int num_glyphs,
Supplier<GlyphID> &substitute_glyphs_list)
hb_supplier_t<GlyphID> &substitute_glyphs_list)
{
TRACE_SERIALIZE (this);
if (unlikely (!c->extend_min (u.format))) return_trace (false);
@ -552,7 +552,7 @@ struct AlternateSet
}
bool serialize (hb_serialize_context_t *c,
Supplier<GlyphID> &glyphs,
hb_supplier_t<GlyphID> &glyphs,
unsigned int num_glyphs)
{
TRACE_SERIALIZE (this);
@ -625,10 +625,10 @@ struct AlternateSubstFormat1
}
bool serialize (hb_serialize_context_t *c,
Supplier<GlyphID> &glyphs,
Supplier<unsigned int> &alternate_len_list,
hb_supplier_t<GlyphID> &glyphs,
hb_supplier_t<unsigned int> &alternate_len_list,
unsigned int num_glyphs,
Supplier<GlyphID> &alternate_glyphs_list)
hb_supplier_t<GlyphID> &alternate_glyphs_list)
{
TRACE_SERIALIZE (this);
if (unlikely (!c->extend_min (*this))) return_trace (false);
@ -670,10 +670,10 @@ struct AlternateSubstFormat1
struct AlternateSubst
{
bool serialize (hb_serialize_context_t *c,
Supplier<GlyphID> &glyphs,
Supplier<unsigned int> &alternate_len_list,
hb_supplier_t<GlyphID> &glyphs,
hb_supplier_t<unsigned int> &alternate_len_list,
unsigned int num_glyphs,
Supplier<GlyphID> &alternate_glyphs_list)
hb_supplier_t<GlyphID> &alternate_glyphs_list)
{
TRACE_SERIALIZE (this);
if (unlikely (!c->extend_min (u.format))) return_trace (false);
@ -786,7 +786,7 @@ struct Ligature
bool serialize (hb_serialize_context_t *c,
GlyphID ligature,
Supplier<GlyphID> &components, /* Starting from second */
hb_supplier_t<GlyphID> &components, /* Starting from second */
unsigned int num_components /* Including first component */)
{
TRACE_SERIALIZE (this);
@ -867,10 +867,10 @@ struct LigatureSet
}
bool serialize (hb_serialize_context_t *c,
Supplier<GlyphID> &ligatures,
Supplier<unsigned int> &component_count_list,
hb_supplier_t<GlyphID> &ligatures,
hb_supplier_t<unsigned int> &component_count_list,
unsigned int num_ligatures,
Supplier<GlyphID> &component_list /* Starting from second for each ligature */)
hb_supplier_t<GlyphID> &component_list /* Starting from second for each ligature */)
{
TRACE_SERIALIZE (this);
if (unlikely (!c->extend_min (*this))) return_trace (false);
@ -965,12 +965,12 @@ struct LigatureSubstFormat1
}
bool serialize (hb_serialize_context_t *c,
Supplier<GlyphID> &first_glyphs,
Supplier<unsigned int> &ligature_per_first_glyph_count_list,
hb_supplier_t<GlyphID> &first_glyphs,
hb_supplier_t<unsigned int> &ligature_per_first_glyph_count_list,
unsigned int num_first_glyphs,
Supplier<GlyphID> &ligatures_list,
Supplier<unsigned int> &component_count_list,
Supplier<GlyphID> &component_list /* Starting from second for each ligature */)
hb_supplier_t<GlyphID> &ligatures_list,
hb_supplier_t<unsigned int> &component_count_list,
hb_supplier_t<GlyphID> &component_list /* Starting from second for each ligature */)
{
TRACE_SERIALIZE (this);
if (unlikely (!c->extend_min (*this))) return_trace (false);
@ -1014,12 +1014,12 @@ struct LigatureSubstFormat1
struct LigatureSubst
{
bool serialize (hb_serialize_context_t *c,
Supplier<GlyphID> &first_glyphs,
Supplier<unsigned int> &ligature_per_first_glyph_count_list,
hb_supplier_t<GlyphID> &first_glyphs,
hb_supplier_t<unsigned int> &ligature_per_first_glyph_count_list,
unsigned int num_first_glyphs,
Supplier<GlyphID> &ligatures_list,
Supplier<unsigned int> &component_count_list,
Supplier<GlyphID> &component_list /* Starting from second for each ligature */)
hb_supplier_t<GlyphID> &ligatures_list,
hb_supplier_t<unsigned int> &component_count_list,
hb_supplier_t<GlyphID> &component_list /* Starting from second for each ligature */)
{
TRACE_SERIALIZE (this);
if (unlikely (!c->extend_min (u.format))) return_trace (false);
@ -1372,8 +1372,8 @@ struct SubstLookup : Lookup
bool serialize_single (hb_serialize_context_t *c,
uint32_t lookup_props,
Supplier<GlyphID> &glyphs,
Supplier<GlyphID> &substitutes,
hb_supplier_t<GlyphID> &glyphs,
hb_supplier_t<GlyphID> &substitutes,
unsigned int num_glyphs)
{
TRACE_SERIALIZE (this);
@ -1383,10 +1383,10 @@ struct SubstLookup : Lookup
bool serialize_multiple (hb_serialize_context_t *c,
uint32_t lookup_props,
Supplier<GlyphID> &glyphs,
Supplier<unsigned int> &substitute_len_list,
hb_supplier_t<GlyphID> &glyphs,
hb_supplier_t<unsigned int> &substitute_len_list,
unsigned int num_glyphs,
Supplier<GlyphID> &substitute_glyphs_list)
hb_supplier_t<GlyphID> &substitute_glyphs_list)
{
TRACE_SERIALIZE (this);
if (unlikely (!Lookup::serialize (c, SubTable::Multiple, lookup_props, 1))) return_trace (false);
@ -1399,10 +1399,10 @@ struct SubstLookup : Lookup
bool serialize_alternate (hb_serialize_context_t *c,
uint32_t lookup_props,
Supplier<GlyphID> &glyphs,
Supplier<unsigned int> &alternate_len_list,
hb_supplier_t<GlyphID> &glyphs,
hb_supplier_t<unsigned int> &alternate_len_list,
unsigned int num_glyphs,
Supplier<GlyphID> &alternate_glyphs_list)
hb_supplier_t<GlyphID> &alternate_glyphs_list)
{
TRACE_SERIALIZE (this);
if (unlikely (!Lookup::serialize (c, SubTable::Alternate, lookup_props, 1))) return_trace (false);
@ -1415,12 +1415,12 @@ struct SubstLookup : Lookup
bool serialize_ligature (hb_serialize_context_t *c,
uint32_t lookup_props,
Supplier<GlyphID> &first_glyphs,
Supplier<unsigned int> &ligature_per_first_glyph_count_list,
hb_supplier_t<GlyphID> &first_glyphs,
hb_supplier_t<unsigned int> &ligature_per_first_glyph_count_list,
unsigned int num_first_glyphs,
Supplier<GlyphID> &ligatures_list,
Supplier<unsigned int> &component_count_list,
Supplier<GlyphID> &component_list /* Starting from second for each ligature */)
hb_supplier_t<GlyphID> &ligatures_list,
hb_supplier_t<unsigned int> &component_count_list,
hb_supplier_t<GlyphID> &component_list /* Starting from second for each ligature */)
{
TRACE_SERIALIZE (this);
if (unlikely (!Lookup::serialize (c, SubTable::Ligature, lookup_props, 1))) return_trace (false);

View File

@ -79,8 +79,8 @@ arabic_fallback_synthesize_lookup_single (const hb_ot_shape_plan_t *plan HB_UNUS
* May not be good-enough for presidential candidate interviews, but good-enough for us... */
hb_stable_sort (&glyphs[0], num_glyphs, (int(*)(const OT::GlyphID*, const OT::GlyphID *)) OT::GlyphID::cmp, &substitutes[0]);
Supplier<OT::GlyphID> glyphs_supplier (glyphs, num_glyphs);
Supplier<OT::GlyphID> substitutes_supplier (substitutes, num_glyphs);
hb_supplier_t<OT::GlyphID> glyphs_supplier (glyphs, num_glyphs);
hb_supplier_t<OT::GlyphID> substitutes_supplier (substitutes, num_glyphs);
/* Each glyph takes four bytes max, and there's some overhead. */
char buf[(SHAPING_TABLE_LAST - SHAPING_TABLE_FIRST + 1) * 4 + 128];
@ -155,11 +155,11 @@ arabic_fallback_synthesize_lookup_ligature (const hb_ot_shape_plan_t *plan HB_UN
if (!num_ligatures)
return nullptr;
Supplier<OT::GlyphID> first_glyphs_supplier (first_glyphs, num_first_glyphs);
Supplier<unsigned int> ligature_per_first_glyph_count_supplier (ligature_per_first_glyph_count_list, num_first_glyphs);
Supplier<OT::GlyphID> ligatures_supplier (ligature_list, num_ligatures);
Supplier<unsigned int> component_count_supplier (component_count_list, num_ligatures);
Supplier<OT::GlyphID> component_supplier (component_list, num_ligatures);
hb_supplier_t<OT::GlyphID> first_glyphs_supplier (first_glyphs, num_first_glyphs);
hb_supplier_t<unsigned int> ligature_per_first_glyph_count_supplier (ligature_per_first_glyph_count_list, num_first_glyphs);
hb_supplier_t<OT::GlyphID> ligatures_supplier (ligature_list, num_ligatures);
hb_supplier_t<unsigned int> component_count_supplier (component_count_list, num_ligatures);
hb_supplier_t<OT::GlyphID> component_supplier (component_list, num_ligatures);
/* 16 bytes per ligature ought to be enough... */
char buf[ARRAY_LENGTH_CONST (ligature_list) * 16 + 128];