]> git.saurik.com Git - apple/icu.git/blob - icuSources/layout/CursiveAttachmentSubtables.cpp
ICU-8.11.1.tar.gz
[apple/icu.git] / icuSources / layout / CursiveAttachmentSubtables.cpp
1 /*
2 * (C) Copyright IBM Corp. 1998 - 2005 - 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(GlyphIterator *glyphIterator, const LEFontInstance *fontInstance) const
18 {
19 LEGlyphID glyphID = glyphIterator->getCurrGlyphID();
20 le_int32 coverageIndex = getGlyphCoverage(glyphID);
21 le_uint16 eeCount = SWAPW(entryExitCount);
22
23 if (coverageIndex < 0 || coverageIndex >= eeCount) {
24 glyphIterator->setCursiveGlyph();
25 return 0;
26 }
27
28 LEPoint entryAnchor, exitAnchor;
29 Offset entryOffset = SWAPW(entryExitRecords[coverageIndex].entryAnchor);
30 Offset exitOffset = SWAPW(entryExitRecords[coverageIndex].exitAnchor);
31
32 if (entryOffset != 0) {
33 const AnchorTable *entryAnchorTable = (const AnchorTable *) ((char *) this + entryOffset);
34
35 entryAnchorTable->getAnchor(glyphID, fontInstance, entryAnchor);
36 glyphIterator->setCursiveEntryPoint(entryAnchor);
37 }
38
39 if (exitOffset != 0) {
40 const AnchorTable *exitAnchorTable = (const AnchorTable *) ((char *) this + exitOffset);
41
42 exitAnchorTable->getAnchor(glyphID, fontInstance, exitAnchor);
43 glyphIterator->setCursiveExitPoint(exitAnchor);
44 }
45
46 return 1;
47 }
48
49 U_NAMESPACE_END