le_uint32 PairPositioningFormat1Subtable::process(const LEReferenceTo<PairPositioningFormat1Subtable> &base, GlyphIterator *glyphIterator, const LEFontInstance *fontInstance, LEErrorCode &success) const { LEGlyphID firstGlyph = glyphIterator->getCurrGlyphID(); le_int32 coverageIndex = getGlyphCoverage(base, firstGlyph, success); if (LE_FAILURE(success)) { return 0; } GlyphIterator tempIterator(*glyphIterator); if (coverageIndex >= 0 && glyphIterator->next()) { Offset pairSetTableOffset = SWAPW(pairSetTableOffsetArray[coverageIndex]); LEReferenceTo<PairSetTable> pairSetTable(base, success, ((char *) this + pairSetTableOffset)); if (LE_FAILURE(success)) { return 0; } le_uint16 pairValueCount = SWAPW(pairSetTable->pairValueCount); le_int16 valueRecord1Size = ValueRecord::getSize(SWAPW(valueFormat1)); le_int16 valueRecord2Size = ValueRecord::getSize(SWAPW(valueFormat2)); le_int16 recordSize = sizeof(PairValueRecord) - sizeof(ValueRecord) + valueRecord1Size + valueRecord2Size; LEGlyphID secondGlyph = glyphIterator->getCurrGlyphID(); LEReferenceTo<PairValueRecord> pairValueRecord; if (pairValueCount != 0) { pairValueRecord = findPairValueRecord(base, (TTGlyphID) LE_GET_GLYPH(secondGlyph), pairSetTable->pairValueRecordArray, pairValueCount, recordSize, success); } if (pairValueRecord.isEmpty()) { return 0; } if (valueFormat1 != 0) { pairValueRecord->valueRecord1.adjustPosition(SWAPW(valueFormat1), (char *) this, tempIterator, fontInstance); } if (valueFormat2 != 0) { const ValueRecord *valueRecord2 = (const ValueRecord *) ((char *) &pairValueRecord->valueRecord1 + valueRecord1Size); valueRecord2->adjustPosition(SWAPW(valueFormat2), (char *) this, *glyphIterator, fontInstance); } // back up glyphIterator so second glyph can be // first glyph in the next pair glyphIterator->prev(); return 1; } return 0; }
le_uint32 PairPositioningFormat1Subtable::process(GlyphIterator *glyphIterator, const LEFontInstance *fontInstance) const { LEGlyphID firstGlyph = (LEGlyphID) glyphIterator->getCurrGlyphID(); le_int32 coverageIndex = getGlyphCoverage(firstGlyph); GlyphIterator tempIterator(*glyphIterator); if (coverageIndex >= 0 && glyphIterator->next()) { Offset pairSetTableOffset = SWAPW(pairSetTableOffsetArray[coverageIndex]); PairSetTable *pairSetTable = (PairSetTable *) ((char *) this + pairSetTableOffset); le_int16 valueRecord1Size = ValueRecord::getSize(SWAPW(valueFormat1)); le_int16 valueRecord2Size = ValueRecord::getSize(SWAPW(valueFormat2)); le_int16 recordSize = sizeof(PairValueRecord) - sizeof(ValueRecord) + valueRecord1Size + valueRecord2Size; LEGlyphID secondGlyph = (LEGlyphID) glyphIterator->getCurrGlyphID(); const PairValueRecord *pairValueRecord = findPairValueRecord(secondGlyph, pairSetTable->pairValueRecordArray, SWAPW(pairSetTable->pairValueCount), recordSize); if (pairValueRecord == NULL) { return 0; } if (valueFormat1 != 0) { GlyphPositionAdjustment adjustment; tempIterator.getCurrGlyphPositionAdjustment(adjustment); pairValueRecord->valueRecord1.adjustPosition(SWAPW(valueFormat1), (char *) this, adjustment, fontInstance); tempIterator.setCurrGlyphPositionAdjustment(&adjustment); } if (valueFormat2 != 0) { const ValueRecord *valueRecord2 = (const ValueRecord *) ((char *) &pairValueRecord->valueRecord1 + valueRecord1Size); GlyphPositionAdjustment adjustment; glyphIterator->getCurrGlyphPositionAdjustment(adjustment); valueRecord2->adjustPosition(SWAPW(valueFormat2), (char *) this, adjustment, fontInstance); glyphIterator->setCurrGlyphPositionAdjustment(&adjustment); } return 2; } return 0; }
le_uint32 PairPositioningFormat1Subtable::process(GlyphIterator *glyphIterator, const LEFontInstance *fontInstance) const { LEGlyphID firstGlyph = glyphIterator->getCurrGlyphID(); le_int32 coverageIndex = getGlyphCoverage(firstGlyph); GlyphIterator tempIterator(*glyphIterator); if (coverageIndex >= 0 && glyphIterator->next()) { Offset pairSetTableOffset = SWAPW(pairSetTableOffsetArray[coverageIndex]); PairSetTable *pairSetTable = (PairSetTable *) ((char *) this + pairSetTableOffset); le_uint16 pairValueCount = SWAPW(pairSetTable->pairValueCount); le_int16 valueRecord1Size = ValueRecord::getSize(SWAPW(valueFormat1)); le_int16 valueRecord2Size = ValueRecord::getSize(SWAPW(valueFormat2)); le_int16 recordSize = sizeof(PairValueRecord) - sizeof(ValueRecord) + valueRecord1Size + valueRecord2Size; LEGlyphID secondGlyph = glyphIterator->getCurrGlyphID(); const PairValueRecord *pairValueRecord = NULL; if (pairValueCount != 0) { pairValueRecord = findPairValueRecord((TTGlyphID) LE_GET_GLYPH(secondGlyph), pairSetTable->pairValueRecordArray, pairValueCount, recordSize); } if (pairValueRecord == NULL) { return 0; } if (valueFormat1 != 0) { pairValueRecord->valueRecord1.adjustPosition(SWAPW(valueFormat1), (char *) this, tempIterator, fontInstance); } if (valueFormat2 != 0) { const ValueRecord *valueRecord2 = (const ValueRecord *) ((char *) &pairValueRecord->valueRecord1 + valueRecord1Size); valueRecord2->adjustPosition(SWAPW(valueFormat2), (char *) this, *glyphIterator, fontInstance); } // back up glyphIterator so second glyph can be // first glyph in the next pair glyphIterator->prev(); return 1; } return 0; }