[aat] Divide the logic of is_actionable() into two

The two different uses require different logic. I had combined
the two logic into one in 37bfdf79c6
pull/5041/head
Behdad Esfahbod 1 week ago
parent b4787838e4
commit 849b17351e
  1. 4
      src/hb-aat-layout-common.hh
  2. 15
      src/hb-aat-layout-kerx-table.hh
  3. 28
      src/hb-aat-layout-morx-table.hh

@ -718,7 +718,7 @@ struct StateTable
{
const auto &entry = get_entry (STATE_START_OF_TEXT, i);
if (new_state (entry.newState) == STATE_START_OF_TEXT &&
!table.is_actionable (entry))
!table.is_action_initiable (entry) && !table.is_actionable (entry))
continue;
filter.add (i);
@ -1038,7 +1038,7 @@ struct StateTableDriver
bool is_idempotent_on_all_out_of_bounds (context_t *c, hb_aat_apply_context_t *ac)
{
const auto entry = machine.get_entry (StateTableT::STATE_START_OF_TEXT, CLASS_OUT_OF_BOUNDS);
return !c->table->is_actionable (entry) &&
return !c->table->is_action_initiable (entry) &&
machine.new_state (entry.newState) == StateTableT::STATE_START_OF_TEXT;
}

@ -207,6 +207,9 @@ struct Format1Entry<false>
typedef void EntryData;
static bool initiateAction (const Entry<EntryData> &entry)
{ return entry.flags & Push; }
static bool performAction (const Entry<EntryData> &entry)
{ return entry.flags & Offset; }
@ -228,6 +231,10 @@ struct KerxSubTableFormat1
DontAdvance = Format1EntryT::DontAdvance,
};
bool is_action_initiable (const Entry<EntryData> &entry) const
{
return Format1EntryT::initiateAction (entry);
}
bool is_actionable (const Entry<EntryData> &entry) const
{ return Format1EntryT::performAction (entry); }
@ -509,8 +516,14 @@ struct KerxSubTableFormat4
Reserved = 0x3FFF, /* Not used; set to 0. */
};
bool is_action_initiable (const Entry<EntryData> &entry) const
{
return (entry.flags & Mark);
}
bool is_actionable (const Entry<EntryData> &entry) const
{ return entry.data.ankrActionIndex != 0xFFFF; }
{
return entry.data.ankrActionIndex != 0xFFFF;
}
struct driver_context_t
{

@ -67,9 +67,13 @@ struct RearrangementSubtable
Verb = 0x000F, /* The type of rearrangement specified. */
};
bool is_action_initiable (const Entry<EntryData> &entry) const
{
return (entry.flags & MarkFirst);
}
bool is_actionable (const Entry<EntryData> &entry) const
{
return (entry.flags & (MarkFirst | MarkLast | Verb));
return (entry.flags & Verb);
}
struct driver_context_t
@ -220,9 +224,13 @@ struct ContextualSubtable
Reserved = 0x3FFF, /* These bits are reserved and should be set to 0. */
};
bool is_action_initiable (const Entry<EntryData> &entry) const
{
return (entry.flags & SetMark);
}
bool is_actionable (const Entry<EntryData> &entry) const
{
return (entry.flags & SetMark) || entry.data.markIndex != 0xFFFF || entry.data.currentIndex != 0xFFFF;
return entry.data.markIndex != 0xFFFF || entry.data.currentIndex != 0xFFFF;
}
struct driver_context_t
@ -417,6 +425,9 @@ struct LigatureEntry<true>
Reserved = 0x1FFF, /* These bits are reserved and should be set to 0. */
};
static bool initiateAction (const Entry<EntryData> &entry)
{ return entry.flags & SetComponent; }
static bool performAction (const Entry<EntryData> &entry)
{ return entry.flags & PerformAction; }
@ -439,6 +450,9 @@ struct LigatureEntry<false>
* multiple of 4. */
};
static bool initiateAction (const Entry<EntryData> &entry)
{ return entry.flags & SetComponent; }
static bool performAction (const Entry<EntryData> &entry)
{ return entry.flags & Offset; }
@ -460,6 +474,10 @@ struct LigatureSubtable
DontAdvance = LigatureEntryT::DontAdvance,
};
bool is_action_initiable (const Entry<EntryData> &entry) const
{
return LigatureEntryT::initiateAction (entry);
}
bool is_actionable (const Entry<EntryData> &entry) const
{
return LigatureEntryT::performAction (entry);
@ -739,7 +757,7 @@ struct InsertionSubtable
enum Flags
{
SetMark = 0x8000, /* If set, mark the current glyph. */
DontAdvance = 0x4000, /* If set, don't advance to the next glyph before
DontAdvance = 0x4000, /* If set, don't advance to the next glyph before
* going to the new state. This does not mean
* that the glyph pointed to is the same one as
* before. If you've made insertions immediately
@ -784,6 +802,10 @@ struct InsertionSubtable
* marked location is 31 glyphs. */
};
bool is_action_initiable (const Entry<EntryData> &entry) const
{
return (entry.flags & SetMark);
}
bool is_actionable (const Entry<EntryData> &entry) const
{
return (entry.flags & (CurrentInsertCount | MarkedInsertCount)) &&

Loading…
Cancel
Save