struct SingleSubstFormat1
{
- friend struct SingleSubst;
-
- private:
-
inline void closure (hb_closure_context_t *c) const
{
TRACE_CLOSURE ();
struct SingleSubstFormat2
{
- friend struct SingleSubst;
-
- private:
-
inline void closure (hb_closure_context_t *c) const
{
TRACE_CLOSURE ();
struct SingleSubst
{
- friend struct SubstLookupSubTable;
- friend struct SubstLookup;
-
- private:
-
- inline void closure (hb_closure_context_t *c) const
+ template <typename context_t>
+ inline typename context_t::return_t process (context_t *c) const
{
- TRACE_CLOSURE ();
switch (u.format) {
- case 1: u.format1.closure (c); break;
- case 2: u.format2.closure (c); break;
- default: break;
- }
- }
-
- inline void collect_glyphs (hb_collect_glyphs_context_t *c) const
- {
- TRACE_CLOSURE ();
- switch (u.format) {
- case 1: u.format1.collect_glyphs (c); break;
- case 2: u.format2.collect_glyphs (c); break;
- default: break;
+ case 1: return c->process (u.format1);
+ case 2: return c->process (u.format2);
+ default:return c->default_return_value;
}
}
struct Sequence
{
- friend struct MultipleSubstFormat1;
-
- private:
-
inline void closure (hb_closure_context_t *c) const
{
TRACE_CLOSURE ();
return TRACE_RETURN (true);
}
- public:
inline bool sanitize (hb_sanitize_context_t *c) {
TRACE_SANITIZE ();
return TRACE_RETURN (substitute.sanitize (c));
struct MultipleSubstFormat1
{
- friend struct MultipleSubst;
-
- private:
-
inline void closure (hb_closure_context_t *c) const
{
TRACE_CLOSURE ();
struct MultipleSubst
{
- friend struct SubstLookupSubTable;
- friend struct SubstLookup;
-
- private:
-
- inline void closure (hb_closure_context_t *c) const
- {
- TRACE_CLOSURE ();
- switch (u.format) {
- case 1: u.format1.closure (c); break;
- default: break;
- }
- }
-
- inline void collect_glyphs (hb_collect_glyphs_context_t *c) const
+ template <typename context_t>
+ inline typename context_t::return_t process (context_t *c) const
{
switch (u.format) {
- case 1: u.format1.collect_glyphs (c); break;
- default: break;
+ case 1: return c->process (u.format1);
+ default:return c->default_return_value;
}
}
struct AlternateSubstFormat1
{
- friend struct AlternateSubst;
-
- private:
-
inline void closure (hb_closure_context_t *c) const
{
TRACE_CLOSURE ();
struct AlternateSubst
{
- friend struct SubstLookupSubTable;
- friend struct SubstLookup;
-
- private:
-
- inline void closure (hb_closure_context_t *c) const
+ template <typename context_t>
+ inline typename context_t::return_t process (context_t *c) const
{
- TRACE_CLOSURE ();
switch (u.format) {
- case 1: u.format1.closure (c); break;
- default: break;
- }
- }
-
- inline void collect_glyphs (hb_collect_glyphs_context_t *c) const
- {
- switch (u.format) {
- case 1: u.format1.collect_glyphs (c); break;
- default: break;
+ case 1: return c->process (u.format1);
+ default:return c->default_return_value;
}
}
struct Ligature
{
- friend struct LigatureSet;
-
- private:
-
inline void closure (hb_closure_context_t *c) const
{
TRACE_CLOSURE ();
struct LigatureSet
{
- friend struct LigatureSubstFormat1;
-
- private:
-
inline void closure (hb_closure_context_t *c) const
{
TRACE_CLOSURE ();
return TRACE_RETURN (true);
}
- public:
inline bool sanitize (hb_sanitize_context_t *c) {
TRACE_SANITIZE ();
return TRACE_RETURN (ligature.sanitize (c, this));
struct LigatureSubstFormat1
{
- friend struct LigatureSubst;
-
- private:
-
inline void closure (hb_closure_context_t *c) const
{
TRACE_CLOSURE ();
struct LigatureSubst
{
- friend struct SubstLookupSubTable;
- friend struct SubstLookup;
-
- private:
-
- inline void closure (hb_closure_context_t *c) const
- {
- TRACE_CLOSURE ();
- switch (u.format) {
- case 1: u.format1.closure (c); break;
- default: break;
- }
- }
-
- inline void collect_glyphs (hb_collect_glyphs_context_t *c) const
+ template <typename context_t>
+ inline typename context_t::return_t process (context_t *c) const
{
switch (u.format) {
- case 1: u.format1.collect_glyphs (c); break;
- default: break;
+ case 1: return c->process (u.format1);
+ default:return c->default_return_value;
}
}
static inline bool substitute_lookup (hb_apply_context_t *c, unsigned int lookup_index);
-static inline void closure_lookup (hb_closure_context_t *c, unsigned int lookup_index);
-static inline void collect_glyphs_lookup (hb_collect_glyphs_context_t *c, unsigned int lookup_index);
struct ContextSubst : Context
{
- friend struct SubstLookupSubTable;
-
- private:
-
- inline void closure (hb_closure_context_t *c) const
+ template <typename context_t>
+ inline typename context_t::return_t process (context_t *c) const
{
- TRACE_CLOSURE ();
- return Context::closure (c, closure_lookup);
- }
-
- inline void collect_glyphs (hb_collect_glyphs_context_t *c) const
- {
- return Context::collect_glyphs (c, collect_glyphs_lookup);
+ return Context::process (c);
}
inline bool apply (hb_apply_context_t *c) const
struct ChainContextSubst : ChainContext
{
- friend struct SubstLookupSubTable;
-
- private:
-
- inline void closure (hb_closure_context_t *c) const
+ template <typename context_t>
+ inline typename context_t::return_t process (context_t *c) const
{
- TRACE_CLOSURE ();
- return ChainContext::closure (c, closure_lookup);
- }
-
- inline void collect_glyphs (hb_collect_glyphs_context_t *c) const
- {
- return ChainContext::collect_glyphs (c, collect_glyphs_lookup);
+ return ChainContext::process (c);
}
inline bool apply (hb_apply_context_t *c) const
struct ExtensionSubst : Extension
{
- friend struct SubstLookupSubTable;
- friend struct SubstLookup;
-
- private:
inline const struct SubstLookupSubTable& get_subtable (void) const
{
unsigned int offset = get_offset ();
return StructAtOffset<SubstLookupSubTable> (this, offset);
}
- inline void closure (hb_closure_context_t *c) const;
-
- inline void collect_glyphs (hb_collect_glyphs_context_t *c) const;
+ template <typename context_t>
+ inline typename context_t::return_t process (context_t *c) const;
inline const Coverage &get_coverage (void) const;
struct ReverseChainSingleSubstFormat1
{
- friend struct ReverseChainSingleSubst;
-
- private:
-
inline void closure (hb_closure_context_t *c) const
{
TRACE_CLOSURE ();
struct ReverseChainSingleSubst
{
- friend struct SubstLookupSubTable;
-
- private:
-
- inline void closure (hb_closure_context_t *c) const
- {
- TRACE_CLOSURE ();
- switch (u.format) {
- case 1: u.format1.closure (c); break;
- default: break;
- }
- }
-
- inline void collect_glyphs (hb_collect_glyphs_context_t *c) const
+ template <typename context_t>
+ inline typename context_t::return_t process (context_t *c) const
{
switch (u.format) {
- case 1: u.format1.collect_glyphs (c); break;
- default: break;
+ case 1: return c->process (u.format1);
+ default:return c->default_return_value;
}
}
ReverseChainSingle = 8
};
- inline void closure (hb_closure_context_t *c,
- unsigned int lookup_type) const
+ template <typename context_t>
+ inline typename context_t::return_t process (context_t *c, unsigned int lookup_type) const
{
- TRACE_CLOSURE ();
switch (lookup_type) {
- case Single: u.single.closure (c); break;
- case Multiple: u.multiple.closure (c); break;
- case Alternate: u.alternate.closure (c); break;
- case Ligature: u.ligature.closure (c); break;
- case Context: u.context.closure (c); break;
- case ChainContext: u.chainContext.closure (c); break;
- case Extension: u.extension.closure (c); break;
- case ReverseChainSingle: u.reverseChainContextSingle.closure (c); break;
- default: break;
- }
- }
-
- inline void collect_glyphs (hb_collect_glyphs_context_t *c,
- unsigned int lookup_type) const
- {
- switch (lookup_type) {
- case Single: u.single.collect_glyphs (c); break;
- case Multiple: u.multiple.collect_glyphs (c); break;
- case Alternate: u.alternate.collect_glyphs (c); break;
- case Ligature: u.ligature.collect_glyphs (c); break;
- case Context: u.context.collect_glyphs (c); break;
- case ChainContext: u.chainContext.collect_glyphs (c); break;
- case Extension: u.extension.collect_glyphs (c); break;
- case ReverseChainSingle: u.reverseChainContextSingle.collect_glyphs (c); break;
- default: break;
+ case Single: return u.single.process (c);
+ case Multiple: return u.multiple.process (c);
+ case Alternate: return u.alternate.process (c);
+ case Ligature: return u.ligature.process (c);
+ case Context: return u.context.process (c);
+ case ChainContext: return u.chainContext.process (c);
+ case Extension: return u.extension.process (c);
+ case ReverseChainSingle: return u.reverseChainContextSingle.process (c);
+ default: return c->default_return_value;
}
}
return lookup_type_is_reverse (type);
}
- inline void closure (hb_closure_context_t *c) const
+ template <typename context_t>
+ inline typename context_t::return_t process (context_t *c) const
{
unsigned int lookup_type = get_type ();
unsigned int count = get_subtable_count ();
for (unsigned int i = 0; i < count; i++)
- get_subtable (i).closure (c, lookup_type);
+ if (c->stop_sublookup_iteration (get_subtable (i).process (c, lookup_type)))
+ return c->default_return_value;
+ return c->default_return_value;
}
template <typename set_t>
}
}
- inline void collect_glyphs (hb_collect_glyphs_context_t *c) const
- {
- unsigned int lookup_type = get_type ();
- unsigned int count = get_subtable_count ();
- for (unsigned int i = 0; i < count; i++)
- get_subtable (i).collect_glyphs (c, lookup_type);
- }
-
inline bool would_apply (hb_would_apply_context_t *c, const hb_set_digest_t *digest) const
{
if (unlikely (!c->len)) return false;
return ret;
}
- private:
inline SubstLookupSubTable& serialize_subtable (hb_serialize_context_t *c,
unsigned int i)
{ return CastR<OffsetArrayOf<SubstLookupSubTable> > (subTable)[i].serialize (c, this); }
- public:
inline bool serialize_single (hb_serialize_context_t *c,
uint32_t lookup_props,
static inline void substitute_start (hb_font_t *font, hb_buffer_t *buffer);
static inline void substitute_finish (hb_font_t *font, hb_buffer_t *buffer);
- inline void closure_lookup (hb_closure_context_t *c,
- unsigned int lookup_index) const
- { return get_lookup (lookup_index).closure (c); }
+ static void_t closure_recurse_func (hb_closure_context_t *c, unsigned int lookup_index)
+ {
+ const GSUB &gsub = *(hb_ot_layout_from_face (c->face)->gsub);
+ const SubstLookup &l = gsub.get_lookup (lookup_index);
+ return l.process (c);
+ }
+ inline hb_closure_context_t::return_t closure_lookup (hb_face_t *face,
+ hb_set_t *glyphs,
+ unsigned int lookup_index) const
+ {
+ OT::hb_closure_context_t c (face, glyphs, closure_recurse_func);
+ return get_lookup (lookup_index).process (&c);
+ }
+
+#if 0
+ inline hb_collect_glyphs_context_t::return_t collect_glyphs_lookup (hb_collect_glyphs_context_t *c,
+ unsigned int lookup_index) const
+ { return get_lookup (lookup_index).process (c); }
+#endif
inline bool sanitize (hb_sanitize_context_t *c) {
TRACE_SANITIZE ();
/* Out-of-class implementation for methods recursing */
-inline void ExtensionSubst::closure (hb_closure_context_t *c) const
-{
- get_subtable ().closure (c, get_type ());
-}
-
-inline void ExtensionSubst::collect_glyphs (hb_collect_glyphs_context_t *c) const
+template <typename context_t>
+inline typename context_t::return_t ExtensionSubst::process (context_t *c) const
{
- get_subtable ().collect_glyphs (c, get_type ());
+ return get_subtable ().process (c, get_type ());
}
inline const Coverage & ExtensionSubst::get_coverage (void) const
return SubstLookup::lookup_type_is_reverse (type);
}
-static inline void closure_lookup (hb_closure_context_t *c, unsigned int lookup_index)
-{
- const GSUB &gsub = *(hb_ot_layout_from_face (c->face)->gsub);
- const SubstLookup &l = gsub.get_lookup (lookup_index);
-
- if (unlikely (c->nesting_level_left == 0))
- return;
-
- c->nesting_level_left--;
- l.closure (c);
- c->nesting_level_left++;
-}
-
-static inline void collect_glyphs_lookup (hb_collect_glyphs_context_t *c, unsigned int lookup_index)
-{
- const GSUB &gsub = *(hb_ot_layout_from_face (c->face)->gsub);
- const SubstLookup &l = gsub.get_lookup (lookup_index);
-
- /* XXX TODO */
- l.collect_glyphs (c);
-}
-
static inline bool substitute_lookup (hb_apply_context_t *c, unsigned int lookup_index)
{
const GSUB &gsub = *(hb_ot_layout_from_face (c->face)->gsub);
namespace OT {
+typedef struct {} void_t; /* To be used as return value when void is meant. */
+
+
#ifndef HB_DEBUG_CLOSURE
#define HB_DEBUG_CLOSURE (HB_DEBUG+0)
#endif
#define TRACE_CLOSURE() \
hb_auto_trace_t<HB_DEBUG_CLOSURE> trace (&c->debug_depth, "CLOSURE", this, HB_FUNC, "");
-
struct hb_closure_context_t
{
+ typedef void_t return_t;
+ typedef return_t (*recurse_func_t) (hb_closure_context_t *c, unsigned int lookup_index);
+ template <typename T>
+ inline return_t process (const T &obj) { obj.closure (this); return void_t (); }
+ static const return_t default_return_value;
+ bool stop_sublookup_iteration (const return_t r) const { return false; }
+ return_t recurse (unsigned int lookup_index)
+ {
+ if (unlikely (nesting_level_left == 0))
+ return default_return_value;
+
+ nesting_level_left--;
+ recurse_func (this, lookup_index);
+ nesting_level_left++;
+ return default_return_value;
+ }
+
hb_face_t *face;
hb_set_t *glyphs;
+ recurse_func_t recurse_func;
unsigned int nesting_level_left;
unsigned int debug_depth;
-
hb_closure_context_t (hb_face_t *face_,
hb_set_t *glyphs_,
+ recurse_func_t recurse_func_,
unsigned int nesting_level_left_ = MAX_NESTING_LEVEL) :
face (face_),
glyphs (glyphs_),
+ recurse_func (recurse_func_),
nesting_level_left (nesting_level_left_),
debug_depth (0) {}
};
after (glyphs_after ? *glyphs_after : *hb_set_get_empty ()),
output (glyphs_output ? *glyphs_output : *hb_set_get_empty ()),
debug_depth (0) {};
+
+ typedef void_t return_t;
+ template <typename T>
+ inline return_t process (const T &obj) { obj.collect_glyphs (this); return void_t (); }
+ static const return_t default_return_value;
+ bool stop_iteration (const return_t r) const { return false; }
+ return_t recurse (unsigned int lookup_index)
+ {
+#if 0
+ /* XXX */
+#endif
+ return default_return_value;
+ }
};
typedef bool (*intersects_func_t) (hb_set_t *glyphs, const USHORT &value, const void *data);
typedef bool (*match_func_t) (hb_codepoint_t glyph_id, const USHORT &value, const void *data);
-typedef void (*closure_lookup_func_t) (hb_closure_context_t *c, unsigned int lookup_index);
-typedef void (*collect_glyphs_lookup_func_t) (hb_collect_glyphs_context_t *c, unsigned int lookup_index);
typedef bool (*apply_lookup_func_t) (hb_apply_context_t *c, unsigned int lookup_index);
struct ContextClosureFuncs
{
intersects_func_t intersects;
- closure_lookup_func_t closure;
};
struct ContextApplyFuncs
{
static inline void closure_lookup (hb_closure_context_t *c,
unsigned int lookupCount,
- const LookupRecord lookupRecord[], /* Array of LookupRecords--in design order */
- closure_lookup_func_t closure_func)
+ const LookupRecord lookupRecord[] /* Array of LookupRecords--in design order */)
{
for (unsigned int i = 0; i < lookupCount; i++)
- closure_func (c, lookupRecord->lookupListIndex);
+ c->recurse (lookupRecord->lookupListIndex);
}
static inline bool apply_lookup (hb_apply_context_t *c,
inputCount ? inputCount - 1 : 0, input,
lookup_context.funcs.intersects, lookup_context.intersects_data))
closure_lookup (c,
- lookupCount, lookupRecord,
- lookup_context.funcs.closure);
+ lookupCount, lookupRecord);
}
struct Rule
{
- friend struct RuleSet;
-
- private:
-
inline void closure (hb_closure_context_t *c, ContextClosureLookupContext &lookup_context) const
{
TRACE_CLOSURE ();
struct ContextFormat1
{
- friend struct Context;
-
- private:
-
- inline void closure (hb_closure_context_t *c, closure_lookup_func_t closure_func) const
+ inline void closure (hb_closure_context_t *c) const
{
TRACE_CLOSURE ();
const Coverage &cov = (this+coverage);
struct ContextClosureLookupContext lookup_context = {
- {intersects_glyph, closure_func},
+ {intersects_glyph},
NULL
};
return TRACE_RETURN (rule_set.would_apply (c, lookup_context));
}
+ inline const Coverage &get_coverage (void) const
+ {
+ return this+coverage;
+ }
+
inline bool apply (hb_apply_context_t *c, apply_lookup_func_t apply_func) const
{
TRACE_APPLY ();
struct ContextFormat2
{
- friend struct Context;
-
- private:
-
- inline void closure (hb_closure_context_t *c, closure_lookup_func_t closure_func) const
+ inline void closure (hb_closure_context_t *c) const
{
TRACE_CLOSURE ();
if (!(this+coverage).intersects (c->glyphs))
const ClassDef &class_def = this+classDef;
struct ContextClosureLookupContext lookup_context = {
- {intersects_class, closure_func},
+ {intersects_class},
NULL
};
return TRACE_RETURN (rule_set.would_apply (c, lookup_context));
}
+ inline const Coverage &get_coverage (void) const
+ {
+ return this+coverage;
+ }
+
inline bool apply (hb_apply_context_t *c, apply_lookup_func_t apply_func) const
{
TRACE_APPLY ();
struct ContextFormat3
{
- friend struct Context;
-
- private:
-
- inline void closure (hb_closure_context_t *c, closure_lookup_func_t closure_func) const
+ inline void closure (hb_closure_context_t *c) const
{
TRACE_CLOSURE ();
if (!(this+coverage[0]).intersects (c->glyphs))
const LookupRecord *lookupRecord = &StructAtOffset<LookupRecord> (coverage, coverage[0].static_size * glyphCount);
struct ContextClosureLookupContext lookup_context = {
- {intersects_coverage, closure_func},
+ {intersects_coverage},
this
};
context_closure_lookup (c,
return TRACE_RETURN (context_would_apply_lookup (c, glyphCount, (const USHORT *) (coverage + 1), lookupCount, lookupRecord, lookup_context));
}
+ inline const Coverage &get_coverage (void) const
+ {
+ return this+coverage[0];
+ }
+
inline bool apply (hb_apply_context_t *c, apply_lookup_func_t apply_func) const
{
TRACE_APPLY ();
struct Context
{
- protected:
-
- inline void closure (hb_closure_context_t *c, closure_lookup_func_t closure_func) const
- {
- TRACE_CLOSURE ();
- switch (u.format) {
- case 1: u.format1.closure (c, closure_func); break;
- case 2: u.format2.closure (c, closure_func); break;
- case 3: u.format3.closure (c, closure_func); break;
- default: break;
- }
- }
-
- inline void collect_glyphs (hb_collect_glyphs_context_t *c, collect_glyphs_lookup_func_t closure_func) const
+ template <typename context_t>
+ inline typename context_t::return_t process (context_t *c) const
{
- TRACE_CLOSURE ();
switch (u.format) {
-// case 1: u.format1.collect_glyphs (c); break;
-// case 2: u.format2.collect_glyphs (c); break;
-// case 3: u.format2.collect_glyphs (c); break;
- default: break;
+ case 1: return c->process (u.format1);
+ case 2: return c->process (u.format2);
+ case 3: return c->process (u.format3);
+ default:return c->default_return_value;
}
}
inline const Coverage &get_coverage (void) const
{
switch (u.format) {
- case 1: return this + u.format1.coverage;
- case 2: return this + u.format2.coverage;
- case 3: return this + u.format3.coverage[0];
+ case 1: return u.format1.get_coverage ();
+ case 2: return u.format2.get_coverage ();
+ case 3: return u.format3.get_coverage ();
default:return Null(Coverage);
}
}
lookaheadCount, lookahead,
lookup_context.funcs.intersects, lookup_context.intersects_data[2]))
closure_lookup (c,
- lookupCount, lookupRecord,
- lookup_context.funcs.closure);
+ lookupCount, lookupRecord);
}
static inline bool chain_context_would_apply_lookup (hb_would_apply_context_t *c,
struct ChainRule
{
- friend struct ChainRuleSet;
-
- private:
-
inline void closure (hb_closure_context_t *c, ChainContextClosureLookupContext &lookup_context) const
{
TRACE_CLOSURE ();
lookup.array, lookup_context));
}
- public:
inline bool sanitize (hb_sanitize_context_t *c) {
TRACE_SANITIZE ();
if (!backtrack.sanitize (c)) return TRACE_RETURN (false);
struct ChainContextFormat1
{
- friend struct ChainContext;
-
- private:
-
- inline void closure (hb_closure_context_t *c, closure_lookup_func_t closure_func) const
+ inline void closure (hb_closure_context_t *c) const
{
TRACE_CLOSURE ();
const Coverage &cov = (this+coverage);
struct ChainContextClosureLookupContext lookup_context = {
- {intersects_glyph, closure_func},
+ {intersects_glyph},
{NULL, NULL, NULL}
};
return TRACE_RETURN (rule_set.would_apply (c, lookup_context));
}
+ inline const Coverage &get_coverage (void) const
+ {
+ return this+coverage;
+ }
+
inline bool apply (hb_apply_context_t *c, apply_lookup_func_t apply_func) const
{
TRACE_APPLY ();
struct ChainContextFormat2
{
- friend struct ChainContext;
-
- private:
-
- inline void closure (hb_closure_context_t *c, closure_lookup_func_t closure_func) const
+ inline void closure (hb_closure_context_t *c) const
{
TRACE_CLOSURE ();
if (!(this+coverage).intersects (c->glyphs))
const ClassDef &lookahead_class_def = this+lookaheadClassDef;
struct ChainContextClosureLookupContext lookup_context = {
- {intersects_class, closure_func},
+ {intersects_class},
{&backtrack_class_def,
&input_class_def,
&lookahead_class_def}
return TRACE_RETURN (rule_set.would_apply (c, lookup_context));
}
+ inline const Coverage &get_coverage (void) const
+ {
+ return this+coverage;
+ }
+
inline bool apply (hb_apply_context_t *c, apply_lookup_func_t apply_func) const
{
TRACE_APPLY ();
struct ChainContextFormat3
{
- friend struct ChainContext;
-
- private:
-
- inline void closure (hb_closure_context_t *c, closure_lookup_func_t closure_func) const
+ inline void closure (hb_closure_context_t *c) const
{
TRACE_CLOSURE ();
const OffsetArrayOf<Coverage> &input = StructAfter<OffsetArrayOf<Coverage> > (backtrack);
const OffsetArrayOf<Coverage> &lookahead = StructAfter<OffsetArrayOf<Coverage> > (input);
const ArrayOf<LookupRecord> &lookup = StructAfter<ArrayOf<LookupRecord> > (lookahead);
struct ChainContextClosureLookupContext lookup_context = {
- {intersects_coverage, closure_func},
+ {intersects_coverage},
{this, this, this}
};
chain_context_closure_lookup (c,
lookup_context);
}
- inline const Coverage &get_coverage (void) const
- {
- const OffsetArrayOf<Coverage> &input = StructAfter<OffsetArrayOf<Coverage> > (backtrack);
- return this+input[0];
- }
-
inline bool would_apply (hb_would_apply_context_t *c) const
{
TRACE_WOULD_APPLY ();
lookup.len, lookup.array, lookup_context));
}
+ inline const Coverage &get_coverage (void) const
+ {
+ const OffsetArrayOf<Coverage> &input = StructAfter<OffsetArrayOf<Coverage> > (backtrack);
+ return this+input[0];
+ }
+
inline bool apply (hb_apply_context_t *c, apply_lookup_func_t apply_func) const
{
TRACE_APPLY ();
struct ChainContext
{
- protected:
-
- inline void closure (hb_closure_context_t *c, closure_lookup_func_t closure_func) const
- {
- TRACE_CLOSURE ();
- switch (u.format) {
- case 1: u.format1.closure (c, closure_func); break;
- case 2: u.format2.closure (c, closure_func); break;
- case 3: u.format3.closure (c, closure_func); break;
- default: break;
- }
- }
-
- inline void collect_glyphs (hb_collect_glyphs_context_t *c, collect_glyphs_lookup_func_t closure_func) const
+ template <typename context_t>
+ inline typename context_t::return_t process (context_t *c) const
{
- TRACE_CLOSURE ();
switch (u.format) {
-// case 1: u.format1.collect_glyphs (c); break;
-// case 2: u.format2.collect_glyphs (c); break;
-// case 3: u.format2.collect_glyphs (c); break;
- default: break;
+ case 1: return c->process (u.format1);
+ case 2: return c->process (u.format2);
+ case 3: return c->process (u.format3);
+ default:return c->default_return_value;
}
}
inline const Coverage &get_coverage (void) const
{
switch (u.format) {
- case 1: return this + u.format1.coverage;
- case 2: return this + u.format2.coverage;
+ case 1: return u.format1.get_coverage ();
+ case 2: return u.format2.get_coverage ();
case 3: return u.format3.get_coverage ();
default:return Null(Coverage);
}
struct ExtensionFormat1
{
- friend struct Extension;
-
- protected:
inline unsigned int get_type (void) const { return extensionLookupType; }
inline unsigned int get_offset (void) const { return extensionOffset; }
switch (table_tag) {
case HB_OT_TAG_GSUB:
{
- const OT::SubstLookup& l = hb_ot_layout_from_face (face)->gsub->get_lookup (lookup_index);
- l.collect_glyphs (&c);
+// hb_ot_layout_from_face (face)->gsub->collect_glyphs_lookup (&c, lookup_index);
return;
}
case HB_OT_TAG_GPOS:
{
- const OT::PosLookup& l = hb_ot_layout_from_face (face)->gpos->get_lookup (lookup_index);
-// l.collect_glyphs (&c);
+// hb_ot_layout_from_face (face)->gpos->collect_glyphs_lookup (&c, lookup_index);
+// l.collect_glyphs_lookup (&c);
return;
}
}
unsigned int lookup_index,
hb_set_t *glyphs)
{
- OT::hb_closure_context_t c (face, glyphs);
- _get_gsub (face).closure_lookup (&c, lookup_index);
+ _get_gsub (face).closure_lookup (face, glyphs, lookup_index);
}
/*