[OTLayout] More Extension templatizing

This commit is contained in:
Behdad Esfahbod 2012-11-23 17:10:40 -05:00
parent 7dddd4e72b
commit ed2e135944
3 changed files with 10 additions and 24 deletions

View File

@ -1249,8 +1249,6 @@ struct ChainContextPos : ChainContext {};
struct ExtensionPos : Extension<ExtensionPos>
{
typedef struct PosLookupSubTable LookupSubTable;
inline bool sanitize (hb_sanitize_context_t *c);
};
@ -1517,15 +1515,6 @@ GPOS::position_finish (hb_font_t *font HB_UNUSED, hb_buffer_t *buffer, hb_bool_t
/* Out-of-class implementation for methods recursing */
inline bool ExtensionPos::sanitize (hb_sanitize_context_t *c)
{
TRACE_SANITIZE (this);
if (unlikely (!Extension::sanitize (c))) return TRACE_RETURN (false);
unsigned int offset = get_offset ();
if (unlikely (!offset)) return TRACE_RETURN (true);
return TRACE_RETURN (StructAtOffset<PosLookupSubTable> (this, offset).sanitize (c, get_type ()));
}
inline bool PosLookup::apply_recurse_func (hb_apply_context_t *c, unsigned int lookup_index)
{
const GPOS &gpos = *(hb_ot_layout_from_face (c->face)->gpos);

View File

@ -882,8 +882,6 @@ struct ExtensionSubst : Extension<ExtensionSubst>
{
typedef struct SubstLookupSubTable LookupSubTable;
inline bool sanitize (hb_sanitize_context_t *c);
inline bool is_reverse (void) const;
};
@ -1372,15 +1370,6 @@ GSUB::substitute_finish (hb_font_t *font HB_UNUSED, hb_buffer_t *buffer HB_UNUSE
/* Out-of-class implementation for methods recursing */
inline bool ExtensionSubst::sanitize (hb_sanitize_context_t *c)
{
TRACE_SANITIZE (this);
if (unlikely (!Extension::sanitize (c))) return TRACE_RETURN (false);
unsigned int offset = get_offset ();
if (unlikely (!offset)) return TRACE_RETURN (true);
return TRACE_RETURN (StructAtOffset<SubstLookupSubTable> (this, offset).sanitize (c, get_type ()));
}
inline bool ExtensionSubst::is_reverse (void) const
{
unsigned int type = get_type ();

View File

@ -1794,10 +1794,10 @@ struct Extension
template <typename context_t>
inline typename context_t::return_t process (context_t *c) const
{
return CastP<T>(this)->get_subtable<typename T::LookupSubTable> ().process (c, get_type ());
return get_subtable<typename T::LookupSubTable> ().process (c, get_type ());
}
inline bool sanitize (hb_sanitize_context_t *c) {
inline bool sanitize_self (hb_sanitize_context_t *c) {
TRACE_SANITIZE (this);
if (!u.format.sanitize (c)) return TRACE_RETURN (false);
switch (u.format) {
@ -1806,6 +1806,14 @@ struct Extension
}
}
inline bool sanitize (hb_sanitize_context_t *c) {
TRACE_SANITIZE (this);
if (!sanitize_self (c)) return TRACE_RETURN (false);
unsigned int offset = get_offset ();
if (unlikely (!offset)) return TRACE_RETURN (true);
return TRACE_RETURN (StructAtOffset<typename T::LookupSubTable> (this, offset).sanitize (c, get_type ()));
}
protected:
union {
USHORT format; /* Format identifier */