changeset 8998:e12f4af19806

8158302: Handle contextual glyph substitutions Reviewed-by: prr
author dmarkov
date Tue, 05 Jul 2016 19:03:39 +0300
parents c99e24994913
children 0c8e1772278f
files src/share/native/sun/font/layout/ContextualGlyphSubstProc.cpp src/share/native/sun/font/layout/ContextualGlyphSubstProc.h src/share/native/sun/font/layout/IndicRearrangementProcessor.cpp src/share/native/sun/font/layout/IndicRearrangementProcessor.h src/share/native/sun/font/layout/LigatureSubstProc.cpp src/share/native/sun/font/layout/LigatureSubstProc.h src/share/native/sun/font/layout/StateTableProcessor.cpp src/share/native/sun/font/layout/StateTableProcessor.h
diffstat 8 files changed, 13 insertions(+), 12 deletions(-) [+]
line wrap: on
line diff
--- a/src/share/native/sun/font/layout/ContextualGlyphSubstProc.cpp	Wed Jul 06 17:56:09 2016 +0300
+++ b/src/share/native/sun/font/layout/ContextualGlyphSubstProc.cpp	Tue Jul 05 19:03:39 2016 +0300
@@ -46,6 +46,7 @@
 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 @@
     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);
--- a/src/share/native/sun/font/layout/ContextualGlyphSubstProc.h	Wed Jul 06 17:56:09 2016 +0300
+++ b/src/share/native/sun/font/layout/ContextualGlyphSubstProc.h	Tue Jul 05 19:03:39 2016 +0300
@@ -52,7 +52,7 @@
 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();
 
--- a/src/share/native/sun/font/layout/IndicRearrangementProcessor.cpp	Wed Jul 06 17:56:09 2016 +0300
+++ b/src/share/native/sun/font/layout/IndicRearrangementProcessor.cpp	Tue Jul 05 19:03:39 2016 +0300
@@ -63,10 +63,10 @@
     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);
 
--- a/src/share/native/sun/font/layout/IndicRearrangementProcessor.h	Wed Jul 06 17:56:09 2016 +0300
+++ b/src/share/native/sun/font/layout/IndicRearrangementProcessor.h	Tue Jul 05 19:03:39 2016 +0300
@@ -52,7 +52,7 @@
 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();
 
--- a/src/share/native/sun/font/layout/LigatureSubstProc.cpp	Wed Jul 06 17:56:09 2016 +0300
+++ b/src/share/native/sun/font/layout/LigatureSubstProc.cpp	Tue Jul 05 19:03:39 2016 +0300
@@ -67,9 +67,8 @@
     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++;
--- a/src/share/native/sun/font/layout/LigatureSubstProc.h	Wed Jul 06 17:56:09 2016 +0300
+++ b/src/share/native/sun/font/layout/LigatureSubstProc.h	Tue Jul 05 19:03:39 2016 +0300
@@ -54,7 +54,7 @@
 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();
 
--- a/src/share/native/sun/font/layout/StateTableProcessor.cpp	Wed Jul 06 17:56:09 2016 +0300
+++ b/src/share/native/sun/font/layout/StateTableProcessor.cpp	Tue Jul 05 19:03:39 2016 +0300
@@ -81,6 +81,7 @@
 
     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 @@
         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);
     }
 
--- a/src/share/native/sun/font/layout/StateTableProcessor.h	Wed Jul 06 17:56:09 2016 +0300
+++ b/src/share/native/sun/font/layout/StateTableProcessor.h	Tue Jul 05 19:03:39 2016 +0300
@@ -53,7 +53,7 @@
 
     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;