struct ExtensionSubst : Extension<ExtensionSubst>
{
- typedef struct SubstLookupSubTable LookupSubTable;
+ typedef struct SubstLookupSubTable SubTable;
inline bool is_reverse (void) const;
};
struct SubstLookup : Lookup
{
- inline const SubstLookupSubTable& get_subtable (unsigned int i) const
- { return Lookup::get_subtable<SubstLookupSubTable> (i); }
+ typedef SubstLookupSubTable SubTable;
+
+ inline const SubTable& get_subtable (unsigned int i) const
+ { return Lookup::get_subtable<SubTable> (i); }
inline static bool lookup_type_is_reverse (unsigned int lookup_type)
- { return lookup_type == SubstLookupSubTable::ReverseChainSingle; }
+ { return lookup_type == SubTable::ReverseChainSingle; }
inline bool is_reverse (void) const
{
unsigned int type = get_type ();
- if (unlikely (type == SubstLookupSubTable::Extension))
+ if (unlikely (type == SubTable::Extension))
return CastR<ExtensionSubst> (get_subtable(0)).is_reverse ();
return lookup_type_is_reverse (type);
}
static bool apply_recurse_func (hb_ot_apply_context_t *c, unsigned int lookup_index);
- inline SubstLookupSubTable& serialize_subtable (hb_serialize_context_t *c,
- unsigned int i)
- { return get_subtables<SubstLookupSubTable> ()[i].serialize (c, this); }
+ inline SubTable& serialize_subtable (hb_serialize_context_t *c,
+ unsigned int i)
+ { return get_subtables<SubTable> ()[i].serialize (c, this); }
inline bool serialize_single (hb_serialize_context_t *c,
uint32_t lookup_props,
unsigned int num_glyphs)
{
TRACE_SERIALIZE (this);
- if (unlikely (!Lookup::serialize (c, SubstLookupSubTable::Single, lookup_props, 1))) return_trace (false);
+ if (unlikely (!Lookup::serialize (c, SubTable::Single, lookup_props, 1))) return_trace (false);
return_trace (serialize_subtable (c, 0).u.single.serialize (c, glyphs, substitutes, num_glyphs));
}
Supplier<GlyphID> &substitute_glyphs_list)
{
TRACE_SERIALIZE (this);
- if (unlikely (!Lookup::serialize (c, SubstLookupSubTable::Multiple, lookup_props, 1))) return_trace (false);
+ if (unlikely (!Lookup::serialize (c, SubTable::Multiple, lookup_props, 1))) return_trace (false);
return_trace (serialize_subtable (c, 0).u.multiple.serialize (c,
glyphs,
substitute_len_list,
Supplier<GlyphID> &alternate_glyphs_list)
{
TRACE_SERIALIZE (this);
- if (unlikely (!Lookup::serialize (c, SubstLookupSubTable::Alternate, lookup_props, 1))) return_trace (false);
+ if (unlikely (!Lookup::serialize (c, SubTable::Alternate, lookup_props, 1))) return_trace (false);
return_trace (serialize_subtable (c, 0).u.alternate.serialize (c,
glyphs,
alternate_len_list,
Supplier<GlyphID> &component_list /* Starting from second for each ligature */)
{
TRACE_SERIALIZE (this);
- if (unlikely (!Lookup::serialize (c, SubstLookupSubTable::Ligature, lookup_props, 1))) return_trace (false);
+ if (unlikely (!Lookup::serialize (c, SubTable::Ligature, lookup_props, 1))) return_trace (false);
return_trace (serialize_subtable (c, 0).u.ligature.serialize (c,
first_glyphs,
ligature_per_first_glyph_count_list,
template <typename context_t>
inline typename context_t::return_t dispatch (context_t *c) const
- { return Lookup::dispatch<SubstLookupSubTable> (c); }
+ { return Lookup::dispatch<SubTable> (c); }
+
+ inline bool subset (hb_subset_context_t *c) const
+ {
+ return false; //XXX
+ }
inline bool sanitize (hb_sanitize_context_t *c) const
{
if (unlikely (!Lookup::sanitize (c))) return_trace (false);
if (unlikely (!dispatch (c))) return_trace (false);
- if (unlikely (get_type () == SubstLookupSubTable::Extension))
+ if (unlikely (get_type () == SubTable::Extension))
{
/* The spec says all subtables of an Extension lookup should
* have the same type, which shall not be the Extension type
inline bool subset (hb_subset_context_t *c) const
{
TRACE_SUBSET (this);
- //struct GSUB *out = c->serializer->start_embed<GSUB> ();
- if (unlikely (!GSUBGPOS::subset (c))) return_trace (false);
- //const OffsetTo<SubstLookupList> &list = CastR<const OffsetTo<SubstLookupList> > (lookupList);
- //OffsetTo<SubstLookupList> &outList = CastR<OffsetTo<SubstLookupList> > (out->lookupList);
- //outList.set (0);
- //outList.serialize_subset (c, this+list, out);
- /* TODO Use intersects() to count how many subtables survive? */
- return_trace (true);
+ return_trace (GSUBGPOS::subset<SubstLookup> (c));
}
inline bool sanitize (hb_sanitize_context_t *c) const
/*static*/ inline bool ExtensionSubst::is_reverse (void) const
{
unsigned int type = get_type ();
- if (unlikely (type == SubstLookupSubTable::Extension))
- return CastR<ExtensionSubst> (get_subtable<LookupSubTable>()).is_reverse ();
+ if (unlikely (type == SubTable::Extension))
+ return CastR<ExtensionSubst> (get_subtable<SubTable>()).is_reverse ();
return SubstLookup::lookup_type_is_reverse (type);
}
inline const X& get_subtable (void) const
{
unsigned int offset = extensionOffset;
- if (unlikely (!offset)) return Null(typename T::LookupSubTable);
- return StructAtOffset<typename T::LookupSubTable> (this, offset);
+ if (unlikely (!offset)) return Null(typename T::SubTable);
+ return StructAtOffset<typename T::SubTable> (this, offset);
}
template <typename context_t>
{
TRACE_DISPATCH (this, format);
if (unlikely (!c->may_dispatch (this, this))) return_trace (c->no_dispatch_return_value ());
- return_trace (get_subtable<typename T::LookupSubTable> ().dispatch (c, get_type ()));
+ return_trace (get_subtable<typename T::SubTable> ().dispatch (c, get_type ()));
}
/* This is called from may_dispatch() above with hb_sanitize_context_t. */
TRACE_SANITIZE (this);
return_trace (c->check_struct (this) &&
extensionOffset != 0 &&
- extensionLookupType != T::LookupSubTable::Extension);
+ extensionLookupType != T::SubTable::Extension);
}
protected:
inline const X& get_subtable (void) const
{
switch (u.format) {
- case 1: return u.format1.template get_subtable<typename T::LookupSubTable> ();
- default:return Null(typename T::LookupSubTable);
+ case 1: return u.format1.template get_subtable<typename T::SubTable> ();
+ default:return Null(typename T::SubTable);
}
}
return get_feature (feature_index);
}
+ template <typename TLookup>
inline bool subset (hb_subset_context_t *c) const
{
TRACE_SUBSET (this);
if (unlikely (!out)) return_trace (false);
out->scriptList.serialize_subset (c, this+scriptList, out);
out->featureList.serialize_subset (c, this+featureList, out);
- out->lookupList.set (0); /* GSUB/GPOS fill this one in. */
+
+ typedef OffsetListOf<TLookup> TLookupList;
+ /* TODO Use intersects() to count how many subtables survive? */
+ CastR<OffsetTo<TLookupList> > (out->lookupList)
+ .serialize_subset (c,
+ this+CastR<const OffsetTo<TLookupList> > (lookupList),
+ out);
+
if (version.to_int () >= 0x00010001u)
out->featureVars.serialize_subset (c, this+featureVars, out);
return_trace (true);