# HG changeset patch # User vadim # Date 1379609780 -14400 # Node ID 97c4591b09c54e650f0befb5f106700404c5f927 # Parent 47e0b80c2703c06a68175234a1d4a0a78ee648aa 8025034: Improve layout lookups Reviewed-by: mschoene, vadim, srl diff -r 47e0b80c2703 -r 97c4591b09c5 src/share/native/sun/font/layout/LookupProcessor.cpp --- a/src/share/native/sun/font/layout/LookupProcessor.cpp Sun Oct 20 06:12:08 2013 -0700 +++ b/src/share/native/sun/font/layout/LookupProcessor.cpp Thu Sep 19 20:56:20 2013 +0400 @@ -144,7 +144,7 @@ le_int32 LookupProcessor::selectLookups(const LEReferenceTo &featureTable, FeatureMask featureMask, le_int32 order, LEErrorCode &success) { le_uint16 lookupCount = featureTable.isValid()? SWAPW(featureTable->lookupCount) : 0; - le_int32 store = order; + le_uint32 store = (le_uint32)order; LEReferenceToArrayOf lookupListIndexArray(featureTable, success, featureTable->lookupListIndexArray, lookupCount); @@ -153,6 +153,9 @@ if (lookupListIndex >= lookupSelectCount) { continue; } + if (store >= lookupOrderCount) { + continue; + } lookupSelectArray[lookupListIndex] |= featureMask; lookupOrderArray[store++] = lookupListIndex; @@ -252,7 +255,7 @@ if (requiredFeatureIndex != 0xFFFF) { requiredFeatureTable = featureListTable->getFeatureTable(featureListTable, requiredFeatureIndex, &requiredFeatureTag, success); - featureReferences += SWAPW(featureTable->lookupCount); + featureReferences += SWAPW(requiredFeatureTable->lookupCount); } lookupOrderArray = LE_NEW_ARRAY(le_uint16, featureReferences); @@ -260,6 +263,7 @@ success = LE_MEMORY_ALLOCATION_ERROR; return; } + lookupOrderCount = featureReferences; for (le_int32 f = 0; f < featureMapCount; f += 1) { FeatureMap fm = featureMap[f];