8055489: Better substitution formats
authorprr
Thu, 11 Sep 2014 10:10:16 -0700
changeset 28547 16e96997b7fa
parent 28546 47d9b4eb8fad
child 28548 d7186302dcf9
8055489: Better substitution formats Reviewed-by: srl, bae, mschoene
jdk/src/java.desktop/share/native/libfontmanager/layout/ContextualSubstSubtables.cpp
jdk/src/java.desktop/share/native/libfontmanager/layout/LETableReference.h
--- a/jdk/src/java.desktop/share/native/libfontmanager/layout/ContextualSubstSubtables.cpp	Thu Sep 11 13:04:18 2014 +0400
+++ b/jdk/src/java.desktop/share/native/libfontmanager/layout/ContextualSubstSubtables.cpp	Thu Sep 11 10:10:16 2014 -0700
@@ -583,6 +583,8 @@
                 LEReferenceTo<ChainSubClassRuleTable>
                      chainSubClassRuleTable(chainSubClassSetTable, success, chainSubClassRuleTableOffset);
                 le_uint16 backtrackGlyphCount = SWAPW(chainSubClassRuleTable->backtrackGlyphCount);
+                LEReferenceToArrayOf<le_uint16>   backtrackClassArray(base, success, chainSubClassRuleTable->backtrackClassArray, backtrackGlyphCount);
+                if( LE_FAILURE(success) ) { return 0; }
                 le_uint16 inputGlyphCount = SWAPW(chainSubClassRuleTable->backtrackClassArray[backtrackGlyphCount]) - 1;
                 LEReferenceToArrayOf<le_uint16>   inputClassArray(base, success, &chainSubClassRuleTable->backtrackClassArray[backtrackGlyphCount + 1],inputGlyphCount+2); // +2 for the lookaheadGlyphCount count
                 le_uint16 lookaheadGlyphCount = SWAPW(inputClassArray.getObject(inputGlyphCount, success));
@@ -599,8 +601,6 @@
                 }
 
                 tempIterator.prev();
-                LEReferenceToArrayOf<le_uint16>   backtrackClassArray(base, success, chainSubClassRuleTable->backtrackClassArray, backtrackGlyphCount);
-                if( LE_FAILURE(success) ) { return 0; }
                 if (! matchGlyphClasses(backtrackClassArray, backtrackGlyphCount,
                                         &tempIterator, backtrackClassDefinitionTable, success, TRUE)) {
                     continue;
--- a/jdk/src/java.desktop/share/native/libfontmanager/layout/LETableReference.h	Thu Sep 11 13:04:18 2014 +0400
+++ b/jdk/src/java.desktop/share/native/libfontmanager/layout/LETableReference.h	Thu Sep 11 10:10:16 2014 -0700
@@ -470,7 +470,12 @@
 #endif
 
   const T& getObject(le_uint32 i, LEErrorCode &success) const {
-    return *getAlias(i,success);
+      const T *ret = getAlias(i, success);
+      if (LE_FAILURE(success) || ret==NULL) {
+          return *(new T(0));
+      } else {
+          return *ret;
+     }
   }
 
   /**