Make closure() return void
diff --git a/src/hb-ot-layout-gsub-table.hh b/src/hb-ot-layout-gsub-table.hh
index e4e631a..371672a 100644
--- a/src/hb-ot-layout-gsub-table.hh
+++ b/src/hb-ot-layout-gsub-table.hh
@@ -39,17 +39,15 @@
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
@@ -96,16 +94,14 @@
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
@@ -154,13 +150,13 @@
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;
}
}
@@ -208,14 +204,12 @@
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
@@ -250,16 +244,14 @@
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
@@ -302,12 +294,12 @@
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;
}
}
@@ -354,20 +346,18 @@
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
@@ -430,12 +420,12 @@
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;
}
}
@@ -479,14 +469,14 @@
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
@@ -584,17 +574,12 @@
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
@@ -643,17 +628,14 @@
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
@@ -700,12 +682,12 @@
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;
}
}
@@ -744,7 +726,7 @@
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
{
@@ -752,7 +734,7 @@
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);
@@ -771,7 +753,7 @@
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);
@@ -798,7 +780,7 @@
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;
@@ -816,7 +798,7 @@
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);
@@ -826,21 +808,19 @@
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
@@ -910,12 +890,12 @@
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;
}
}
@@ -965,20 +945,20 @@
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;
}
}
@@ -1068,14 +1048,12 @@
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
@@ -1196,7 +1174,7 @@
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); }
@@ -1231,9 +1209,9 @@
/* 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
@@ -1269,19 +1247,17 @@
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)
diff --git a/src/hb-ot-layout-gsubgpos-private.hh b/src/hb-ot-layout-gsubgpos-private.hh
index d40b2ce..1d12db1 100644
--- a/src/hb-ot-layout-gsubgpos-private.hh
+++ b/src/hb-ot-layout-gsubgpos-private.hh
@@ -229,7 +229,7 @@
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
@@ -375,15 +375,13 @@
};
-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,
@@ -460,19 +458,19 @@
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);
}
@@ -500,14 +498,14 @@
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
@@ -545,14 +543,12 @@
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
@@ -587,7 +583,7 @@
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 ();
@@ -598,14 +594,12 @@
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
@@ -648,11 +642,11 @@
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;
@@ -661,14 +655,12 @@
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
@@ -717,21 +709,21 @@
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
@@ -781,14 +773,14 @@
{
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;
}
}
@@ -838,7 +830,7 @@
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) */
@@ -849,18 +841,18 @@
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,
@@ -904,18 +896,18 @@
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
@@ -964,14 +956,12 @@
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
@@ -1006,7 +996,7 @@
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);
@@ -1016,14 +1006,12 @@
{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
@@ -1065,11 +1053,11 @@
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;
@@ -1082,14 +1070,12 @@
&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
@@ -1153,11 +1139,26 @@
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
@@ -1219,14 +1220,14 @@
{
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;
}
}
diff --git a/src/hb-ot-layout.cc b/src/hb-ot-layout.cc
index 95ed9c6..ded3dcc 100644
--- a/src/hb-ot-layout.cc
+++ b/src/hb-ot-layout.cc
@@ -470,13 +470,13 @@
GSUB::substitute_finish (buffer);
}
-hb_bool_t
-hb_ot_layout_substitute_closure_lookup (hb_face_t *face,
- hb_set_t *glyphs,
- unsigned int lookup_index)
+void
+hb_ot_layout_substitute_closure_lookup (hb_face_t *face,
+ hb_set_t *glyphs,
+ unsigned int lookup_index)
{
hb_closure_context_t c (face, glyphs);
- return _get_gsub (face).closure_lookup (&c, lookup_index);
+ _get_gsub (face).closure_lookup (&c, lookup_index);
}
/*
diff --git a/src/hb-ot-layout.h b/src/hb-ot-layout.h
index f6890b6..b8b5baf 100644
--- a/src/hb-ot-layout.h
+++ b/src/hb-ot-layout.h
@@ -183,10 +183,10 @@
hb_ot_layout_substitute_finish (hb_buffer_t *buffer);
-hb_bool_t
-hb_ot_layout_substitute_closure_lookup (hb_face_t *face,
- hb_set_t *glyphs,
- unsigned int lookup_index);
+void
+hb_ot_layout_substitute_closure_lookup (hb_face_t *face,
+ hb_set_t *glyphs,
+ unsigned int lookup_index);
/*
* GPOS
diff --git a/src/hb-set-private.hh b/src/hb-set-private.hh
index 4b24370..a6239e4 100644
--- a/src/hb-set-private.hh
+++ b/src/hb-set-private.hh
@@ -38,23 +38,15 @@
inline void clear (void) {
memset (elts, 0, sizeof elts);
}
- inline bool add (hb_codepoint_t g)
+ inline void add (hb_codepoint_t g)
{
- if (unlikely (g > MAX_G)) return false;
- elt_t &e = elt (g);
- elt_t m = mask (g);
- bool ret = !(e & m);
- e |= m;
- return ret;
+ if (unlikely (g > MAX_G)) return;
+ elt (g) |= mask (g);
}
- inline bool del (hb_codepoint_t g)
+ inline void del (hb_codepoint_t g)
{
- if (unlikely (g > MAX_G)) return false;
- elt_t &e = elt (g);
- elt_t m = mask (g);
- bool ret = !!(e & m);
- e &= ~m;
- return ret;
+ if (unlikely (g > MAX_G)) return;
+ elt (g) &= ~mask (g);
}
inline bool has (hb_codepoint_t g) const
{