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