From ec35a72a44301934b8f123ab2833f59d8c875a09 Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Thu, 22 Nov 2012 16:05:59 -0500 Subject: [PATCH] [OTLayout] Port apply() operator to process() template --- src/hb-ot-layout-gpos-table.hh | 117 ++++------------------------------- src/hb-ot-layout-gsub-table.hh | 108 +++----------------------------- src/hb-ot-layout-gsubgpos-private.hh | 99 +++++++++++++---------------- src/hb-ot-layout.cc | 2 +- 4 files changed, 65 insertions(+), 261 deletions(-) diff --git a/src/hb-ot-layout-gpos-table.hh b/src/hb-ot-layout-gpos-table.hh index d578760..aebc73f 100644 --- a/src/hb-ot-layout-gpos-table.hh +++ b/src/hb-ot-layout-gpos-table.hh @@ -510,16 +510,6 @@ struct SinglePos } } - inline bool apply (hb_apply_context_t *c) const - { - TRACE_APPLY (); - switch (u.format) { - case 1: return TRACE_RETURN (u.format1.apply (c)); - case 2: return TRACE_RETURN (u.format2.apply (c)); - default:return TRACE_RETURN (false); - } - } - inline bool sanitize (hb_sanitize_context_t *c) { TRACE_SANITIZE (); if (!u.format.sanitize (c)) return TRACE_RETURN (false); @@ -765,16 +755,6 @@ struct PairPos } } - inline bool apply (hb_apply_context_t *c) const - { - TRACE_APPLY (); - switch (u.format) { - case 1: return TRACE_RETURN (u.format1.apply (c)); - case 2: return TRACE_RETURN (u.format2.apply (c)); - default:return TRACE_RETURN (false); - } - } - inline bool sanitize (hb_sanitize_context_t *c) { TRACE_SANITIZE (); if (!u.format.sanitize (c)) return TRACE_RETURN (false); @@ -933,15 +913,6 @@ struct CursivePos } } - inline bool apply (hb_apply_context_t *c) const - { - TRACE_APPLY (); - switch (u.format) { - case 1: return TRACE_RETURN (u.format1.apply (c)); - default:return TRACE_RETURN (false); - } - } - inline bool sanitize (hb_sanitize_context_t *c) { TRACE_SANITIZE (); if (!u.format.sanitize (c)) return TRACE_RETURN (false); @@ -1032,15 +1003,6 @@ struct MarkBasePos } } - inline bool apply (hb_apply_context_t *c) const - { - TRACE_APPLY (); - switch (u.format) { - case 1: return TRACE_RETURN (u.format1.apply (c)); - default:return TRACE_RETURN (false); - } - } - inline bool sanitize (hb_sanitize_context_t *c) { TRACE_SANITIZE (); if (!u.format.sanitize (c)) return TRACE_RETURN (false); @@ -1153,15 +1115,6 @@ struct MarkLigPos } } - inline bool apply (hb_apply_context_t *c) const - { - TRACE_APPLY (); - switch (u.format) { - case 1: return TRACE_RETURN (u.format1.apply (c)); - default:return TRACE_RETURN (false); - } - } - inline bool sanitize (hb_sanitize_context_t *c) { TRACE_SANITIZE (); if (!u.format.sanitize (c)) return TRACE_RETURN (false); @@ -1272,15 +1225,6 @@ struct MarkMarkPos } } - inline bool apply (hb_apply_context_t *c) const - { - TRACE_APPLY (); - switch (u.format) { - case 1: return TRACE_RETURN (u.format1.apply (c)); - default:return TRACE_RETURN (false); - } - } - inline bool sanitize (hb_sanitize_context_t *c) { TRACE_SANITIZE (); if (!u.format.sanitize (c)) return TRACE_RETURN (false); @@ -1298,23 +1242,21 @@ struct MarkMarkPos }; -static inline bool position_lookup (hb_apply_context_t *c, unsigned int lookup_index); - struct ContextPos : Context { - inline bool apply (hb_apply_context_t *c) const + template + inline typename context_t::return_t process (context_t *c) const { - TRACE_APPLY (); - return TRACE_RETURN (Context::apply (c, position_lookup)); + return Context::process (c); } }; struct ChainContextPos : ChainContext { - inline bool apply (hb_apply_context_t *c) const + template + inline typename context_t::return_t process (context_t *c) const { - TRACE_APPLY (); - return TRACE_RETURN (ChainContext::apply (c, position_lookup)); + return ChainContext::process (c); } }; @@ -1331,8 +1273,6 @@ struct ExtensionPos : Extension template inline typename context_t::return_t process (context_t *c) const; - inline bool apply (hb_apply_context_t *c) const; - inline bool sanitize (hb_sanitize_context_t *c); }; @@ -1376,23 +1316,6 @@ struct PosLookupSubTable } } - inline bool apply (hb_apply_context_t *c, unsigned int lookup_type) const - { - TRACE_APPLY (); - switch (lookup_type) { - case Single: return TRACE_RETURN (u.single.apply (c)); - case Pair: return TRACE_RETURN (u.pair.apply (c)); - case Cursive: return TRACE_RETURN (u.cursive.apply (c)); - case MarkBase: return TRACE_RETURN (u.markBase.apply (c)); - case MarkLig: return TRACE_RETURN (u.markLig.apply (c)); - case MarkMark: return TRACE_RETURN (u.markMark.apply (c)); - case Context: return TRACE_RETURN (u.context.apply (c)); - case ChainContext: return TRACE_RETURN (u.chainContext.apply (c)); - case Extension: return TRACE_RETURN (u.extension.apply (c)); - default: return TRACE_RETURN (false); - } - } - inline bool sanitize (hb_sanitize_context_t *c, unsigned int lookup_type) { TRACE_SANITIZE (); if (!u.header.sub_format.sanitize (c)) @@ -1471,14 +1394,11 @@ struct PosLookup : Lookup if (!c->check_glyph_property (&c->buffer->cur(), c->lookup_props, &c->property)) return false; - unsigned int count = get_subtable_count (); - for (unsigned int i = 0; i < count; i++) - if (get_subtable (i).apply (c, lookup_type)) - return true; - - return false; + return process (c); } + static bool apply_recurse_func (hb_apply_context_t *c, unsigned int lookup_index); + inline bool apply_string (hb_apply_context_t *c, const hb_set_digest_t *digest) const { bool ret = false; @@ -1486,6 +1406,7 @@ struct PosLookup : Lookup if (unlikely (!c->buffer->len || !c->lookup_mask)) return false; + c->set_recurse_func (apply_recurse_func); c->set_lookup (*this); c->buffer->idx = 0; @@ -1627,12 +1548,6 @@ inline typename context_t::return_t ExtensionPos::process (context_t *c) const return get_subtable ().process (c, get_type ()); } -inline bool ExtensionPos::apply (hb_apply_context_t *c) const -{ - TRACE_APPLY (); - return TRACE_RETURN (get_subtable ().apply (c, get_type ())); -} - inline bool ExtensionPos::sanitize (hb_sanitize_context_t *c) { TRACE_SANITIZE (); @@ -1642,18 +1557,12 @@ inline bool ExtensionPos::sanitize (hb_sanitize_context_t *c) return TRACE_RETURN (StructAtOffset (this, offset).sanitize (c, get_type ())); } -static inline bool position_lookup (hb_apply_context_t *c, unsigned int lookup_index) +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); const PosLookup &l = gpos.get_lookup (lookup_index); - - if (unlikely (c->nesting_level_left == 0)) - return false; - - hb_apply_context_t new_c (*c); - new_c.nesting_level_left--; - new_c.set_lookup (l); - return l.apply_once (&new_c); + c->set_lookup (l); + return l.apply_once (c); } diff --git a/src/hb-ot-layout-gsub-table.hh b/src/hb-ot-layout-gsub-table.hh index 3d43966..f82663a 100644 --- a/src/hb-ot-layout-gsub-table.hh +++ b/src/hb-ot-layout-gsub-table.hh @@ -200,16 +200,6 @@ struct SingleSubst } } - inline bool apply (hb_apply_context_t *c) const - { - TRACE_APPLY (); - switch (u.format) { - case 1: return TRACE_RETURN (u.format1.apply (c)); - case 2: return TRACE_RETURN (u.format2.apply (c)); - default:return TRACE_RETURN (false); - } - } - inline bool serialize (hb_serialize_context_t *c, Supplier &glyphs, Supplier &substitutes, @@ -398,15 +388,6 @@ struct MultipleSubst } } - inline bool apply (hb_apply_context_t *c) const - { - TRACE_APPLY (); - switch (u.format) { - case 1: return TRACE_RETURN (u.format1.apply (c)); - default:return TRACE_RETURN (false); - } - } - inline bool serialize (hb_serialize_context_t *c, Supplier &glyphs, Supplier &substitute_len_list, @@ -556,15 +537,6 @@ struct AlternateSubst } } - inline bool apply (hb_apply_context_t *c) const - { - TRACE_APPLY (); - switch (u.format) { - case 1: return TRACE_RETURN (u.format1.apply (c)); - default:return TRACE_RETURN (false); - } - } - inline bool serialize (hb_serialize_context_t *c, Supplier &glyphs, Supplier &alternate_len_list, @@ -866,15 +838,6 @@ struct LigatureSubst } } - inline bool apply (hb_apply_context_t *c) const - { - TRACE_APPLY (); - switch (u.format) { - case 1: return TRACE_RETURN (u.format1.apply (c)); - default:return TRACE_RETURN (false); - } - } - inline bool serialize (hb_serialize_context_t *c, Supplier &first_glyphs, Supplier &ligature_per_first_glyph_count_list, @@ -911,8 +874,6 @@ struct LigatureSubst }; -static inline bool substitute_lookup (hb_apply_context_t *c, unsigned int lookup_index); - struct ContextSubst : Context { template @@ -920,12 +881,6 @@ struct ContextSubst : Context { return Context::process (c); } - - inline bool apply (hb_apply_context_t *c) const - { - TRACE_APPLY (); - return TRACE_RETURN (Context::apply (c, substitute_lookup)); - } }; struct ChainContextSubst : ChainContext @@ -935,12 +890,6 @@ struct ChainContextSubst : ChainContext { return ChainContext::process (c); } - - inline bool apply (hb_apply_context_t *c) const - { - TRACE_APPLY (); - return TRACE_RETURN (ChainContext::apply (c, substitute_lookup)); - } }; @@ -956,8 +905,6 @@ struct ExtensionSubst : Extension template inline typename context_t::return_t process (context_t *c) const; - inline bool apply (hb_apply_context_t *c) const; - inline bool sanitize (hb_sanitize_context_t *c); inline bool is_reverse (void) const; @@ -1094,15 +1041,6 @@ struct ReverseChainSingleSubst } } - inline bool apply (hb_apply_context_t *c) const - { - TRACE_APPLY (); - switch (u.format) { - case 1: return TRACE_RETURN (u.format1.apply (c)); - default:return TRACE_RETURN (false); - } - } - inline bool sanitize (hb_sanitize_context_t *c) { TRACE_SANITIZE (); if (!u.format.sanitize (c)) return TRACE_RETURN (false); @@ -1156,22 +1094,6 @@ struct SubstLookupSubTable } } - inline bool apply (hb_apply_context_t *c, unsigned int lookup_type) const - { - TRACE_APPLY (); - switch (lookup_type) { - case Single: return TRACE_RETURN (u.single.apply (c)); - case Multiple: return TRACE_RETURN (u.multiple.apply (c)); - case Alternate: return TRACE_RETURN (u.alternate.apply (c)); - case Ligature: return TRACE_RETURN (u.ligature.apply (c)); - case Context: return TRACE_RETURN (u.context.apply (c)); - case ChainContext: return TRACE_RETURN (u.chainContext.apply (c)); - case Extension: return TRACE_RETURN (u.extension.apply (c)); - case ReverseChainSingle: return TRACE_RETURN (u.reverseChainContextSingle.apply (c)); - default: return TRACE_RETURN (false); - } - } - inline bool sanitize (hb_sanitize_context_t *c, unsigned int lookup_type) { TRACE_SANITIZE (); if (!u.header.sub_format.sanitize (c)) @@ -1267,14 +1189,11 @@ struct SubstLookup : Lookup if (!c->check_glyph_property (&c->buffer->cur(), c->lookup_props, &c->property)) return false; - unsigned int count = get_subtable_count (); - for (unsigned int i = 0; i < count; i++) - if (get_subtable (i).apply (c, lookup_type)) - return true; - - return false; + return process (c); } + static bool apply_recurse_func (hb_apply_context_t *c, unsigned int lookup_index); + inline bool apply_string (hb_apply_context_t *c, const hb_set_digest_t *digest) const { bool ret = false; @@ -1282,6 +1201,7 @@ struct SubstLookup : Lookup if (unlikely (!c->buffer->len || !c->lookup_mask)) return false; + c->set_recurse_func (apply_recurse_func); c->set_lookup (*this); if (likely (!is_reverse ())) @@ -1423,7 +1343,7 @@ struct GSUB : GSUBGPOS 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); - static void_t closure_recurse_func (hb_closure_context_t *c, unsigned int lookup_index) + static inline 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); @@ -1483,12 +1403,6 @@ inline typename context_t::return_t ExtensionSubst::process (context_t *c) const return get_subtable ().process (c, get_type ()); } -inline bool ExtensionSubst::apply (hb_apply_context_t *c) const -{ - TRACE_APPLY (); - return TRACE_RETURN (get_subtable ().apply (c, get_type ())); -} - inline bool ExtensionSubst::sanitize (hb_sanitize_context_t *c) { TRACE_SANITIZE (); @@ -1506,18 +1420,12 @@ inline bool ExtensionSubst::is_reverse (void) const return SubstLookup::lookup_type_is_reverse (type); } -static inline bool substitute_lookup (hb_apply_context_t *c, unsigned int lookup_index) +inline bool SubstLookup::apply_recurse_func (hb_apply_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 false; - - hb_apply_context_t new_c (*c); - new_c.nesting_level_left--; - new_c.set_lookup (l); - return l.apply_once (&new_c); + c->set_lookup (l); + return l.apply_once (c); } diff --git a/src/hb-ot-layout-gsubgpos-private.hh b/src/hb-ot-layout-gsubgpos-private.hh index d1381dd..a311cc9 100644 --- a/src/hb-ot-layout-gsubgpos-private.hh +++ b/src/hb-ot-layout-gsubgpos-private.hh @@ -193,11 +193,28 @@ struct hb_get_coverage_context_t struct hb_apply_context_t { + typedef bool return_t; + typedef return_t (*recurse_func_t) (hb_apply_context_t *c, unsigned int lookup_index); + template + inline return_t process (const T &obj) { return obj.apply (this); } + static const return_t default_return_value (void) { return false; } + bool stop_sublookup_iteration (const return_t r) const { return r; } + return_t recurse (unsigned int lookup_index) + { + if (unlikely (nesting_level_left == 0 || !recurse_func)) + return default_return_value (); + + hb_apply_context_t new_c (*this); + new_c.nesting_level_left--; + return recurse_func (&new_c, lookup_index); + } + hb_font_t *font; hb_face_t *face; hb_buffer_t *buffer; hb_direction_t direction; hb_mask_t lookup_mask; + recurse_func_t recurse_func; unsigned int nesting_level_left; unsigned int lookup_props; unsigned int property; /* propety of first glyph */ @@ -212,18 +229,15 @@ struct hb_apply_context_t font (font_), face (font->face), buffer (buffer_), direction (buffer_->props.direction), lookup_mask (lookup_mask_), + recurse_func (NULL), nesting_level_left (MAX_NESTING_LEVEL), lookup_props (0), property (0), debug_depth (0), gdef (*hb_ot_layout_from_face (face)->gdef), has_glyph_classes (gdef.has_glyph_classes ()) {} - void set_lookup_props (unsigned int lookup_props_) { - lookup_props = lookup_props_; - } - - void set_lookup (const Lookup &l) { - lookup_props = l.get_props (); - } + void set_recurse_func (recurse_func_t func) { recurse_func = func; } + void set_lookup_props (unsigned int lookup_props_) { lookup_props = lookup_props_; } + void set_lookup (const Lookup &l) { lookup_props = l.get_props (); } struct mark_skipping_forward_iterator_t { @@ -430,7 +444,6 @@ struct hb_apply_context_t 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 (*apply_lookup_func_t) (hb_apply_context_t *c, unsigned int lookup_index); struct ContextClosureFuncs { @@ -439,7 +452,6 @@ struct ContextClosureFuncs struct ContextApplyFuncs { match_func_t match; - apply_lookup_func_t apply; }; static inline bool intersects_glyph (hb_set_t *glyphs, const USHORT &value, const void *data HB_UNUSED) @@ -739,8 +751,7 @@ static inline void closure_lookup (hb_closure_context_t *c, static inline bool apply_lookup (hb_apply_context_t *c, unsigned int count, /* Including the first glyph */ unsigned int lookupCount, - const LookupRecord lookupRecord[], /* Array of LookupRecords--in design order */ - apply_lookup_func_t apply_func) + const LookupRecord lookupRecord[] /* Array of LookupRecords--in design order */) { hb_auto_trace_t trace (&c->debug_depth, "APPLY", NULL, HB_FUNC, "idx %d codepoint %u", c->buffer->idx, c->buffer->cur().codepoint); unsigned int end = c->buffer->len; @@ -771,7 +782,7 @@ static inline bool apply_lookup (hb_apply_context_t *c, unsigned int old_pos = c->buffer->idx; /* Apply a lookup */ - bool done = apply_func (c, lookupRecord->lookupListIndex); + bool done = c->recurse (lookupRecord->lookupListIndex); lookupRecord++; lookupCount--; @@ -849,8 +860,7 @@ static inline bool context_apply_lookup (hb_apply_context_t *c, lookup_context.funcs.match, lookup_context.match_data) && apply_lookup (c, inputCount, - lookupCount, lookupRecord, - lookup_context.funcs.apply); + lookupCount, lookupRecord); } struct Rule @@ -977,7 +987,7 @@ struct ContextFormat1 const RuleSet &rule_set = this+ruleSet[(this+coverage) (c->glyphs[0])]; struct ContextApplyLookupContext lookup_context = { - {match_glyph, NULL}, + {match_glyph}, NULL }; return TRACE_RETURN (rule_set.would_apply (c, lookup_context)); @@ -988,7 +998,7 @@ struct ContextFormat1 return this+coverage; } - inline bool apply (hb_apply_context_t *c, apply_lookup_func_t apply_func) const + inline bool apply (hb_apply_context_t *c) const { TRACE_APPLY (); unsigned int index = (this+coverage) (c->buffer->cur().codepoint); @@ -997,7 +1007,7 @@ struct ContextFormat1 const RuleSet &rule_set = this+ruleSet[index]; struct ContextApplyLookupContext lookup_context = { - {match_glyph, apply_func}, + {match_glyph}, NULL }; return TRACE_RETURN (rule_set.apply (c, lookup_context)); @@ -1052,7 +1062,7 @@ struct ContextFormat2 unsigned int index = class_def (c->glyphs[0]); const RuleSet &rule_set = this+ruleSet[index]; struct ContextApplyLookupContext lookup_context = { - {match_class, NULL}, + {match_class}, &class_def }; return TRACE_RETURN (rule_set.would_apply (c, lookup_context)); @@ -1063,7 +1073,7 @@ struct ContextFormat2 return this+coverage; } - inline bool apply (hb_apply_context_t *c, apply_lookup_func_t apply_func) const + inline bool apply (hb_apply_context_t *c) const { TRACE_APPLY (); unsigned int index = (this+coverage) (c->buffer->cur().codepoint); @@ -1073,7 +1083,7 @@ struct ContextFormat2 index = class_def (c->buffer->cur().codepoint); const RuleSet &rule_set = this+ruleSet[index]; struct ContextApplyLookupContext lookup_context = { - {match_class, apply_func}, + {match_class}, &class_def }; return TRACE_RETURN (rule_set.apply (c, lookup_context)); @@ -1125,7 +1135,7 @@ struct ContextFormat3 const LookupRecord *lookupRecord = &StructAtOffset (coverage, coverage[0].static_size * glyphCount); struct ContextApplyLookupContext lookup_context = { - {match_coverage, NULL}, + {match_coverage}, this }; return TRACE_RETURN (context_would_apply_lookup (c, glyphCount, (const USHORT *) (coverage + 1), lookupCount, lookupRecord, lookup_context)); @@ -1136,7 +1146,7 @@ struct ContextFormat3 return this+coverage[0]; } - inline bool apply (hb_apply_context_t *c, apply_lookup_func_t apply_func) const + inline bool apply (hb_apply_context_t *c) const { TRACE_APPLY (); unsigned int index = (this+coverage[0]) (c->buffer->cur().codepoint); @@ -1144,7 +1154,7 @@ struct ContextFormat3 const LookupRecord *lookupRecord = &StructAtOffset (coverage, coverage[0].static_size * glyphCount); struct ContextApplyLookupContext lookup_context = { - {match_coverage, apply_func}, + {match_coverage}, this }; return TRACE_RETURN (context_apply_lookup (c, glyphCount, (const USHORT *) (coverage + 1), lookupCount, lookupRecord, lookup_context)); @@ -1188,17 +1198,6 @@ struct Context } } - inline bool apply (hb_apply_context_t *c, apply_lookup_func_t apply_func) const - { - TRACE_APPLY (); - switch (u.format) { - case 1: return TRACE_RETURN (u.format1.apply (c, apply_func)); - case 2: return TRACE_RETURN (u.format2.apply (c, apply_func)); - case 3: return TRACE_RETURN (u.format3.apply (c, apply_func)); - default:return TRACE_RETURN (false); - } - } - inline bool sanitize (hb_sanitize_context_t *c) { TRACE_SANITIZE (); if (!u.format.sanitize (c)) return TRACE_RETURN (false); @@ -1300,8 +1299,7 @@ static inline bool chain_context_apply_lookup (hb_apply_context_t *c, lookahead_offset) && apply_lookup (c, inputCount, - lookupCount, lookupRecord, - lookup_context.funcs.apply); + lookupCount, lookupRecord); } struct ChainRule @@ -1446,7 +1444,7 @@ struct ChainContextFormat1 const ChainRuleSet &rule_set = this+ruleSet[(this+coverage) (c->glyphs[0])]; struct ChainContextApplyLookupContext lookup_context = { - {match_glyph, NULL}, + {match_glyph}, {NULL, NULL, NULL} }; return TRACE_RETURN (rule_set.would_apply (c, lookup_context)); @@ -1457,7 +1455,7 @@ struct ChainContextFormat1 return this+coverage; } - inline bool apply (hb_apply_context_t *c, apply_lookup_func_t apply_func) const + inline bool apply (hb_apply_context_t *c) const { TRACE_APPLY (); unsigned int index = (this+coverage) (c->buffer->cur().codepoint); @@ -1465,7 +1463,7 @@ struct ChainContextFormat1 const ChainRuleSet &rule_set = this+ruleSet[index]; struct ChainContextApplyLookupContext lookup_context = { - {match_glyph, apply_func}, + {match_glyph}, {NULL, NULL, NULL} }; return TRACE_RETURN (rule_set.apply (c, lookup_context)); @@ -1524,7 +1522,7 @@ struct ChainContextFormat2 unsigned int index = input_class_def (c->glyphs[0]); const ChainRuleSet &rule_set = this+ruleSet[index]; struct ChainContextApplyLookupContext lookup_context = { - {match_class, NULL}, + {match_class}, {NULL, &input_class_def, NULL} }; return TRACE_RETURN (rule_set.would_apply (c, lookup_context)); @@ -1535,7 +1533,7 @@ struct ChainContextFormat2 return this+coverage; } - inline bool apply (hb_apply_context_t *c, apply_lookup_func_t apply_func) const + inline bool apply (hb_apply_context_t *c) const { TRACE_APPLY (); unsigned int index = (this+coverage) (c->buffer->cur().codepoint); @@ -1548,7 +1546,7 @@ struct ChainContextFormat2 index = input_class_def (c->buffer->cur().codepoint); const ChainRuleSet &rule_set = this+ruleSet[index]; struct ChainContextApplyLookupContext lookup_context = { - {match_class, apply_func}, + {match_class}, {&backtrack_class_def, &input_class_def, &lookahead_class_def} @@ -1619,7 +1617,7 @@ struct ChainContextFormat3 const OffsetArrayOf &lookahead = StructAfter > (input); const ArrayOf &lookup = StructAfter > (lookahead); struct ChainContextApplyLookupContext lookup_context = { - {match_coverage, NULL}, + {match_coverage}, {this, this, this} }; return TRACE_RETURN (chain_context_would_apply_lookup (c, @@ -1635,7 +1633,7 @@ struct ChainContextFormat3 return this+input[0]; } - inline bool apply (hb_apply_context_t *c, apply_lookup_func_t apply_func) const + inline bool apply (hb_apply_context_t *c) const { TRACE_APPLY (); const OffsetArrayOf &input = StructAfter > (backtrack); @@ -1646,7 +1644,7 @@ struct ChainContextFormat3 const OffsetArrayOf &lookahead = StructAfter > (input); const ArrayOf &lookup = StructAfter > (lookahead); struct ChainContextApplyLookupContext lookup_context = { - {match_coverage, apply_func}, + {match_coverage}, {this, this, this} }; return TRACE_RETURN (chain_context_apply_lookup (c, @@ -1701,17 +1699,6 @@ struct ChainContext } } - inline bool apply (hb_apply_context_t *c, apply_lookup_func_t apply_func) const - { - TRACE_APPLY (); - switch (u.format) { - case 1: return TRACE_RETURN (u.format1.apply (c, apply_func)); - case 2: return TRACE_RETURN (u.format2.apply (c, apply_func)); - case 3: return TRACE_RETURN (u.format3.apply (c, apply_func)); - default:return TRACE_RETURN (false); - } - } - inline bool sanitize (hb_sanitize_context_t *c) { TRACE_SANITIZE (); if (!u.format.sanitize (c)) return TRACE_RETURN (false); diff --git a/src/hb-ot-layout.cc b/src/hb-ot-layout.cc index 9185584..7af75c0 100644 --- a/src/hb-ot-layout.cc +++ b/src/hb-ot-layout.cc @@ -412,7 +412,7 @@ hb_ot_layout_lookup_collect_glyphs (hb_face_t *face, { if (unlikely (!hb_ot_shaper_face_data_ensure (face))) return; - OT::hb_collect_glyphs_context_t c (face, glyphs_before, glyphs_input, glyphs_after, glyphs_output); +// OT::hb_collect_glyphs_context_t c (face, glyphs_before, glyphs_input, glyphs_after, glyphs_output); switch (table_tag) { case HB_OT_TAG_GSUB: -- 2.7.4