]> git.saurik.com Git - apple/icu.git/blame - icuSources/layout/CursiveAttachmentSubtables.cpp
ICU-511.25.tar.gz
[apple/icu.git] / icuSources / layout / CursiveAttachmentSubtables.cpp
CommitLineData
b75a7d8f 1/*
46f4442e 2 * (C) Copyright IBM Corp. 1998 - 2007 - All Rights Reserved
b75a7d8f
A
3 *
4 */
5
6#include "LETypes.h"
b75a7d8f
A
7#include "OpenTypeTables.h"
8#include "GlyphPositioningTables.h"
9#include "CursiveAttachmentSubtables.h"
10#include "AnchorTables.h"
11#include "GlyphIterator.h"
b75a7d8f
A
12#include "OpenTypeUtilities.h"
13#include "LESwaps.h"
14
15U_NAMESPACE_BEGIN
16
17le_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) {
73c04bcf 24 glyphIterator->setCursiveGlyph();
b75a7d8f
A
25 return 0;
26 }
27
73c04bcf
A
28 LEPoint entryAnchor, exitAnchor;
29 Offset entryOffset = SWAPW(entryExitRecords[coverageIndex].entryAnchor);
30 Offset exitOffset = SWAPW(entryExitRecords[coverageIndex].exitAnchor);
b75a7d8f 31
73c04bcf 32 if (entryOffset != 0) {
b75a7d8f
A
33 const AnchorTable *entryAnchorTable = (const AnchorTable *) ((char *) this + entryOffset);
34
35 entryAnchorTable->getAnchor(glyphID, fontInstance, entryAnchor);
73c04bcf 36 glyphIterator->setCursiveEntryPoint(entryAnchor);
46f4442e
A
37 } else {
38 //glyphIterator->clearCursiveEntryPoint();
b75a7d8f
A
39 }
40
b75a7d8f
A
41 if (exitOffset != 0) {
42 const AnchorTable *exitAnchorTable = (const AnchorTable *) ((char *) this + exitOffset);
43
44 exitAnchorTable->getAnchor(glyphID, fontInstance, exitAnchor);
73c04bcf 45 glyphIterator->setCursiveExitPoint(exitAnchor);
46f4442e
A
46 } else {
47 //glyphIterator->clearCursiveExitPoint();
b75a7d8f
A
48 }
49
50 return 1;
51}
52
53U_NAMESPACE_END