private:
- inline bool closure (hb_closure_context_t *c) const
+ inline void closure (hb_closure_context_t *c) const
{
TRACE_CLOSURE ();
- bool ret = false;
Coverage::Iter iter;
for (iter.init (this+coverage); iter.more (); iter.next ()) {
hb_codepoint_t glyph_id = iter.get_glyph ();
if (c->glyphs->has (glyph_id))
- ret = c->glyphs->add ((glyph_id + deltaGlyphID) & 0xFFFF) || ret;
+ c->glyphs->add ((glyph_id + deltaGlyphID) & 0xFFFF);
}
- return ret;
}
inline bool would_apply (hb_codepoint_t glyph_id) const
private:
- inline bool closure (hb_closure_context_t *c) const
+ inline void closure (hb_closure_context_t *c) const
{
TRACE_CLOSURE ();
- bool ret = false;
Coverage::Iter iter;
for (iter.init (this+coverage); iter.more (); iter.next ()) {
if (c->glyphs->has (iter.get_glyph ()))
- ret = c->glyphs->add (substitute[iter.get_coverage ()]) || ret;
+ c->glyphs->add (substitute[iter.get_coverage ()]);
}
- return ret;
}
inline bool would_apply (hb_codepoint_t glyph_id) const
private:
- inline bool closure (hb_closure_context_t *c) const
+ inline void closure (hb_closure_context_t *c) const
{
TRACE_CLOSURE ();
switch (u.format) {
- case 1: return u.format1.closure (c);
- case 2: return u.format2.closure (c);
- default:return false;
+ case 1: u.format1.closure (c); break;
+ case 2: u.format2.closure (c); break;
+ default: break;
}
}
private:
- inline bool closure (hb_closure_context_t *c) const
+ inline void closure (hb_closure_context_t *c) const
{
TRACE_CLOSURE ();
unsigned int count = substitute.len;
- bool ret = false;
for (unsigned int i = 0; i < count; i++)
- ret = c->glyphs->add (substitute[i]) || ret;
- return ret;
+ c->glyphs->add (substitute[i]);
}
inline bool apply (hb_apply_context_t *c) const
private:
- inline bool closure (hb_closure_context_t *c) const
+ inline void closure (hb_closure_context_t *c) const
{
TRACE_CLOSURE ();
- bool ret = false;
Coverage::Iter iter;
for (iter.init (this+coverage); iter.more (); iter.next ()) {
if (c->glyphs->has (iter.get_glyph ()))
- ret = (this+sequence[iter.get_coverage ()]).closure (c) || ret;
+ (this+sequence[iter.get_coverage ()]).closure (c);
}
- return ret;
}
inline bool would_apply (hb_codepoint_t glyph_id) const
private:
- inline bool closure (hb_closure_context_t *c) const
+ inline void closure (hb_closure_context_t *c) const
{
TRACE_CLOSURE ();
switch (u.format) {
- case 1: return u.format1.closure (c);
- default:return false;
+ case 1: u.format1.closure (c); break;
+ default: break;
}
}
private:
- inline bool closure (hb_closure_context_t *c) const
+ inline void closure (hb_closure_context_t *c) const
{
TRACE_CLOSURE ();
- bool ret = false;
Coverage::Iter iter;
for (iter.init (this+coverage); iter.more (); iter.next ()) {
if (c->glyphs->has (iter.get_glyph ())) {
const AlternateSet &alt_set = this+alternateSet[iter.get_coverage ()];
unsigned int count = alt_set.len;
for (unsigned int i = 0; i < count; i++)
- ret = c->glyphs->add (alt_set[i]) || ret;
+ c->glyphs->add (alt_set[i]);
}
}
- return ret;
}
inline bool would_apply (hb_codepoint_t glyph_id) const
private:
- inline bool closure (hb_closure_context_t *c) const
+ inline void closure (hb_closure_context_t *c) const
{
TRACE_CLOSURE ();
switch (u.format) {
- case 1: return u.format1.closure (c);
- default:return false;
+ case 1: u.format1.closure (c); break;
+ default: break;
}
}
private:
- inline bool closure (hb_closure_context_t *c) const
+ inline void closure (hb_closure_context_t *c) const
{
TRACE_CLOSURE ();
unsigned int count = component.len;
for (unsigned int i = 1; i < count; i++)
if (!c->glyphs->has (component[i]))
- return false;
- return c->glyphs->add (ligGlyph);
+ return;
+ c->glyphs->add (ligGlyph);
}
inline bool would_apply (hb_codepoint_t second) const
private:
- inline bool closure (hb_closure_context_t *c) const
+ inline void closure (hb_closure_context_t *c) const
{
TRACE_CLOSURE ();
- bool ret = false;
unsigned int num_ligs = ligature.len;
for (unsigned int i = 0; i < num_ligs; i++)
- {
- const Ligature &lig = this+ligature[i];
- ret = lig.closure (c) || ret;
- }
- return ret;
+ (this+ligature[i]).closure (c);
}
inline bool would_apply (hb_codepoint_t second) const
private:
- inline bool closure (hb_closure_context_t *c) const
+ inline void closure (hb_closure_context_t *c) const
{
TRACE_CLOSURE ();
- bool ret = false;
Coverage::Iter iter;
for (iter.init (this+coverage); iter.more (); iter.next ()) {
if (c->glyphs->has (iter.get_glyph ()))
- ret = (this+ligatureSet[iter.get_coverage ()]).closure (c) || ret;
+ (this+ligatureSet[iter.get_coverage ()]).closure (c);
}
- return ret;
- return false;
}
inline bool would_apply (hb_codepoint_t first, hb_codepoint_t second) const
private:
- inline bool closure (hb_closure_context_t *c) const
+ inline void closure (hb_closure_context_t *c) const
{
TRACE_CLOSURE ();
switch (u.format) {
- case 1: return u.format1.closure (c);
- default:return false;
+ case 1: u.format1.closure (c); break;
+ default: break;
}
}
static inline bool substitute_lookup (hb_apply_context_t *c, unsigned int lookup_index);
-static inline bool closure_lookup (hb_closure_context_t *c, unsigned int lookup_index);
+static inline void closure_lookup (hb_closure_context_t *c, unsigned int lookup_index);
struct ContextSubst : Context
{
private:
- inline bool closure (hb_closure_context_t *c) const
+ inline void closure (hb_closure_context_t *c) const
{
TRACE_CLOSURE ();
return Context::closure (c, closure_lookup);
private:
- inline bool closure (hb_closure_context_t *c) const
+ inline void closure (hb_closure_context_t *c) const
{
TRACE_CLOSURE ();
return ChainContext::closure (c, closure_lookup);
return StructAtOffset<SubstLookupSubTable> (this, offset);
}
- inline bool closure (hb_closure_context_t *c) const;
+ inline void closure (hb_closure_context_t *c) const;
inline bool would_apply (hb_codepoint_t glyph_id) const;
inline bool would_apply (hb_codepoint_t first, hb_codepoint_t second) const;
private:
- inline bool closure (hb_closure_context_t *c) const
+ inline void closure (hb_closure_context_t *c) const
{
TRACE_CLOSURE ();
const OffsetArrayOf<Coverage> &lookahead = StructAfter<OffsetArrayOf<Coverage> > (backtrack);
count = backtrack.len;
for (unsigned int i = 0; i < count; i++)
if (!(this+backtrack[i]).intersects (c->glyphs))
- return false;
+ return;
count = lookahead.len;
for (unsigned int i = 0; i < count; i++)
if (!(this+lookahead[i]).intersects (c->glyphs))
- return false;
+ return;
const ArrayOf<GlyphID> &substitute = StructAfter<ArrayOf<GlyphID> > (lookahead);
- bool ret = false;
Coverage::Iter iter;
for (iter.init (this+coverage); iter.more (); iter.next ()) {
if (c->glyphs->has (iter.get_glyph ()))
- ret = c->glyphs->add (substitute[iter.get_coverage ()]) || ret;
+ c->glyphs->add (substitute[iter.get_coverage ()]);
}
- return false;
}
inline bool apply (hb_apply_context_t *c) const
private:
- inline bool closure (hb_closure_context_t *c) const
+ inline void closure (hb_closure_context_t *c) const
{
TRACE_CLOSURE ();
switch (u.format) {
- case 1: return u.format1.closure (c);
- default:return false;
+ case 1: u.format1.closure (c); break;
+ default: break;
}
}
ReverseChainSingle = 8
};
- inline bool closure (hb_closure_context_t *c,
+ inline void closure (hb_closure_context_t *c,
unsigned int lookup_type) const
{
TRACE_CLOSURE ();
switch (lookup_type) {
- case Single: return u.single.closure (c);
- case Multiple: return u.multiple.closure (c);
- case Alternate: return u.alternate.closure (c);
- case Ligature: return u.ligature.closure (c);
- case Context: return u.c.closure (c);
- case ChainContext: return u.chainContext.closure (c);
- case Extension: return u.extension.closure (c);
- case ReverseChainSingle: return u.reverseChainContextSingle.closure (c);
- default:return false;
+ 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.c.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;
}
}
return lookup_type_is_reverse (type);
}
- inline bool closure (hb_closure_context_t *c) const
+ inline void closure (hb_closure_context_t *c) const
{
unsigned int lookup_type = get_type ();
- bool ret = false;
unsigned int count = get_subtable_count ();
for (unsigned int i = 0; i < count; i++)
- ret = get_subtable (i).closure (c, lookup_type) || ret;
- return ret;
+ get_subtable (i).closure (c, lookup_type);
}
inline bool would_apply (hb_codepoint_t glyph_id) const
static inline void substitute_start (hb_buffer_t *buffer);
static inline void substitute_finish (hb_buffer_t *buffer);
- inline bool closure_lookup (hb_closure_context_t *c,
+ inline void closure_lookup (hb_closure_context_t *c,
unsigned int lookup_index) const
{ return get_lookup (lookup_index).closure (c); }
/* Out-of-class implementation for methods recursing */
-inline bool ExtensionSubst::closure (hb_closure_context_t *c) const
+inline void ExtensionSubst::closure (hb_closure_context_t *c) const
{
- return get_subtable ().closure (c, get_type ());
+ get_subtable ().closure (c, get_type ());
}
inline bool ExtensionSubst::would_apply (hb_codepoint_t glyph_id) const
return SubstLookup::lookup_type_is_reverse (type);
}
-static inline bool closure_lookup (hb_closure_context_t *c, unsigned int lookup_index)
+static inline void closure_lookup (hb_closure_context_t *c, unsigned int lookup_index)
{
const GSUB &gsub = *(c->face->ot_layout->gsub);
const SubstLookup &l = gsub.get_lookup (lookup_index);
if (unlikely (c->nesting_level_left == 0))
- return false;
+ return;
c->nesting_level_left--;
- bool ret = l.closure (c);
+ l.closure (c);
c->nesting_level_left++;
-
- return ret;
}
static inline bool substitute_lookup (hb_apply_context_t *c, unsigned int lookup_index)
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 bool (*closure_lookup_func_t) (hb_closure_context_t *c, unsigned int lookup_index);
+typedef void (*closure_lookup_func_t) (hb_closure_context_t *c, unsigned int lookup_index);
typedef bool (*apply_lookup_func_t) (hb_apply_context_t *c, unsigned int lookup_index);
struct ContextClosureFuncs
};
-static inline bool closure_lookup (hb_closure_context_t *c,
+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)
{
- bool ret = false;
for (unsigned int i = 0; i < lookupCount; i++)
- ret = closure_func (c, lookupRecord->lookupListIndex) || ret;
- return ret;
+ closure_func (c, lookupRecord->lookupListIndex);
}
static inline bool apply_lookup (hb_apply_context_t *c,
const void *match_data;
};
-static inline bool context_closure_lookup (hb_closure_context_t *c,
+static inline void context_closure_lookup (hb_closure_context_t *c,
unsigned int inputCount, /* Including the first glyph (not matched) */
const USHORT input[], /* Array of input values--start with second glyph */
unsigned int lookupCount,
const LookupRecord lookupRecord[],
ContextClosureLookupContext &lookup_context)
{
- return intersects_array (c,
- inputCount ? inputCount - 1 : 0, input,
- lookup_context.funcs.intersects, lookup_context.intersects_data)
- && closure_lookup (c,
- lookupCount, lookupRecord,
- lookup_context.funcs.closure);
+ if (intersects_array (c,
+ inputCount ? inputCount - 1 : 0, input,
+ lookup_context.funcs.intersects, lookup_context.intersects_data))
+ closure_lookup (c,
+ lookupCount, lookupRecord,
+ lookup_context.funcs.closure);
}
private:
- inline bool closure (hb_closure_context_t *c, ContextClosureLookupContext &lookup_context) const
+ inline void closure (hb_closure_context_t *c, ContextClosureLookupContext &lookup_context) const
{
TRACE_CLOSURE ();
const LookupRecord *lookupRecord = &StructAtOffset<LookupRecord> (input, input[0].static_size * (inputCount ? inputCount - 1 : 0));
- return context_closure_lookup (c,
- inputCount, input,
- lookupCount, lookupRecord,
- lookup_context);
+ context_closure_lookup (c,
+ inputCount, input,
+ lookupCount, lookupRecord,
+ lookup_context);
}
inline bool apply (hb_apply_context_t *c, ContextApplyLookupContext &lookup_context) const
struct RuleSet
{
- inline bool closure (hb_closure_context_t *c, ContextClosureLookupContext &lookup_context) const
+ inline void closure (hb_closure_context_t *c, ContextClosureLookupContext &lookup_context) const
{
TRACE_CLOSURE ();
- bool ret = false;
unsigned int num_rules = rule.len;
for (unsigned int i = 0; i < num_rules; i++)
- ret = (this+rule[i]).closure (c, lookup_context) || ret;
- return ret;
+ (this+rule[i]).closure (c, lookup_context);
}
inline bool apply (hb_apply_context_t *c, ContextApplyLookupContext &lookup_context) const
private:
- inline bool closure (hb_closure_context_t *c, closure_lookup_func_t closure_func) const
+ inline void closure (hb_closure_context_t *c, closure_lookup_func_t closure_func) const
{
TRACE_CLOSURE ();
NULL
};
- bool ret = false;
unsigned int count = ruleSet.len;
for (unsigned int i = 0; i < count; i++)
if (cov.intersects_coverage (c->glyphs, i)) {
const RuleSet &rule_set = this+ruleSet[i];
- ret = rule_set.closure (c, lookup_context) || ret;
+ rule_set.closure (c, lookup_context);
}
- return ret;
}
inline bool apply (hb_apply_context_t *c, apply_lookup_func_t apply_func) const
private:
- inline bool closure (hb_closure_context_t *c, closure_lookup_func_t closure_func) const
+ inline void closure (hb_closure_context_t *c, closure_lookup_func_t closure_func) const
{
TRACE_CLOSURE ();
if (!(this+coverage).intersects (c->glyphs))
- return false;
+ return;
const ClassDef &class_def = this+classDef;
NULL
};
- bool ret = false;
unsigned int count = ruleSet.len;
for (unsigned int i = 0; i < count; i++)
if (class_def.intersects_class (c->glyphs, i)) {
const RuleSet &rule_set = this+ruleSet[i];
- ret = rule_set.closure (c, lookup_context) || ret;
+ rule_set.closure (c, lookup_context);
}
- return ret;
}
inline bool apply (hb_apply_context_t *c, apply_lookup_func_t apply_func) const
private:
- inline bool closure (hb_closure_context_t *c, closure_lookup_func_t closure_func) const
+ inline void closure (hb_closure_context_t *c, closure_lookup_func_t closure_func) const
{
TRACE_CLOSURE ();
if (!(this+coverage[0]).intersects (c->glyphs))
- return false;
+ return;
const LookupRecord *lookupRecord = &StructAtOffset<LookupRecord> (coverage, coverage[0].static_size * glyphCount);
struct ContextClosureLookupContext lookup_context = {
{intersects_coverage, closure_func},
this
};
- return context_closure_lookup (c,
- glyphCount, (const USHORT *) (coverage + 1),
- lookupCount, lookupRecord,
- lookup_context);
+ context_closure_lookup (c,
+ glyphCount, (const USHORT *) (coverage + 1),
+ lookupCount, lookupRecord,
+ lookup_context);
}
inline bool apply (hb_apply_context_t *c, apply_lookup_func_t apply_func) const
{
protected:
- inline bool closure (hb_closure_context_t *c, closure_lookup_func_t closure_func) const
+ inline void closure (hb_closure_context_t *c, closure_lookup_func_t closure_func) const
{
TRACE_CLOSURE ();
switch (u.format) {
- case 1: return u.format1.closure (c, closure_func);
- case 2: return u.format2.closure (c, closure_func);
- case 3: return u.format3.closure (c, closure_func);
- default:return false;
+ 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;
}
}
const void *match_data[3];
};
-static inline bool chain_context_closure_lookup (hb_closure_context_t *c,
+static inline void chain_context_closure_lookup (hb_closure_context_t *c,
unsigned int backtrackCount,
const USHORT backtrack[],
unsigned int inputCount, /* Including the first glyph (not matched) */
const LookupRecord lookupRecord[],
ChainContextClosureLookupContext &lookup_context)
{
- return intersects_array (c,
- backtrackCount, backtrack,
- lookup_context.funcs.intersects, lookup_context.intersects_data[0])
- && intersects_array (c,
- inputCount ? inputCount - 1 : 0, input,
- lookup_context.funcs.intersects, lookup_context.intersects_data[1])
- && intersects_array (c,
- lookaheadCount, lookahead,
- lookup_context.funcs.intersects, lookup_context.intersects_data[2])
- && closure_lookup (c,
- lookupCount, lookupRecord,
- lookup_context.funcs.closure);
+ if (intersects_array (c,
+ backtrackCount, backtrack,
+ lookup_context.funcs.intersects, lookup_context.intersects_data[0])
+ && intersects_array (c,
+ inputCount ? inputCount - 1 : 0, input,
+ lookup_context.funcs.intersects, lookup_context.intersects_data[1])
+ && intersects_array (c,
+ lookaheadCount, lookahead,
+ lookup_context.funcs.intersects, lookup_context.intersects_data[2]))
+ closure_lookup (c,
+ lookupCount, lookupRecord,
+ lookup_context.funcs.closure);
}
static inline bool chain_context_apply_lookup (hb_apply_context_t *c,
private:
- inline bool closure (hb_closure_context_t *c, ChainContextClosureLookupContext &lookup_context) const
+ inline void closure (hb_closure_context_t *c, ChainContextClosureLookupContext &lookup_context) const
{
TRACE_CLOSURE ();
const HeadlessArrayOf<USHORT> &input = StructAfter<HeadlessArrayOf<USHORT> > (backtrack);
const ArrayOf<USHORT> &lookahead = StructAfter<ArrayOf<USHORT> > (input);
const ArrayOf<LookupRecord> &lookup = StructAfter<ArrayOf<LookupRecord> > (lookahead);
- return chain_context_closure_lookup (c,
- backtrack.len, backtrack.array,
- input.len, input.array,
- lookahead.len, lookahead.array,
- lookup.len, lookup.array,
- lookup_context);
+ chain_context_closure_lookup (c,
+ backtrack.len, backtrack.array,
+ input.len, input.array,
+ lookahead.len, lookahead.array,
+ lookup.len, lookup.array,
+ lookup_context);
}
inline bool apply (hb_apply_context_t *c, ChainContextApplyLookupContext &lookup_context) const
struct ChainRuleSet
{
- inline bool closure (hb_closure_context_t *c, ChainContextClosureLookupContext &lookup_context) const
+ inline void closure (hb_closure_context_t *c, ChainContextClosureLookupContext &lookup_context) const
{
TRACE_CLOSURE ();
- bool ret = false;
unsigned int num_rules = rule.len;
for (unsigned int i = 0; i < num_rules; i++)
- ret = (this+rule[i]).closure (c, lookup_context) || ret;
- return ret;
+ (this+rule[i]).closure (c, lookup_context);
}
inline bool apply (hb_apply_context_t *c, ChainContextApplyLookupContext &lookup_context) const
private:
- inline bool closure (hb_closure_context_t *c, closure_lookup_func_t closure_func) const
+ inline void closure (hb_closure_context_t *c, closure_lookup_func_t closure_func) const
{
TRACE_CLOSURE ();
const Coverage &cov = (this+coverage);
{NULL, NULL, NULL}
};
- bool ret = false;
unsigned int count = ruleSet.len;
for (unsigned int i = 0; i < count; i++)
if (cov.intersects_coverage (c->glyphs, i)) {
const ChainRuleSet &rule_set = this+ruleSet[i];
- ret = rule_set.closure (c, lookup_context) || ret;
+ rule_set.closure (c, lookup_context);
}
- return ret;
}
inline bool apply (hb_apply_context_t *c, apply_lookup_func_t apply_func) const
private:
- inline bool closure (hb_closure_context_t *c, closure_lookup_func_t closure_func) const
+ inline void closure (hb_closure_context_t *c, closure_lookup_func_t closure_func) const
{
TRACE_CLOSURE ();
if (!(this+coverage).intersects (c->glyphs))
- return false;
+ return;
const ClassDef &backtrack_class_def = this+backtrackClassDef;
const ClassDef &input_class_def = this+inputClassDef;
&lookahead_class_def}
};
- bool ret = false;
unsigned int count = ruleSet.len;
for (unsigned int i = 0; i < count; i++)
if (input_class_def.intersects_class (c->glyphs, i)) {
const ChainRuleSet &rule_set = this+ruleSet[i];
- ret = rule_set.closure (c, lookup_context) || ret;
+ rule_set.closure (c, lookup_context);
}
- return ret;
}
inline bool apply (hb_apply_context_t *c, apply_lookup_func_t apply_func) const
private:
- inline bool closure (hb_closure_context_t *c, closure_lookup_func_t closure_func) const
+ inline void closure (hb_closure_context_t *c, closure_lookup_func_t closure_func) const
{
TRACE_CLOSURE ();
- /* TODO FILLME */
- return false;
+ const OffsetArrayOf<Coverage> &input = StructAfter<OffsetArrayOf<Coverage> > (backtrack);
+
+ if (!(this+input[0]).intersects (c->glyphs))
+ return;
+
+ const OffsetArrayOf<Coverage> &lookahead = StructAfter<OffsetArrayOf<Coverage> > (input);
+ const ArrayOf<LookupRecord> &lookup = StructAfter<ArrayOf<LookupRecord> > (lookahead);
+ struct ChainContextClosureLookupContext lookup_context = {
+ {intersects_coverage, closure_func},
+ {this, this, this}
+ };
+ chain_context_closure_lookup (c,
+ backtrack.len, (const USHORT *) backtrack.array,
+ input.len, (const USHORT *) input.array + 1,
+ lookahead.len, (const USHORT *) lookahead.array,
+ lookup.len, lookup.array,
+ lookup_context);
}
inline bool apply (hb_apply_context_t *c, apply_lookup_func_t apply_func) const
{
protected:
- inline bool closure (hb_closure_context_t *c, closure_lookup_func_t closure_func) const
+ inline void closure (hb_closure_context_t *c, closure_lookup_func_t closure_func) const
{
TRACE_CLOSURE ();
switch (u.format) {
- case 1: return u.format1.closure (c, closure_func);
- case 2: return u.format2.closure (c, closure_func);
- case 3: return u.format3.closure (c, closure_func);
- default:return false;
+ 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;
}
}