8158302: Handle contextual glyph substitutions
Reviewed-by: prr, serb, mschoene
This commit is contained in:
parent
1589a80056
commit
d2e68b6830
@ -46,6 +46,7 @@ UOBJECT_DEFINE_RTTI_IMPLEMENTATION(ContextualGlyphSubstitutionProcessor)
|
||||
ContextualGlyphSubstitutionProcessor::ContextualGlyphSubstitutionProcessor(const LEReferenceTo<MorphSubtableHeader> &morphSubtableHeader, LEErrorCode &success)
|
||||
: StateTableProcessor(morphSubtableHeader, success), entryTable(), contextualGlyphSubstitutionHeader(morphSubtableHeader, success)
|
||||
{
|
||||
if (LE_FAILURE(success)) return;
|
||||
contextualGlyphSubstitutionHeader.orphan();
|
||||
substitutionTableOffset = SWAPW(contextualGlyphSubstitutionHeader->substitutionTableOffset);
|
||||
|
||||
@ -66,10 +67,10 @@ void ContextualGlyphSubstitutionProcessor::beginStateTable()
|
||||
markGlyph = 0;
|
||||
}
|
||||
|
||||
ByteOffset ContextualGlyphSubstitutionProcessor::processStateEntry(LEGlyphStorage &glyphStorage, le_int32 &currGlyph, EntryTableIndex index)
|
||||
ByteOffset ContextualGlyphSubstitutionProcessor::processStateEntry(LEGlyphStorage &glyphStorage, le_int32 &currGlyph, EntryTableIndex index, LEErrorCode &success)
|
||||
{
|
||||
LEErrorCode success = LE_NO_ERROR;
|
||||
const ContextualGlyphSubstitutionStateEntry *entry = entryTable.getAlias(index, success);
|
||||
if (LE_FAILURE(success)) return 0;
|
||||
ByteOffset newState = SWAPW(entry->newStateOffset);
|
||||
le_int16 flags = SWAPW(entry->flags);
|
||||
WordOffset markOffset = SWAPW(entry->markOffset);
|
||||
|
@ -52,7 +52,7 @@ class ContextualGlyphSubstitutionProcessor : public StateTableProcessor
|
||||
public:
|
||||
virtual void beginStateTable();
|
||||
|
||||
virtual ByteOffset processStateEntry(LEGlyphStorage &glyphStorage, le_int32 &currGlyph, EntryTableIndex index);
|
||||
virtual ByteOffset processStateEntry(LEGlyphStorage &glyphStorage, le_int32 &currGlyph, EntryTableIndex index, LEErrorCode &success);
|
||||
|
||||
virtual void endStateTable();
|
||||
|
||||
|
@ -63,10 +63,10 @@ void IndicRearrangementProcessor::beginStateTable()
|
||||
lastGlyph = 0;
|
||||
}
|
||||
|
||||
ByteOffset IndicRearrangementProcessor::processStateEntry(LEGlyphStorage &glyphStorage, le_int32 &currGlyph, EntryTableIndex index)
|
||||
ByteOffset IndicRearrangementProcessor::processStateEntry(LEGlyphStorage &glyphStorage, le_int32 &currGlyph, EntryTableIndex index, LEErrorCode &success)
|
||||
{
|
||||
LEErrorCode success = LE_NO_ERROR; // todo- make a param?
|
||||
const IndicRearrangementStateEntry *entry = entryTable.getAlias(index,success);
|
||||
const IndicRearrangementStateEntry *entry = entryTable.getAlias(index, success);
|
||||
if (LE_FAILURE(success)) return 0;
|
||||
ByteOffset newState = SWAPW(entry->newStateOffset);
|
||||
IndicRearrangementFlags flags = (IndicRearrangementFlags) SWAPW(entry->flags);
|
||||
|
||||
|
@ -52,7 +52,7 @@ class IndicRearrangementProcessor : public StateTableProcessor
|
||||
public:
|
||||
virtual void beginStateTable();
|
||||
|
||||
virtual ByteOffset processStateEntry(LEGlyphStorage &glyphStorage, le_int32 &currGlyph, EntryTableIndex index);
|
||||
virtual ByteOffset processStateEntry(LEGlyphStorage &glyphStorage, le_int32 &currGlyph, EntryTableIndex index, LEErrorCode &success);
|
||||
|
||||
virtual void endStateTable();
|
||||
|
||||
|
@ -67,9 +67,8 @@ void LigatureSubstitutionProcessor::beginStateTable()
|
||||
m = -1;
|
||||
}
|
||||
|
||||
ByteOffset LigatureSubstitutionProcessor::processStateEntry(LEGlyphStorage &glyphStorage, le_int32 &currGlyph, EntryTableIndex index)
|
||||
ByteOffset LigatureSubstitutionProcessor::processStateEntry(LEGlyphStorage &glyphStorage, le_int32 &currGlyph, EntryTableIndex index, LEErrorCode &success)
|
||||
{
|
||||
LEErrorCode success = LE_NO_ERROR;
|
||||
const LigatureSubstitutionStateEntry *entry = entryTable.getAlias(index, success);
|
||||
if (LE_FAILURE(success)) {
|
||||
currGlyph++;
|
||||
|
@ -54,7 +54,7 @@ class LigatureSubstitutionProcessor : public StateTableProcessor
|
||||
public:
|
||||
virtual void beginStateTable();
|
||||
|
||||
virtual ByteOffset processStateEntry(LEGlyphStorage &glyphStorage, le_int32 &currGlyph, EntryTableIndex index);
|
||||
virtual ByteOffset processStateEntry(LEGlyphStorage &glyphStorage, le_int32 &currGlyph, EntryTableIndex index, LEErrorCode &success);
|
||||
|
||||
virtual void endStateTable();
|
||||
|
||||
|
@ -81,6 +81,7 @@ void StateTableProcessor::process(LEGlyphStorage &glyphStorage, LEErrorCode &suc
|
||||
|
||||
while (currGlyph <= glyphCount) {
|
||||
if(LE_STATE_PATIENCE_DECR()) break; // patience exceeded.
|
||||
if (LE_FAILURE(success)) break;
|
||||
ClassCode classCode = classCodeOOB;
|
||||
if (currGlyph == glyphCount) {
|
||||
// XXX: How do we handle EOT vs. EOL?
|
||||
@ -100,7 +101,7 @@ void StateTableProcessor::process(LEGlyphStorage &glyphStorage, LEErrorCode &suc
|
||||
EntryTableIndex entryTableIndex = stateArray.getObject((le_uint8)classCode, success);
|
||||
if (LE_FAILURE(success)) { break; }
|
||||
LE_STATE_PATIENCE_CURR(le_int32, currGlyph);
|
||||
currentState = processStateEntry(glyphStorage, currGlyph, entryTableIndex);
|
||||
currentState = processStateEntry(glyphStorage, currGlyph, entryTableIndex, success);
|
||||
LE_STATE_PATIENCE_INCR(currGlyph);
|
||||
}
|
||||
|
||||
|
@ -53,7 +53,7 @@ public:
|
||||
|
||||
virtual void beginStateTable() = 0;
|
||||
|
||||
virtual ByteOffset processStateEntry(LEGlyphStorage &glyphStorage, le_int32 &currGlyph, EntryTableIndex index) = 0;
|
||||
virtual ByteOffset processStateEntry(LEGlyphStorage &glyphStorage, le_int32 &currGlyph, EntryTableIndex index, LEErrorCode &success) = 0;
|
||||
|
||||
virtual void endStateTable() = 0;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user