]> git.saurik.com Git - apple/icu.git/blame - icuSources/layout/GlyphPosnLookupProc.cpp
ICU-59180.0.1.tar.gz
[apple/icu.git] / icuSources / layout / GlyphPosnLookupProc.cpp
CommitLineData
b75a7d8f 1/*
57a6839d 2 * (C) Copyright IBM Corp. 1998 - 2013 - All Rights Reserved
b75a7d8f
A
3 *
4 */
5
6#include "LETypes.h"
7#include "LEFontInstance.h"
8#include "OpenTypeTables.h"
729e4ab9 9#include "ICUFeatures.h"
b75a7d8f
A
10#include "Lookups.h"
11#include "ScriptAndLanguage.h"
12#include "GlyphDefinitionTables.h"
13#include "GlyphPositioningTables.h"
14#include "SinglePositioningSubtables.h"
15#include "PairPositioningSubtables.h"
16#include "CursiveAttachmentSubtables.h"
17#include "MarkToBasePosnSubtables.h"
18#include "MarkToLigaturePosnSubtables.h"
19#include "MarkToMarkPosnSubtables.h"
20//#include "ContextualPositioningSubtables.h"
21#include "ContextualSubstSubtables.h"
22#include "ExtensionSubtables.h"
23#include "LookupProcessor.h"
24#include "GlyphPosnLookupProc.h"
25#include "LESwaps.h"
26
27U_NAMESPACE_BEGIN
28
29// Aside from the names, the contextual positioning subtables are
30// the same as the contextual substitution subtables.
31typedef ContextualSubstitutionSubtable ContextualPositioningSubtable;
32typedef ChainingContextualSubstitutionSubtable ChainingContextualPositioningSubtable;
33
34GlyphPositioningLookupProcessor::GlyphPositioningLookupProcessor(
57a6839d 35 const LEReferenceTo<GlyphPositioningTableHeader> &glyphPositioningTableHeader,
729e4ab9
A
36 LETag scriptTag,
37 LETag languageTag,
38 const FeatureMap *featureMap,
39 le_int32 featureMapCount,
40 le_bool featureOrder,
41 LEErrorCode& success)
b75a7d8f 42 : LookupProcessor(
57a6839d 43 glyphPositioningTableHeader,
b75a7d8f
A
44 SWAPW(glyphPositioningTableHeader->scriptListOffset),
45 SWAPW(glyphPositioningTableHeader->featureListOffset),
46 SWAPW(glyphPositioningTableHeader->lookupListOffset),
729e4ab9
A
47 scriptTag,
48 languageTag,
49 featureMap,
50 featureMapCount,
51 featureOrder,
52 success
53 )
b75a7d8f
A
54{
55 // anything?
56}
57
58GlyphPositioningLookupProcessor::GlyphPositioningLookupProcessor()
59{
60}
61
57a6839d 62le_uint32 GlyphPositioningLookupProcessor::applySubtable(const LEReferenceTo<LookupSubtable> &lookupSubtable, le_uint16 lookupType,
b75a7d8f 63 GlyphIterator *glyphIterator,
729e4ab9
A
64 const LEFontInstance *fontInstance,
65 LEErrorCode& success) const
b75a7d8f 66{
729e4ab9
A
67 if (LE_FAILURE(success)) {
68 return 0;
69 }
70
b75a7d8f
A
71 le_uint32 delta = 0;
72
73 switch(lookupType)
74 {
75 case 0:
76 break;
77
78 case gpstSingle:
79 {
57a6839d 80 LEReferenceTo<SinglePositioningSubtable> subtable(lookupSubtable, success);
b75a7d8f 81
57a6839d 82 delta = subtable->process(subtable, glyphIterator, fontInstance, success);
b75a7d8f
A
83 break;
84 }
85
86 case gpstPair:
87 {
57a6839d 88 LEReferenceTo<PairPositioningSubtable> subtable(lookupSubtable, success);
b75a7d8f 89
57a6839d 90 delta = subtable->process(subtable, glyphIterator, fontInstance, success);
b75a7d8f
A
91 break;
92 }
93
94 case gpstCursive:
95 {
57a6839d 96 LEReferenceTo<CursiveAttachmentSubtable> subtable(lookupSubtable, success);
b75a7d8f 97
57a6839d 98 delta = subtable->process(subtable, glyphIterator, fontInstance, success);
b75a7d8f
A
99 break;
100 }
101
102 case gpstMarkToBase:
103 {
57a6839d 104 LEReferenceTo<MarkToBasePositioningSubtable> subtable(lookupSubtable, success);
b75a7d8f 105
57a6839d 106 delta = subtable->process(subtable, glyphIterator, fontInstance, success);
b75a7d8f
A
107 break;
108 }
109
110 case gpstMarkToLigature:
111 {
57a6839d 112 LEReferenceTo<MarkToLigaturePositioningSubtable> subtable(lookupSubtable, success);
b75a7d8f 113
57a6839d 114 delta = subtable->process(subtable, glyphIterator, fontInstance, success);
b75a7d8f
A
115 break;
116 }
117
118 case gpstMarkToMark:
119 {
57a6839d 120 LEReferenceTo<MarkToMarkPositioningSubtable> subtable(lookupSubtable, success);
b75a7d8f 121
57a6839d 122 delta = subtable->process(subtable, glyphIterator, fontInstance, success);
b75a7d8f
A
123 break;
124 }
125
126 case gpstContext:
127 {
57a6839d 128 LEReferenceTo<ContextualPositioningSubtable> subtable(lookupSubtable, success);
b75a7d8f 129
729e4ab9 130 delta = subtable->process(this, glyphIterator, fontInstance, success);
b75a7d8f
A
131 break;
132 }
133
134 case gpstChainedContext:
135 {
57a6839d 136 LEReferenceTo<ChainingContextualPositioningSubtable> subtable(lookupSubtable, success);
b75a7d8f 137
729e4ab9 138 delta = subtable->process(this, glyphIterator, fontInstance, success);
b75a7d8f
A
139 break;
140 }
141
142 case gpstExtension:
143 {
57a6839d 144 LEReferenceTo<ExtensionSubtable> subtable(lookupSubtable, success);
b75a7d8f 145
729e4ab9 146 delta = subtable->process(this, lookupType, glyphIterator, fontInstance, success);
b75a7d8f
A
147 break;
148 }
149
150 default:
151 break;
152 }
153
154 return delta;
155}
156
157GlyphPositioningLookupProcessor::~GlyphPositioningLookupProcessor()
158{
159}
160
161U_NAMESPACE_END