49 #include "LESwaps.h" |
49 #include "LESwaps.h" |
50 |
50 |
51 U_NAMESPACE_BEGIN |
51 U_NAMESPACE_BEGIN |
52 |
52 |
53 GlyphSubstitutionLookupProcessor::GlyphSubstitutionLookupProcessor( |
53 GlyphSubstitutionLookupProcessor::GlyphSubstitutionLookupProcessor( |
54 const GlyphSubstitutionTableHeader *glyphSubstitutionTableHeader, |
54 const LEReferenceTo<GlyphSubstitutionTableHeader> &glyphSubstitutionTableHeader, |
55 LETag scriptTag, |
55 LETag scriptTag, |
56 LETag languageTag, |
56 LETag languageTag, |
57 const LEGlyphFilter *filter, |
57 const LEGlyphFilter *filter, |
58 const FeatureMap *featureMap, |
58 const FeatureMap *featureMap, |
59 le_int32 featureMapCount, |
59 le_int32 featureMapCount, |
60 le_bool featureOrder, |
60 le_bool featureOrder, |
61 LEErrorCode& success) |
61 LEErrorCode& success) |
62 : LookupProcessor( |
62 : LookupProcessor( |
63 (char *) glyphSubstitutionTableHeader, |
63 glyphSubstitutionTableHeader, |
64 SWAPW(glyphSubstitutionTableHeader->scriptListOffset), |
64 SWAPW(glyphSubstitutionTableHeader->scriptListOffset), |
65 SWAPW(glyphSubstitutionTableHeader->featureListOffset), |
65 SWAPW(glyphSubstitutionTableHeader->featureListOffset), |
66 SWAPW(glyphSubstitutionTableHeader->lookupListOffset), |
66 SWAPW(glyphSubstitutionTableHeader->lookupListOffset), |
67 scriptTag, languageTag, featureMap, featureMapCount, featureOrder, success), fFilter(filter) |
67 scriptTag, languageTag, featureMap, featureMapCount, featureOrder, success), fFilter(filter) |
68 { |
68 { |
71 |
71 |
72 GlyphSubstitutionLookupProcessor::GlyphSubstitutionLookupProcessor() |
72 GlyphSubstitutionLookupProcessor::GlyphSubstitutionLookupProcessor() |
73 { |
73 { |
74 } |
74 } |
75 |
75 |
76 le_uint32 GlyphSubstitutionLookupProcessor::applySubtable(const LookupSubtable *lookupSubtable, le_uint16 lookupType, |
76 le_uint32 GlyphSubstitutionLookupProcessor::applySubtable(const LEReferenceTo<LookupSubtable> &lookupSubtable, le_uint16 lookupType, |
77 GlyphIterator *glyphIterator, const LEFontInstance *fontInstance, LEErrorCode& success) const |
77 GlyphIterator *glyphIterator, const LEFontInstance *fontInstance, LEErrorCode& success) const |
78 { |
78 { |
79 if (LE_FAILURE(success)) { |
79 if (LE_FAILURE(success)) { |
80 return 0; |
80 return 0; |
81 } |
81 } |
87 case 0: |
87 case 0: |
88 break; |
88 break; |
89 |
89 |
90 case gsstSingle: |
90 case gsstSingle: |
91 { |
91 { |
92 const SingleSubstitutionSubtable *subtable = (const SingleSubstitutionSubtable *) lookupSubtable; |
92 const LEReferenceTo<SingleSubstitutionSubtable> subtable(lookupSubtable, success); |
93 |
93 |
94 delta = subtable->process(glyphIterator, fFilter); |
94 delta = subtable->process(subtable, glyphIterator, success, fFilter); |
95 break; |
95 break; |
96 } |
96 } |
97 |
97 |
98 case gsstMultiple: |
98 case gsstMultiple: |
99 { |
99 { |
100 const MultipleSubstitutionSubtable *subtable = (const MultipleSubstitutionSubtable *) lookupSubtable; |
100 const LEReferenceTo<MultipleSubstitutionSubtable> subtable(lookupSubtable, success); |
101 |
101 |
102 delta = subtable->process(glyphIterator, success, fFilter); |
102 delta = subtable->process(subtable, glyphIterator, success, fFilter); |
103 break; |
103 break; |
104 } |
104 } |
105 |
105 |
106 case gsstAlternate: |
106 case gsstAlternate: |
107 { |
107 { |
108 const AlternateSubstitutionSubtable *subtable = (const AlternateSubstitutionSubtable *) lookupSubtable; |
108 const LEReferenceTo<AlternateSubstitutionSubtable> subtable(lookupSubtable, success); |
109 |
109 |
110 delta = subtable->process(glyphIterator, fFilter); |
110 delta = subtable->process(subtable, glyphIterator, success, fFilter); |
111 break; |
111 break; |
112 } |
112 } |
113 |
113 |
114 case gsstLigature: |
114 case gsstLigature: |
115 { |
115 { |
116 const LigatureSubstitutionSubtable *subtable = (const LigatureSubstitutionSubtable *) lookupSubtable; |
116 const LEReferenceTo<LigatureSubstitutionSubtable> subtable(lookupSubtable, success); |
117 |
117 |
118 delta = subtable->process(glyphIterator, fFilter); |
118 delta = subtable->process(subtable, glyphIterator, success, fFilter); |
119 break; |
119 break; |
120 } |
120 } |
121 |
121 |
122 case gsstContext: |
122 case gsstContext: |
123 { |
123 { |
124 const ContextualSubstitutionSubtable *subtable = (const ContextualSubstitutionSubtable *) lookupSubtable; |
124 const LEReferenceTo<ContextualSubstitutionSubtable> subtable(lookupSubtable, success); |
125 |
125 |
126 delta = subtable->process(this, glyphIterator, fontInstance, success); |
126 delta = subtable->process(this, glyphIterator, fontInstance, success); |
127 break; |
127 break; |
128 } |
128 } |
129 |
129 |
130 case gsstChainingContext: |
130 case gsstChainingContext: |
131 { |
131 { |
132 const ChainingContextualSubstitutionSubtable *subtable = (const ChainingContextualSubstitutionSubtable *) lookupSubtable; |
132 const LEReferenceTo<ChainingContextualSubstitutionSubtable> subtable(lookupSubtable, success); |
133 |
133 |
134 delta = subtable->process(this, glyphIterator, fontInstance, success); |
134 delta = subtable->process(this, glyphIterator, fontInstance, success); |
135 break; |
135 break; |
136 } |
136 } |
137 |
137 |
138 case gsstExtension: |
138 case gsstExtension: |
139 { |
139 { |
140 const ExtensionSubtable *subtable = (const ExtensionSubtable *) lookupSubtable; |
140 const LEReferenceTo<ExtensionSubtable> subtable(lookupSubtable, success); |
141 |
141 |
142 delta = subtable->process(this, lookupType, glyphIterator, fontInstance, success); |
142 delta = subtable->process(this, lookupType, glyphIterator, fontInstance, success); |
143 break; |
143 break; |
144 } |
144 } |
145 |
145 |