From 1ec90514f69efc329691186466f62373efa863b1 Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Thu, 24 Jan 2019 17:21:41 +0100 Subject: [PATCH] [AAT] Minor --- src/hb-aat-layout-common.hh | 12 +++--- src/hb-aat-layout-kerx-table.hh | 38 +++++++++--------- src/hb-aat-layout-morx-table.hh | 68 ++++++++++++++++----------------- 3 files changed, 59 insertions(+), 59 deletions(-) diff --git a/src/hb-aat-layout-common.hh b/src/hb-aat-layout-common.hh index c6205e752..76ba98997 100644 --- a/src/hb-aat-layout-common.hh +++ b/src/hb-aat-layout-common.hh @@ -753,7 +753,7 @@ struct StateTableDriver machine.get_class (buffer->info[buffer->idx].codepoint, num_glyphs) : (unsigned) StateTable::CLASS_END_OF_TEXT; DEBUG_MSG (APPLY, nullptr, "c%u at %u", klass, buffer->idx); - const Entry *entry = &machine.get_entry (state, klass); + const Entry &entry = machine.get_entry (state, klass); /* Unsafe-to-break before this if not in state 0, as things might * go differently if we start from state 0 here. @@ -764,15 +764,15 @@ struct StateTableDriver /* If there's no action and we're just epsilon-transitioning to state 0, * safe to break. */ if (c->is_actionable (this, entry) || - !(entry->newState == StateTable::STATE_START_OF_TEXT && - entry->flags == context_t::DontAdvance)) + !(entry.newState == StateTable::STATE_START_OF_TEXT && + entry.flags == context_t::DontAdvance)) buffer->unsafe_to_break_from_outbuffer (buffer->backtrack_len () - 1, buffer->idx + 1); } /* Unsafe-to-break if end-of-text would kick in here. */ if (buffer->idx + 2 <= buffer->len) { - const Entry *end_entry = &machine.get_entry (state, StateTable::CLASS_END_OF_TEXT); + const Entry &end_entry = machine.get_entry (state, StateTable::CLASS_END_OF_TEXT); if (c->is_actionable (this, end_entry)) buffer->unsafe_to_break (buffer->idx, buffer->idx + 2); } @@ -780,13 +780,13 @@ struct StateTableDriver if (unlikely (!c->transition (this, entry))) break; - state = machine.new_state (entry->newState); + state = machine.new_state (entry.newState); DEBUG_MSG (APPLY, nullptr, "s%d", state); if (buffer->idx == buffer->len) break; - if (!(entry->flags & context_t::DontAdvance) || buffer->max_ops-- <= 0) + if (!(entry.flags & context_t::DontAdvance) || buffer->max_ops-- <= 0) buffer->next_glyph (); } diff --git a/src/hb-aat-layout-kerx-table.hh b/src/hb-aat-layout-kerx-table.hh index ac562e408..0630fba6c 100644 --- a/src/hb-aat-layout-kerx-table.hh +++ b/src/hb-aat-layout-kerx-table.hh @@ -170,11 +170,11 @@ struct Format1Entry DEFINE_SIZE_STATIC (2); }; - static bool performAction (const Entry *entry) - { return entry->data.kernActionIndex != 0xFFFF; } + static bool performAction (const Entry &entry) + { return entry.data.kernActionIndex != 0xFFFF; } - static unsigned int kernActionIndex (const Entry *entry) - { return entry->data.kernActionIndex; } + static unsigned int kernActionIndex (const Entry &entry) + { return entry.data.kernActionIndex; } }; template <> struct Format1Entry @@ -192,11 +192,11 @@ struct Format1Entry typedef void EntryData; - static bool performAction (const Entry *entry) - { return entry->flags & Offset; } + static bool performAction (const Entry &entry) + { return entry.flags & Offset; } - static unsigned int kernActionIndex (const Entry *entry) - { return entry->flags & Offset; } + static unsigned int kernActionIndex (const Entry &entry) + { return entry.flags & Offset; } }; template @@ -228,15 +228,15 @@ struct KerxSubTableFormat1 crossStream (table->header.coverage & table->header.CrossStream) {} bool is_actionable (StateTableDriver *driver HB_UNUSED, - const Entry *entry) + const Entry &entry) { return Format1EntryT::performAction (entry); } bool transition (StateTableDriver *driver, - const Entry *entry) + const Entry &entry) { hb_buffer_t *buffer = driver->buffer; - unsigned int flags = entry->flags; + unsigned int flags = entry.flags; if (flags & Format1EntryT::Reset) depth = 0; @@ -498,16 +498,16 @@ struct KerxSubTableFormat4 mark (0) {} bool is_actionable (StateTableDriver *driver HB_UNUSED, - const Entry *entry) + const Entry &entry) { - return entry->data.ankrActionIndex != 0xFFFF; + return entry.data.ankrActionIndex != 0xFFFF; } bool transition (StateTableDriver *driver, - const Entry *entry) + const Entry &entry) { hb_buffer_t *buffer = driver->buffer; - if (mark_set && entry->data.ankrActionIndex != 0xFFFF && buffer->idx < buffer->len) + if (mark_set && entry.data.ankrActionIndex != 0xFFFF && buffer->idx < buffer->len) { hb_glyph_position_t &o = buffer->cur_pos(); switch (action_type) @@ -515,7 +515,7 @@ struct KerxSubTableFormat4 case 0: /* Control Point Actions.*/ { /* indexed into glyph outline. */ - const HBUINT16 *data = &ankrData[entry->data.ankrActionIndex]; + const HBUINT16 *data = &ankrData[entry.data.ankrActionIndex]; if (!c->sanitizer.check_array (data, 2)) return false; HB_UNUSED unsigned int markControlPoint = *data++; @@ -542,7 +542,7 @@ struct KerxSubTableFormat4 case 1: /* Anchor Point Actions. */ { /* Indexed into 'ankr' table. */ - const HBUINT16 *data = &ankrData[entry->data.ankrActionIndex]; + const HBUINT16 *data = &ankrData[entry.data.ankrActionIndex]; if (!c->sanitizer.check_array (data, 2)) return false; unsigned int markAnchorPoint = *data++; @@ -561,7 +561,7 @@ struct KerxSubTableFormat4 case 2: /* Control Point Coordinate Actions. */ { - const FWORD *data = (const FWORD *) &ankrData[entry->data.ankrActionIndex]; + const FWORD *data = (const FWORD *) &ankrData[entry.data.ankrActionIndex]; if (!c->sanitizer.check_array (data, 4)) return false; int markX = *data++; @@ -579,7 +579,7 @@ struct KerxSubTableFormat4 buffer->scratch_flags |= HB_BUFFER_SCRATCH_FLAG_HAS_GPOS_ATTACHMENT; } - if (entry->flags & Mark) + if (entry.flags & Mark) { mark_set = true; mark = buffer->idx; diff --git a/src/hb-aat-layout-morx-table.hh b/src/hb-aat-layout-morx-table.hh index 2ebbc3511..564a618e0 100644 --- a/src/hb-aat-layout-morx-table.hh +++ b/src/hb-aat-layout-morx-table.hh @@ -74,15 +74,15 @@ struct RearrangementSubtable start (0), end (0) {} bool is_actionable (StateTableDriver *driver HB_UNUSED, - const Entry *entry) + const Entry &entry) { - return (entry->flags & Verb) && start < end; + return (entry.flags & Verb) && start < end; } bool transition (StateTableDriver *driver, - const Entry *entry) + const Entry &entry) { hb_buffer_t *buffer = driver->buffer; - unsigned int flags = entry->flags; + unsigned int flags = entry.flags; if (flags & MarkFirst) start = buffer->idx; @@ -223,17 +223,17 @@ struct ContextualSubtable subs (table+table->substitutionTables) {} bool is_actionable (StateTableDriver *driver, - const Entry *entry) + const Entry &entry) { hb_buffer_t *buffer = driver->buffer; if (buffer->idx == buffer->len && !mark_set) return false; - return entry->data.markIndex != 0xFFFF || entry->data.currentIndex != 0xFFFF; + return entry.data.markIndex != 0xFFFF || entry.data.currentIndex != 0xFFFF; } bool transition (StateTableDriver *driver, - const Entry *entry) + const Entry &entry) { hb_buffer_t *buffer = driver->buffer; @@ -247,15 +247,15 @@ struct ContextualSubtable replacement = nullptr; if (Types::extended) { - if (entry->data.markIndex != 0xFFFF) + if (entry.data.markIndex != 0xFFFF) { - const Lookup &lookup = subs[entry->data.markIndex]; + const Lookup &lookup = subs[entry.data.markIndex]; replacement = lookup.get_value (buffer->info[mark].codepoint, driver->num_glyphs); } } else { - unsigned int offset = entry->data.markIndex + buffer->info[mark].codepoint; + unsigned int offset = entry.data.markIndex + buffer->info[mark].codepoint; const UnsizedArrayOf &subs_old = (const UnsizedArrayOf &) subs; replacement = &subs_old[Types::wordOffsetToIndex (offset, table, subs_old.arrayZ)]; if (!replacement->sanitize (&c->sanitizer) || !*replacement) @@ -272,15 +272,15 @@ struct ContextualSubtable unsigned int idx = MIN (buffer->idx, buffer->len - 1); if (Types::extended) { - if (entry->data.currentIndex != 0xFFFF) + if (entry.data.currentIndex != 0xFFFF) { - const Lookup &lookup = subs[entry->data.currentIndex]; + const Lookup &lookup = subs[entry.data.currentIndex]; replacement = lookup.get_value (buffer->info[idx].codepoint, driver->num_glyphs); } } else { - unsigned int offset = entry->data.currentIndex + buffer->info[idx].codepoint; + unsigned int offset = entry.data.currentIndex + buffer->info[idx].codepoint; const UnsizedArrayOf &subs_old = (const UnsizedArrayOf &) subs; replacement = &subs_old[Types::wordOffsetToIndex (offset, table, subs_old.arrayZ)]; if (!replacement->sanitize (&c->sanitizer) || !*replacement) @@ -292,7 +292,7 @@ struct ContextualSubtable ret = true; } - if (entry->flags & SetMark) + if (entry.flags & SetMark) { mark_set = true; mark = buffer->idx; @@ -385,11 +385,11 @@ struct LigatureEntry DEFINE_SIZE_STATIC (2); }; - static bool performAction (const Entry *entry) - { return entry->flags & PerformAction; } + static bool performAction (const Entry &entry) + { return entry.flags & PerformAction; } - static unsigned int ligActionIndex (const Entry *entry) - { return entry->data.ligActionIndex; } + static unsigned int ligActionIndex (const Entry &entry) + { return entry.data.ligActionIndex; } }; template <> struct LigatureEntry @@ -407,11 +407,11 @@ struct LigatureEntry typedef void EntryData; - static bool performAction (const Entry *entry) - { return entry->flags & Offset; } + static bool performAction (const Entry &entry) + { return entry.flags & Offset; } - static unsigned int ligActionIndex (const Entry *entry) - { return entry->flags & Offset; } + static unsigned int ligActionIndex (const Entry &entry) + { return entry.flags & Offset; } }; @@ -453,17 +453,17 @@ struct LigatureSubtable match_length (0) {} bool is_actionable (StateTableDriver *driver HB_UNUSED, - const Entry *entry) + const Entry &entry) { return LigatureEntryT::performAction (entry); } bool transition (StateTableDriver *driver, - const Entry *entry) + const Entry &entry) { hb_buffer_t *buffer = driver->buffer; DEBUG_MSG (APPLY, nullptr, "Ligature transition at %u", buffer->idx); - if (entry->flags & LigatureEntryT::SetComponent) + if (entry.flags & LigatureEntryT::SetComponent) { if (unlikely (match_length >= ARRAY_LENGTH (match_positions))) return false; @@ -718,23 +718,23 @@ struct InsertionSubtable insertionAction (table+table->insertionAction) {} bool is_actionable (StateTableDriver *driver HB_UNUSED, - const Entry *entry) + const Entry &entry) { - return (entry->flags & (CurrentInsertCount | MarkedInsertCount)) && - (entry->data.currentInsertIndex != 0xFFFF ||entry->data.markedInsertIndex != 0xFFFF); + return (entry.flags & (CurrentInsertCount | MarkedInsertCount)) && + (entry.data.currentInsertIndex != 0xFFFF ||entry.data.markedInsertIndex != 0xFFFF); } bool transition (StateTableDriver *driver, - const Entry *entry) + const Entry &entry) { hb_buffer_t *buffer = driver->buffer; - unsigned int flags = entry->flags; + unsigned int flags = entry.flags; unsigned mark_loc = buffer->out_len; - if (entry->data.markedInsertIndex != 0xFFFF) + if (entry.data.markedInsertIndex != 0xFFFF) { unsigned int count = (flags & MarkedInsertCount); - unsigned int start = entry->data.markedInsertIndex; + unsigned int start = entry.data.markedInsertIndex; const GlyphID *glyphs = &insertionAction[start]; if (unlikely (!c->sanitizer.check_array (glyphs, count))) return false; @@ -759,10 +759,10 @@ struct InsertionSubtable if (flags & SetMark) mark = mark_loc; - if (entry->data.currentInsertIndex != 0xFFFF) + if (entry.data.currentInsertIndex != 0xFFFF) { unsigned int count = (flags & CurrentInsertCount) >> 5; - unsigned int start = entry->data.currentInsertIndex; + unsigned int start = entry.data.currentInsertIndex; const GlyphID *glyphs = &insertionAction[start]; if (unlikely (!c->sanitizer.check_array (glyphs, count))) return false;