1 /* 2 * (C) Copyright IBM Corp. 1998 - 2015 - All Rights Reserved 3 * 4 */ 5 6 #include "LETypes.h" 7 #include "OpenTypeTables.h" 8 #include "GlyphPositioningTables.h" 9 #include "CursiveAttachmentSubtables.h" 10 #include "AnchorTables.h" 11 #include "GlyphIterator.h" 12 #include "OpenTypeUtilities.h" 13 #include "LESwaps.h" 14 15 U_NAMESPACE_BEGIN 16 17 le_uint32 CursiveAttachmentSubtable::process(const LEReferenceTo<CursiveAttachmentSubtable> &base, GlyphIterator *glyphIterator, const LEFontInstance *fontInstance, LEErrorCode &success) const 18 { 19 LEGlyphID glyphID = glyphIterator->getCurrGlyphID(); 20 le_int32 coverageIndex = getGlyphCoverage(base, glyphID, success); 21 le_uint16 eeCount = SWAPW(entryExitCount); 22 23 LEReferenceToArrayOf<EntryExitRecord> 24 entryExitRecordsArrayRef(base, success, entryExitRecords, coverageIndex); 25 26 if (coverageIndex < 0 || coverageIndex >= eeCount || LE_FAILURE(success)) { 27 glyphIterator->setCursiveGlyph(); 28 return 0; 29 } 30 31 LEPoint entryAnchor, exitAnchor; 32 Offset entryOffset = SWAPW(entryExitRecords[coverageIndex].entryAnchor); 33 Offset exitOffset = SWAPW(entryExitRecords[coverageIndex].exitAnchor); 34 35 if (entryOffset != 0) { 36 const AnchorTable *entryAnchorTable = (const AnchorTable *) ((char *) this + entryOffset); 37 38 entryAnchorTable->getAnchor(glyphID, fontInstance, entryAnchor); 39 glyphIterator->setCursiveEntryPoint(entryAnchor); 40 } else { 41 //glyphIterator->clearCursiveEntryPoint(); 42 } 43 44 if (exitOffset != 0) { 45 const AnchorTable *exitAnchorTable = (const AnchorTable *) ((char *) this + exitOffset); 46 47 exitAnchorTable->getAnchor(glyphID, fontInstance, exitAnchor); 48 glyphIterator->setCursiveExitPoint(exitAnchor); 49 } else { 50 //glyphIterator->clearCursiveExitPoint(); 51 } 52 53 return 1; 54 } 55 56 U_NAMESPACE_END 57