First public contribution.
1 // Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies).
2 // All rights reserved.
3 // This component and the accompanying materials are made available
4 // under the terms of "Eclipse Public License v1.0"
5 // which accompanies this distribution, and is available
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
8 // Initial Contributors:
9 // Nokia Corporation - initial contribution.
16 #ifndef __FONTINDIC_H__
17 #define __FONTINDIC_H__
21 /** Defines the maximum ammount of text thats can be shaped at one time.
22 Change this number to suit optimisation, as increasing it or decreasing it may
23 make Devanagari text faster/slower.*/
24 const TInt KMaxTextToShape = 16;
28 // These values must not change without also changing
29 // KStateResponse table accordingly
31 EIndicCodeCombiningSign = 1,
32 EIndicCodeIndependentVowel = 2,
33 EIndicCodeConsonant = 3,
34 EIndicCodeDependentVowel = 4,
38 EIndicCodeNuktaConsonant = 8,
39 EIndicCodeIndependentVowelA = 9,
40 EIndicCodeDependentVowelCandraE = 10,
41 EIndicCodeConsonantKannadaBengaliRa = 11,
42 EIndicCodeSplitVowel1 = 12,
43 EIndicCodeSplitVowel2 = 13,
44 EIndicCodeTamilLengthMarkAU = 14,
45 //Gurmukhi specific types: EIndicCodeGurBeraer* for specific bearer
46 //EIndicCodeGurDependentVowel* for dependent vowles which can be combined
47 //with corresponding bearer to form an independent vowlel
48 EIndicCodeGurBearerA = 15,
49 EIndicCodeGurBearerU = 16,
50 EIndicCodeGurBearerI = 17,
51 EIndicCodeGurDependentVowelA = 18,
52 EIndicCodeGurDependentVowelU = 19,
53 EIndicCodeGurDependentVowelI = 20,
54 EIndicCodeConsonantMalaChillu = 21,
55 EIndicCodeConsonantMalaChilluNA = 22,
56 EIndicCodeConsonantMalaRRA = 23
59 struct TIndicCodeMapping
61 TInt16 iFirstCodeInRange;
62 TInt16 iCodeType; // From TIndicCodeType
65 /** Holds the types of all the symbols in the devanagari range, so that we can
66 work out where the syllable boundaries begin and end. */
67 static const TIndicCodeMapping KDevCodeMap[] =
70 {0x901, EIndicCodeCombiningSign},
71 {0x904, EIndicCodeIndependentVowel},
72 {0x905, EIndicCodeIndependentVowelA},
73 {0x906, EIndicCodeIndependentVowel},
74 {0x915, EIndicCodeConsonant},
75 {0x929, EIndicCodeNuktaConsonant},
76 {0x92A, EIndicCodeConsonant},
77 {0x931, EIndicCodeNuktaConsonant},
78 {0x932, EIndicCodeConsonant},
79 {0x934, EIndicCodeNuktaConsonant},
80 {0x935, EIndicCodeConsonant},
81 {0x93A, EIndicCodeOther},
82 {0x93C, EIndicCodeNukta},
83 {0x93D, EIndicCodeOther},
84 {0x93E, EIndicCodeDependentVowel},
85 {0x945, EIndicCodeDependentVowelCandraE},
86 {0x946, EIndicCodeDependentVowel},
87 {0x94D, EIndicCodeVirama},
88 {0x94E, EIndicCodeOther},
89 {0x951, EIndicCodeCombiningSign},
90 {0x955, EIndicCodeConsonant},
91 {0x958, EIndicCodeNuktaConsonant},
92 {0x960, EIndicCodeIndependentVowel},
93 {0x962, EIndicCodeDependentVowel},
94 {0x964, EIndicCodeOther},
95 {0x200D, EIndicCodeZWJ},
96 {0x200E, EIndicCodeOther}
99 /** Holds the types of all the symbols in the Kannada range, so that we can
100 work out where the syllable boundaries begin and end. */
101 static const TIndicCodeMapping KKanCodeMap[] =
103 {0, EIndicCodeOther},
104 {0xC82, EIndicCodeCombiningSign},
105 {0xC85, EIndicCodeIndependentVowel},
106 {0xC95, EIndicCodeConsonant},
107 {0xCB0, EIndicCodeConsonantKannadaBengaliRa},
108 {0xCB1, EIndicCodeConsonant},
109 {0xCB4, EIndicCodeOther},
110 {0xCB5, EIndicCodeConsonant},
111 {0xCBA, EIndicCodeOther},
112 {0xCBC, EIndicCodeNukta},
113 {0xCBD, EIndicCodeOther},
114 {0xCBE, EIndicCodeDependentVowel},
115 {0xCC5, EIndicCodeOther},
116 {0xCC6, EIndicCodeDependentVowel},
117 {0xCCD, EIndicCodeVirama},
118 {0xCD5, EIndicCodeCombiningSign},
119 {0xCDE, EIndicCodeConsonant},
120 {0xCE0, EIndicCodeIndependentVowel},
121 {0xCE2, EIndicCodeDependentVowel},
122 {0xCE4, EIndicCodeOther},
123 {0x200D, EIndicCodeZWJ},
124 {0x200E, EIndicCodeOther}
127 /** Holds the types of all the symbols in the Gujarati range, so that we can
128 work out where the syllable boundaries begin and end. */
129 static const TIndicCodeMapping KGujCodeMap[] =
131 {0, EIndicCodeOther},
132 {0xA81, EIndicCodeCombiningSign},
133 {0xA85, EIndicCodeIndependentVowel},
134 {0xA8E, EIndicCodeOther},
135 {0xA8F, EIndicCodeIndependentVowel},
136 {0xA92, EIndicCodeOther},
137 {0xA93, EIndicCodeIndependentVowel},
138 {0xA95, EIndicCodeConsonant},
139 {0xAA9, EIndicCodeOther},
140 {0xAAA, EIndicCodeConsonant},
141 {0xAB1, EIndicCodeOther},
142 {0xAB2, EIndicCodeConsonant},
143 {0xAB4, EIndicCodeOther},
144 {0xAB5, EIndicCodeConsonant},
145 {0xABC, EIndicCodeNukta},
146 {0xABD, EIndicCodeOther},
147 {0xABE, EIndicCodeDependentVowel},
148 {0xAC6, EIndicCodeOther},
149 {0xAC7, EIndicCodeDependentVowel},
150 {0xACA, EIndicCodeOther},
151 {0xACB, EIndicCodeDependentVowel},
152 {0xACD, EIndicCodeVirama},
153 {0xACE, EIndicCodeOther},
154 {0xAE0, EIndicCodeIndependentVowel},
155 {0xAE2, EIndicCodeDependentVowel},
156 {0xAE4, EIndicCodeOther},
157 {0x200D, EIndicCodeZWJ},
158 {0x200E, EIndicCodeOther}
161 /** Holds the types of all the symbols in the Gurmukhi range, so that we can
162 work out where the syllable boundaries begin and end. */
163 static const TIndicCodeMapping KGurCodeMap[] =
165 {0, EIndicCodeOther},
166 {0xA01, EIndicCodeCombiningSign},
167 {0xA04, EIndicCodeOther},
168 {0xA05, EIndicCodeGurBearerA},
169 {0xA06, EIndicCodeIndependentVowel},
170 {0xA0B, EIndicCodeOther},
171 {0xA0F, EIndicCodeIndependentVowel},
172 {0xA11, EIndicCodeOther},
173 {0xA13, EIndicCodeIndependentVowel},
174 {0xA15, EIndicCodeConsonant},
175 {0xA29, EIndicCodeOther},
176 {0xA2A, EIndicCodeConsonant},
177 {0xA31, EIndicCodeOther},
178 {0xA32, EIndicCodeConsonant},
179 {0xA33, EIndicCodeNuktaConsonant},
180 {0xA34, EIndicCodeOther},
181 {0xA35, EIndicCodeConsonant},
182 {0xA36, EIndicCodeNuktaConsonant},
183 {0xA37, EIndicCodeOther},
184 {0xA38, EIndicCodeConsonant},
185 {0xA3A, EIndicCodeOther},
186 {0xA3C, EIndicCodeNukta},
187 {0xA3D, EIndicCodeOther},
188 {0xA3E, EIndicCodeGurDependentVowelA},
189 {0xA3F, EIndicCodeGurDependentVowelI},
190 {0xA41, EIndicCodeGurDependentVowelU},
191 {0xA43, EIndicCodeOther},
192 {0xA47, EIndicCodeGurDependentVowelI},
193 {0xA48, EIndicCodeGurDependentVowelA},
194 {0xA49, EIndicCodeOther},
195 {0xA4B, EIndicCodeGurDependentVowelU},
196 {0xA4C, EIndicCodeGurDependentVowelA},
197 {0xA4D, EIndicCodeVirama},
198 {0xA4E, EIndicCodeOther},
199 {0xA59, EIndicCodeNuktaConsonant},
200 {0xA5C, EIndicCodeConsonant},
201 {0xA5D, EIndicCodeOther},
202 {0xA5E, EIndicCodeNuktaConsonant},
203 {0xA5F, EIndicCodeOther},
204 {0xA70, EIndicCodeCombiningSign},
205 {0xA71, EIndicCodeCombiningSign},
206 {0xA72, EIndicCodeGurBearerI},
207 {0xA73, EIndicCodeGurBearerU},
208 {0xA74, EIndicCodeOther},
209 {0x200D, EIndicCodeZWJ},
210 {0x200E, EIndicCodeOther}
213 /** Holds the types of all the symbols in the Bengali range, so that we can
214 work out where the syllable boundaries begin and end. */
215 static const TIndicCodeMapping KBenCodeMap[] =
217 {0, EIndicCodeOther},
218 {0x981 , EIndicCodeCombiningSign},
219 {0x985 , EIndicCodeIndependentVowel},
220 {0x995 , EIndicCodeConsonant},
221 {0x9B0 , EIndicCodeConsonantKannadaBengaliRa},
222 {0x9B1 , EIndicCodeConsonant},
223 {0x9BA , EIndicCodeOther},
224 {0x9BC , EIndicCodeNukta},
225 {0x9BD , EIndicCodeOther},
226 {0x9BE , EIndicCodeDependentVowel},
227 {0x9C9 , EIndicCodeOther},
228 {0x9CB , EIndicCodeDependentVowel},
229 {0x9CD , EIndicCodeVirama},
230 {0x9CE , EIndicCodeOther},
231 {0x9D7 , EIndicCodeDependentVowel},
232 {0x9DC , EIndicCodeConsonant},
233 {0x9E0 , EIndicCodeIndependentVowel},
234 {0x9E2 , EIndicCodeDependentVowel},
235 {0x9E4 , EIndicCodeOther},
236 {0x200D, EIndicCodeZWJ},
237 {0x200E, EIndicCodeOther}
240 /** Holds the types of all the symbols in the Tamil range, so that we can
241 work out where the syllable boundaries begin and end. */
242 static const TIndicCodeMapping KTamCodeMap[] =
244 {0, EIndicCodeOther},
245 {0xB82 , EIndicCodeCombiningSign},
246 {0xB83 , EIndicCodeIndependentVowel},
247 {0xB84 , EIndicCodeOther},
248 {0xB85 , EIndicCodeIndependentVowel},
249 {0xB92 , EIndicCodeIndependentVowelA},
250 {0xB93 , EIndicCodeIndependentVowel},
251 {0xB95 , EIndicCodeConsonant},
252 {0xBBE , EIndicCodeSplitVowel2},
253 {0xBBF , EIndicCodeDependentVowel},
254 {0xBC6 , EIndicCodeSplitVowel1},
255 {0xBC8 , EIndicCodeDependentVowel},
256 {0xBCD , EIndicCodeVirama},
257 {0xBCE , EIndicCodeOther},
258 {0xBD7 , EIndicCodeTamilLengthMarkAU},
259 {0xBE4 , EIndicCodeOther},
260 {0x200D, EIndicCodeZWJ},
261 {0x200E, EIndicCodeOther}
264 /** Holds the types of all the symbols in the Telugu range, so that we can
265 work out where the syllable boundaries begin and end. */
266 static const TIndicCodeMapping KTelCodeMap[] =
268 {0, EIndicCodeOther},
269 {0xC01, EIndicCodeCombiningSign},
270 {0xC04, EIndicCodeOther},
271 {0xC05, EIndicCodeIndependentVowel},
272 {0xC15, EIndicCodeConsonant},
273 {0xC3A, EIndicCodeOther},
274 {0xC3E, EIndicCodeDependentVowel},
275 {0xC4D, EIndicCodeVirama},
276 {0xC4E, EIndicCodeOther},
277 {0xC55, EIndicCodeDependentVowel},
278 {0xC57, EIndicCodeOther},
279 {0xC60, EIndicCodeIndependentVowel},
280 {0xC62, EIndicCodeOther}
283 /** Holds the types of all the symbols in the Malayalam range, so that we can
284 work out where the syllable boundaries begin and end. */
285 static const TIndicCodeMapping KMalaCodeMap[] =
287 {0, EIndicCodeOther}, // NOT USED D00 - D01
288 {0xD02, EIndicCodeCombiningSign}, // Modifiers
289 {0xD04, EIndicCodeOther}, // NOT USED
290 {0xD05, EIndicCodeIndependentVowel},
291 // {0xD0D, EIndicCodeOther}, // Reserved
292 // {0xD0E, EIndicCodeIndependentVowel},
293 // {0xD11, EIndicCodeOther}, // Reserved
294 // {0xD12, EIndicCodeIndependentVowel},
295 {0xD15, EIndicCodeConsonant},
296 {0xD23, EIndicCodeConsonantMalaChillu}, // NNA
297 {0xD24, EIndicCodeConsonant},
298 {0xD28, EIndicCodeConsonantMalaChilluNA}, // NA
299 {0xD29, EIndicCodeOther}, // Reserved
300 {0xD2A, EIndicCodeConsonant},
301 {0xD30, EIndicCodeConsonantMalaChillu}, // RA
302 {0xD31, EIndicCodeConsonantMalaRRA}, // RRA
303 {0xD32, EIndicCodeConsonantMalaChillu}, // LA, LLA
304 {0xD34, EIndicCodeConsonant},
305 {0xD3A, EIndicCodeOther}, // NOT USED D3A - D3D
306 {0xD3E, EIndicCodeSplitVowel2},
307 {0xD3F, EIndicCodeDependentVowel},
308 // {0xD44, EIndicCodeOther}, // Reserved D44 - D45
309 {0xD46, EIndicCodeSplitVowel1},
310 {0xD48, EIndicCodeDependentVowel},
311 // {0xD49, EIndicCodeOther}, // Reserved D49
312 // {0xD4A, EIndicCodeDependentVowel},
313 {0xD4D, EIndicCodeVirama},
314 {0xD4E, EIndicCodeOther}, //Reserved D4E - D56
315 {0xD57, EIndicCodeTamilLengthMarkAU}, // EIndicCodeDependentVowel for Telugu ???
316 {0xD58, EIndicCodeOther}, // NOT USED D58 - D5F
317 {0xD60, EIndicCodeIndependentVowel}, // RR, LL
318 {0xD62, EIndicCodeOther}, // NOT USED D62 - D65, digits D66 - D6F
319 {0x200D, EIndicCodeZWJ},
320 {0x200E, EIndicCodeOther}
323 /* Holds all parameters specific to scripts */
324 struct TIndicScriptProcessorParameters{
325 TUint32 iLanguageCode;
330 const TIndicCodeMapping *iCodeMap;
333 static const TIndicScriptProcessorParameters KIndicDevParameters = {
334 0x48494E20, //KHindiLanguageCode,
335 0x64657661, //KDevanagariScriptCode,
338 sizeof(KDevCodeMap)/sizeof(KDevCodeMap[0]),
342 static const TIndicScriptProcessorParameters KIndicKanParameters = {
343 0x4B414E20, //KKannadaLanguageCode,
344 0x6B6E6461, //KKannadaScriptCode,
347 sizeof(KKanCodeMap)/sizeof(KKanCodeMap[0]),
351 static const TIndicScriptProcessorParameters KIndicGujParameters = {
352 0x47554A20, //KGujaratiLanguageCode,
353 0x67756A72, //KGujaratiScriptCode,
356 sizeof(KGujCodeMap)/sizeof(KGujCodeMap[0]),
360 static const TIndicScriptProcessorParameters KIndicBenParameters = {
361 0x42454E20, //KBengaliLanguageCode,
362 0x62656E67, //KBengaliScriptCode,
365 sizeof(KBenCodeMap)/sizeof(KBenCodeMap[0]),
369 static const TIndicScriptProcessorParameters KIndicTamParameters = {
370 0x54414D20, //KTamilLanguageCode,
371 0x74616D6C, //KTamilScriptCode,
374 sizeof(KTamCodeMap)/sizeof(KTamCodeMap[0]),
378 static const TIndicScriptProcessorParameters KIndicTelParameters = {
379 0x54454C20, //KTeluguLanguageCode,
380 0x74656C75, //KTeluguScriptCode,
383 sizeof(KTelCodeMap)/sizeof(KTelCodeMap[0]),
387 static const TIndicScriptProcessorParameters KIndicGurParameters = {
388 0x00000000, //KGurmukhiLanguageCode,
389 0x67757275, //KGurmukhiScriptCode,
392 sizeof(KGurCodeMap)/sizeof(KGurCodeMap[0]),
396 static const TIndicScriptProcessorParameters KIndicMalParameters = {
397 0x4D4C5220, //KMalayalamLanguageCode,
398 0x6D6C796D, //KMalayalamScriptCode,
401 sizeof(KMalaCodeMap)/sizeof(KMalaCodeMap[0]),
405 /** This is the default glyph selector class for Devanagari characters in the
406 range 0x0900..0x097F.
409 class GlyphSelector_Devanagari
412 static TBool Process(TGlyphSelectionState& aGss, RShapeInfo&);
416 /** This is the default glyph selector class for Kannada characters in the
417 range 0x0C80..0x0CFF.
420 class GlyphSelector_Kannada
423 static TBool Process(TGlyphSelectionState& aGss, RShapeInfo&);
427 /** This is the default glyph selector class for Gujarati characters in the
428 range 0x0A80..0x0AFF.
431 class GlyphSelector_Gujarati
434 static TBool Process(TGlyphSelectionState& aGss, RShapeInfo&);
437 /** This is the default glyph selector class for Bengali characters in the
438 range 0x0980..0x09FF.
441 class GlyphSelector_Bengali
444 static TBool Process(TGlyphSelectionState& aGss, RShapeInfo&);
447 /** This is the default glyph selector class for Tamil characters in the
448 range 0x0B80..0x0BFF.
451 class GlyphSelector_Tamil
454 static TBool Process(TGlyphSelectionState& aGss, RShapeInfo&);
457 /** This is the default glyph selector class for Telugu characters in the
458 range 0x0C00..0x0C7F.
461 class GlyphSelector_Telugu
464 static TBool Process(TGlyphSelectionState& aGss, RShapeInfo&);
467 /** This is the default glyph selector class for Gurmukhi characters in the
468 range 0x0A00..0x0A7F.
471 class GlyphSelector_Gurmukhi
474 static TBool Process(TGlyphSelectionState& aGss, RShapeInfo&);
477 /** This is the default glyph selector class for Malayalam characters in the
478 range 0x0D00..0x0D7F.
481 class GlyphSelector_Malayalam
484 static TBool Process(TGlyphSelectionState& aGss, RShapeInfo&);