]> git.saurik.com Git - apple/icu.git/blame - icuSources/layout/CursiveAttachmentSubtables.cpp
ICU-57166.0.1.tar.gz
[apple/icu.git] / icuSources / layout / CursiveAttachmentSubtables.cpp
CommitLineData
b75a7d8f 1/*
b331163b 2 * (C) Copyright IBM Corp. 1998 - 2015 - 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
57a6839d 17le_uint32 CursiveAttachmentSubtable::process(const LEReferenceTo<CursiveAttachmentSubtable> &base, GlyphIterator *glyphIterator, const LEFontInstance *fontInstance, LEErrorCode &success) const
b75a7d8f
A
18{
19 LEGlyphID glyphID = glyphIterator->getCurrGlyphID();
57a6839d 20 le_int32 coverageIndex = getGlyphCoverage(base, glyphID, success);
b75a7d8f
A
21 le_uint16 eeCount = SWAPW(entryExitCount);
22
b331163b
A
23 LEReferenceToArrayOf<EntryExitRecord>
24 entryExitRecordsArrayRef(base, success, entryExitRecords, coverageIndex);
25
26 if (coverageIndex < 0 || coverageIndex >= eeCount || LE_FAILURE(success)) {
73c04bcf 27 glyphIterator->setCursiveGlyph();
b75a7d8f
A
28 return 0;
29 }
30
73c04bcf
A
31 LEPoint entryAnchor, exitAnchor;
32 Offset entryOffset = SWAPW(entryExitRecords[coverageIndex].entryAnchor);
33 Offset exitOffset = SWAPW(entryExitRecords[coverageIndex].exitAnchor);
b75a7d8f 34
73c04bcf 35 if (entryOffset != 0) {
b75a7d8f
A
36 const AnchorTable *entryAnchorTable = (const AnchorTable *) ((char *) this + entryOffset);
37
38 entryAnchorTable->getAnchor(glyphID, fontInstance, entryAnchor);
73c04bcf 39 glyphIterator->setCursiveEntryPoint(entryAnchor);
46f4442e
A
40 } else {
41 //glyphIterator->clearCursiveEntryPoint();
b75a7d8f
A
42 }
43
b75a7d8f
A
44 if (exitOffset != 0) {
45 const AnchorTable *exitAnchorTable = (const AnchorTable *) ((char *) this + exitOffset);
46
47 exitAnchorTable->getAnchor(glyphID, fontInstance, exitAnchor);
73c04bcf 48 glyphIterator->setCursiveExitPoint(exitAnchor);
46f4442e
A
49 } else {
50 //glyphIterator->clearCursiveExitPoint();
b75a7d8f
A
51 }
52
53 return 1;
54}
55
56U_NAMESPACE_END