/*
- * (C) Copyright IBM Corp. 1998-2005 - All Rights Reserved
+ * (C) Copyright IBM Corp. 1998-2013 - All Rights Reserved
*
*/
le_uint16 substCount,
GlyphIterator *glyphIterator,
const LEFontInstance *fontInstance,
- le_int32 position)
+ le_int32 position,
+ LEErrorCode& success)
{
+ if (LE_FAILURE(success)) {
+ return;
+ }
+
GlyphIterator tempIterator(*glyphIterator);
- for (le_int16 subst = 0; subst < substCount; subst += 1) {
+ for (le_int16 subst = 0; subst < substCount && LE_SUCCESS(success); subst += 1) {
le_uint16 sequenceIndex = SWAPW(substLookupRecordArray[subst].sequenceIndex);
le_uint16 lookupListIndex = SWAPW(substLookupRecordArray[subst].lookupListIndex);
tempIterator.setCurrStreamPosition(position);
tempIterator.next(sequenceIndex);
- lookupProcessor->applySingleLookup(lookupListIndex, &tempIterator, fontInstance);
+ lookupProcessor->applySingleLookup(lookupListIndex, &tempIterator, fontInstance, success);
}
}
return TRUE;
}
-le_uint32 ContextualSubstitutionSubtable::process(const LookupProcessor *lookupProcessor, GlyphIterator *glyphIterator,
- const LEFontInstance *fontInstance) const
+le_uint32 ContextualSubstitutionSubtable::process(const LookupProcessor *lookupProcessor,
+ GlyphIterator *glyphIterator,
+ const LEFontInstance *fontInstance,
+ LEErrorCode& success) const
{
+ if (LE_FAILURE(success)) {
+ return 0;
+ }
+
switch(SWAPW(subtableFormat))
{
case 0:
case 1:
{
const ContextualSubstitutionFormat1Subtable *subtable = (const ContextualSubstitutionFormat1Subtable *) this;
-
- return subtable->process(lookupProcessor, glyphIterator, fontInstance);
+ return subtable->process(lookupProcessor, glyphIterator, fontInstance, success);
}
case 2:
{
const ContextualSubstitutionFormat2Subtable *subtable = (const ContextualSubstitutionFormat2Subtable *) this;
-
- return subtable->process(lookupProcessor, glyphIterator, fontInstance);
+ return subtable->process(lookupProcessor, glyphIterator, fontInstance, success);
}
case 3:
{
const ContextualSubstitutionFormat3Subtable *subtable = (const ContextualSubstitutionFormat3Subtable *) this;
-
- return subtable->process(lookupProcessor, glyphIterator, fontInstance);
+ return subtable->process(lookupProcessor, glyphIterator, fontInstance, success);
}
default:
}
}
-le_uint32 ContextualSubstitutionFormat1Subtable::process(const LookupProcessor *lookupProcessor, GlyphIterator *glyphIterator,
- const LEFontInstance *fontInstance) const
+le_uint32 ContextualSubstitutionFormat1Subtable::process(const LookupProcessor *lookupProcessor,
+ GlyphIterator *glyphIterator,
+ const LEFontInstance *fontInstance,
+ LEErrorCode& success) const
{
+ if (LE_FAILURE(success)) {
+ return 0;
+ }
+
LEGlyphID glyph = glyphIterator->getCurrGlyphID();
- le_int32 coverageIndex = getGlyphCoverage(glyph);
+ le_int32 coverageIndex = getGlyphCoverage(lookupProcessor->getReference(), glyph, success);
if (coverageIndex >= 0) {
le_uint16 srSetCount = SWAPW(subRuleSetCount);
const SubstitutionLookupRecord *substLookupRecordArray =
(const SubstitutionLookupRecord *) &subRuleTable->inputGlyphArray[matchCount];
- applySubstitutionLookups(lookupProcessor, substLookupRecordArray, substCount, glyphIterator, fontInstance, position);
+ applySubstitutionLookups(lookupProcessor, substLookupRecordArray, substCount, glyphIterator, fontInstance, position, success);
return matchCount + 1;
}
return 0;
}
-le_uint32 ContextualSubstitutionFormat2Subtable::process(const LookupProcessor *lookupProcessor, GlyphIterator *glyphIterator,
- const LEFontInstance *fontInstance) const
+le_uint32 ContextualSubstitutionFormat2Subtable::process(const LookupProcessor *lookupProcessor,
+ GlyphIterator *glyphIterator,
+ const LEFontInstance *fontInstance,
+ LEErrorCode& success) const
{
+ if (LE_FAILURE(success)) {
+ return 0;
+ }
+
LEGlyphID glyph = glyphIterator->getCurrGlyphID();
- le_int32 coverageIndex = getGlyphCoverage(glyph);
+ le_int32 coverageIndex = getGlyphCoverage(lookupProcessor->getReference(), glyph, success);
if (coverageIndex >= 0) {
const ClassDefinitionTable *classDefinitionTable =
const SubstitutionLookupRecord *substLookupRecordArray =
(const SubstitutionLookupRecord *) &subClassRuleTable->classArray[matchCount];
- applySubstitutionLookups(lookupProcessor, substLookupRecordArray, substCount, glyphIterator, fontInstance, position);
+ applySubstitutionLookups(lookupProcessor, substLookupRecordArray, substCount, glyphIterator, fontInstance, position, success);
return matchCount + 1;
}
return 0;
}
-le_uint32 ContextualSubstitutionFormat3Subtable::process(const LookupProcessor *lookupProcessor, GlyphIterator *glyphIterator,
- const LEFontInstance *fontInstance)const
+le_uint32 ContextualSubstitutionFormat3Subtable::process(const LookupProcessor *lookupProcessor,
+ GlyphIterator *glyphIterator,
+ const LEFontInstance *fontInstance,
+ LEErrorCode& success)const
{
+ if (LE_FAILURE(success)) {
+ return 0;
+ }
+
le_uint16 gCount = SWAPW(glyphCount);
le_uint16 subCount = SWAPW(substCount);
le_int32 position = glyphIterator->getCurrStreamPosition();
const SubstitutionLookupRecord *substLookupRecordArray =
(const SubstitutionLookupRecord *) &coverageTableOffsetArray[gCount];
- ContextualSubstitutionBase::applySubstitutionLookups(lookupProcessor, substLookupRecordArray, subCount, glyphIterator, fontInstance, position);
+ ContextualSubstitutionBase::applySubstitutionLookups(lookupProcessor, substLookupRecordArray, subCount, glyphIterator, fontInstance, position, success);
return gCount + 1;
}
return 0;
}
-le_uint32 ChainingContextualSubstitutionSubtable::process(const LookupProcessor *lookupProcessor, GlyphIterator *glyphIterator,
- const LEFontInstance *fontInstance) const
+le_uint32 ChainingContextualSubstitutionSubtable::process(const LookupProcessor *lookupProcessor,
+ GlyphIterator *glyphIterator,
+ const LEFontInstance *fontInstance,
+ LEErrorCode& success) const
{
+ if (LE_FAILURE(success)) {
+ return 0;
+ }
+
switch(SWAPW(subtableFormat))
{
case 0:
case 1:
{
const ChainingContextualSubstitutionFormat1Subtable *subtable = (const ChainingContextualSubstitutionFormat1Subtable *) this;
-
- return subtable->process(lookupProcessor, glyphIterator, fontInstance);
+ return subtable->process(lookupProcessor, glyphIterator, fontInstance, success);
}
case 2:
{
const ChainingContextualSubstitutionFormat2Subtable *subtable = (const ChainingContextualSubstitutionFormat2Subtable *) this;
-
- return subtable->process(lookupProcessor, glyphIterator, fontInstance);
+ return subtable->process(lookupProcessor, glyphIterator, fontInstance, success);
}
case 3:
{
const ChainingContextualSubstitutionFormat3Subtable *subtable = (const ChainingContextualSubstitutionFormat3Subtable *) this;
-
- return subtable->process(lookupProcessor, glyphIterator, fontInstance);
+ return subtable->process(lookupProcessor, glyphIterator, fontInstance, success);
}
default:
// emptyFeatureList matches an le_uint32 or an le_uint16...
static const FeatureMask emptyFeatureList = 0x00000000UL;
-le_uint32 ChainingContextualSubstitutionFormat1Subtable::process(const LookupProcessor *lookupProcessor, GlyphIterator *glyphIterator,
- const LEFontInstance *fontInstance) const
+le_uint32 ChainingContextualSubstitutionFormat1Subtable::process(const LookupProcessor *lookupProcessor,
+ GlyphIterator *glyphIterator,
+ const LEFontInstance *fontInstance,
+ LEErrorCode& success) const
{
+ if (LE_FAILURE(success)) {
+ return 0;
+ }
+
LEGlyphID glyph = glyphIterator->getCurrGlyphID();
- le_int32 coverageIndex = getGlyphCoverage(glyph);
+ le_int32 coverageIndex = getGlyphCoverage(lookupProcessor->getReference(), glyph, success);
if (coverageIndex >= 0) {
le_uint16 srSetCount = SWAPW(chainSubRuleSetCount);
const SubstitutionLookupRecord *substLookupRecordArray =
(const SubstitutionLookupRecord *) &lookaheadGlyphArray[lookaheadGlyphCount + 1];
- applySubstitutionLookups(lookupProcessor, substLookupRecordArray, substCount, glyphIterator, fontInstance, position);
+ applySubstitutionLookups(lookupProcessor, substLookupRecordArray, substCount, glyphIterator, fontInstance, position, success);
return inputGlyphCount + 1;
}
return 0;
}
-le_uint32 ChainingContextualSubstitutionFormat2Subtable::process(const LookupProcessor *lookupProcessor, GlyphIterator *glyphIterator,
- const LEFontInstance *fontInstance) const
+le_uint32 ChainingContextualSubstitutionFormat2Subtable::process(const LookupProcessor *lookupProcessor,
+ GlyphIterator *glyphIterator,
+ const LEFontInstance *fontInstance,
+ LEErrorCode& success) const
{
+ if (LE_FAILURE(success)) {
+ return 0;
+ }
+
LEGlyphID glyph = glyphIterator->getCurrGlyphID();
- le_int32 coverageIndex = getGlyphCoverage(glyph);
+ le_int32 coverageIndex = getGlyphCoverage(lookupProcessor->getReference(), glyph, success);
if (coverageIndex >= 0) {
const ClassDefinitionTable *backtrackClassDefinitionTable =
const SubstitutionLookupRecord *substLookupRecordArray =
(const SubstitutionLookupRecord *) &lookaheadClassArray[lookaheadGlyphCount + 1];
- applySubstitutionLookups(lookupProcessor, substLookupRecordArray, substCount, glyphIterator, fontInstance, position);
+ applySubstitutionLookups(lookupProcessor, substLookupRecordArray, substCount, glyphIterator, fontInstance, position, success);
return inputGlyphCount + 1;
}
return 0;
}
-le_uint32 ChainingContextualSubstitutionFormat3Subtable::process(const LookupProcessor *lookupProcessor, GlyphIterator *glyphIterator,
- const LEFontInstance *fontInstance) const
+le_uint32 ChainingContextualSubstitutionFormat3Subtable::process(const LookupProcessor *lookupProcessor,
+ GlyphIterator *glyphIterator,
+ const LEFontInstance *fontInstance,
+ LEErrorCode & success) const
{
+ if (LE_FAILURE(success)) {
+ return 0;
+ }
+
le_uint16 backtrkGlyphCount = SWAPW(backtrackGlyphCount);
le_uint16 inputGlyphCount = (le_uint16) SWAPW(backtrackCoverageTableOffsetArray[backtrkGlyphCount]);
const Offset *inputCoverageTableOffsetArray = &backtrackCoverageTableOffsetArray[backtrkGlyphCount + 1];
const SubstitutionLookupRecord *substLookupRecordArray =
(const SubstitutionLookupRecord *) &lookaheadCoverageTableOffsetArray[lookaheadGlyphCount + 1];
- ContextualSubstitutionBase::applySubstitutionLookups(lookupProcessor, substLookupRecordArray, substCount, glyphIterator, fontInstance, position);
+ ContextualSubstitutionBase::applySubstitutionLookups(lookupProcessor, substLookupRecordArray, substCount, glyphIterator, fontInstance, position, success);
return inputGlyphCount;
}