001: /*
002: *******************************************************************************
003: * Copyright (C) 2000-2004, International Business Machines Corporation and *
004: * others. All Rights Reserved. *
005: *******************************************************************************
006: */
007:
008: package com.ibm.icu.dev.tool.ime.indic;
009:
010: import java.util.Locale;
011:
012: public class DevanagariInputMethodDescriptor extends IndicIMDescriptor {
013: private static final Locale DEVANAGARI = new Locale("hi", "IN");
014:
015: public DevanagariInputMethodDescriptor() {
016: super (DEVANAGARI, "Devanagari");
017: }
018:
019: private static char[] keyboardMap;
020: private static char[][] substitutionTable;
021: private static char[] joinWithNukta;
022: private static char[] nuktaForm;
023:
024: protected IndicInputMethodImpl getImpl() {
025: if (keyboardMap == null) {
026: keyboardMap = new char[] {
027: /* 00 */'\u0000',
028: /* 01 */'\u0001',
029: /* 02 */'\u0002',
030: /* 03 */'\u0003',
031: /* 04 */'\u0004',
032: /* 05 */'\u0005',
033: /* 06 */'\u0006',
034: /* 07 */'\u0007',
035: /* 08 */'\u0008',
036: /* 09 */'\u0009',
037: /* 0A */'\012',
038: /* 0B */'\u000B',
039: /* 0C */'\u000C',
040: /* 0D */'\015',
041: /* 0E */'\u000E',
042: /* 0F */'\u000F',
043: /* 10 */'\u0010',
044: /* 11 */'\u0011',
045: /* 12 */'\u0012',
046: /* 13 */'\u0013',
047: /* 14 */'\u0014',
048: /* 15 */'\u0015',
049: /* 16 */'\u0016',
050: /* 17 */'\u0017',
051: /* 18 */'\u0018',
052: /* 19 */'\u0019',
053: /* 1A */'\u001A',
054: /* 1B */'\u001B',
055: /* 1C */'\u001C',
056: /* 1D */'\u001D',
057: /* 1E */'\u001E',
058: /* 1F */'\u001F',
059: /* 20 */'\u0020',
060: /* 21 */'\u090D', // '!'
061: /* 22 */'\u0920', // '"'
062: /* 23 */'\uFF00', // '#'
063: /* 24 */'\uFF01', // '$'
064: /* 25 */'\uFF02', // '%'
065: /* 26 */'\uFF04', // '&'
066: /* 27 */'\u091F', // '''
067: /* 28 */'\u0028', // '('
068: /* 29 */'\u0029', // ')'
069: /* 2A */'\uFF05', // '*'
070: /* 2B */'\u090B', // '+'
071: /* 2C */'\u002C', // ','
072: /* 2D */'\u002D', // '-'
073: /* 2E */'\u002E', // '.'
074: /* 2F */'\u092F', // '/'
075: /* 30 */'\u0966', // '0'
076: /* 31 */'\u0967', // '1'
077: /* 32 */'\u0968', // '2'
078: /* 33 */'\u0969', // '3'
079: /* 34 */'\u096A', // '4'
080: /* 35 */'\u096B', // '5'
081: /* 36 */'\u096C', // '6'
082: /* 37 */'\u096D', // '7'
083: /* 38 */'\u096E', // '8'
084: /* 39 */'\u096F', // '9'
085: /* 3A */'\u091B', // ':'
086: /* 3B */'\u091A', // ';'
087: /* 3C */'\u0937', // '<'
088: /* 3D */'\u0943', // '='
089: /* 3E */'\u0964', // '>'
090: /* 3F */'\u095F', // '?'
091: /* 40 */'\u0945', // '@'
092: /* 41 */'\u0913', // 'A'
093: /* 42 */'\u0934', // 'B'
094: /* 43 */'\u0923', // 'C'
095: /* 44 */'\u0905', // 'D'
096: /* 45 */'\u0906', // 'E'
097: /* 46 */'\u0907', // 'F'
098: /* 47 */'\u0909', // 'G'
099: /* 48 */'\u092B', // 'H'
100: /* 49 */'\u0918', // 'I'
101: /* 4A */'\u0931', // 'J'
102: /* 4B */'\u0916', // 'K'
103: /* 4C */'\u0925', // 'L'
104: /* 4D */'\u0936', // 'M'
105: /* 4E */'\u0933', // 'N'
106: /* 4F */'\u0927', // 'O'
107: /* 50 */'\u091D', // 'P'
108: /* 51 */'\u0914', // 'Q'
109: /* 52 */'\u0908', // 'R'
110: /* 53 */'\u090F', // 'S'
111: /* 54 */'\u090A', // 'T'
112: /* 55 */'\u0919', // 'U'
113: /* 56 */'\u0929', // 'V'
114: /* 57 */'\u0910', // 'W'
115: /* 58 */'\u0901', // 'X'
116: /* 59 */'\u092D', // 'Y'
117: /* 5A */'\u090E', // 'Z'
118: /* 5B */'\u0921', // '['
119: /* 5C */'\u0949', // '\'
120: /* 5D */'\u093C', // ']'
121: /* 5E */'\uFF03', // '^'
122: /* 5F */'\u0903', // '_'
123: /* 60 */'\u094A', // '`'
124: /* 61 */'\u094B', // 'a'
125: /* 62 */'\u0935', // 'b'
126: /* 63 */'\u092E', // 'c'
127: /* 64 */'\u094D', // 'd'
128: /* 65 */'\u093E', // 'e'
129: /* 66 */'\u093F', // 'f'
130: /* 67 */'\u0941', // 'g'
131: /* 68 */'\u092A', // 'h'
132: /* 69 */'\u0917', // 'i'
133: /* 6A */'\u0930', // 'j'
134: /* 6B */'\u0915', // 'k'
135: /* 6C */'\u0924', // 'l'
136: /* 6D */'\u0938', // 'm'
137: /* 6E */'\u0932', // 'n'
138: /* 6F */'\u0926', // 'o'
139: /* 70 */'\u091C', // 'p'
140: /* 71 */'\u094C', // 'q'
141: /* 72 */'\u0940', // 'r'
142: /* 73 */'\u0947', // 's'
143: /* 74 */'\u0942', // 't'
144: /* 75 */'\u0939', // 'u'
145: /* 76 */'\u0928', // 'v'
146: /* 77 */'\u0948', // 'w'
147: /* 78 */'\u0902', // 'x'
148: /* 79 */'\u092C', // 'y'
149: /* 7A */'\u0946', // 'z'
150: /* 7B */'\u0922', // '{'
151: /* 7C */'\u0911', // '|'
152: /* 7D */'\u091E', // '}'
153: /* 7E */'\u0912', // '~'
154: /* 7F */'\u007F' // ''
155: };
156:
157: // the character substitutions for the meta characters.
158: char[] RA_SUB = { '\u094D', '\u0930' };
159: char[] RA_SUP = { '\u0930', '\u094D' };
160: char[] CONJ_JA_NYA = { '\u091C', '\u094D', '\u091E' };
161: char[] CONJ_TA_RA = { '\u0924', '\u094D', '\u0930' };
162: char[] CONJ_KA_SSA = { '\u0915', '\u094D', '\u0937' };
163: char[] CONJ_SHA_RA = { '\u0936', '\u094D', '\u0930' };
164:
165: substitutionTable = new char[][] { RA_SUB, RA_SUP,
166: CONJ_JA_NYA, CONJ_TA_RA, CONJ_KA_SSA, CONJ_SHA_RA };
167:
168: // The following characters followed by Nukta should be replaced
169: // by the corresponding character as defined in ISCII91
170: char SIGN_CANDRABINDU = '\u0901';
171: char LETTER_I = '\u0907';
172: char LETTER_II = '\u0908';
173: char LETTER_VOCALIC_R = '\u090B';
174: char LETTER_KA = '\u0915';
175: char LETTER_KHA = '\u0916';
176: char LETTER_GA = '\u0917';
177: char LETTER_JA = '\u091C';
178: char LETTER_DDA = '\u0921';
179: char LETTER_DDHA = '\u0922';
180: char LETTER_PHA = '\u092B';
181: char VOWEL_SIGN_I = '\u093F';
182: char VOWEL_SIGN_II = '\u0940';
183: char VOWEL_SIGN_VOCALIC_R = '\u0943';
184: char DANDA = '\u0964';
185:
186: // The following characters replace the above characters followed by Nukta. These
187: // are defined in one to one correspondence order.
188: char SIGN_OM = '\u0950';
189: char LETTER_VOCALIC_L = '\u090C';
190: char LETTER_VOCALIC_LL = '\u0961';
191: char LETTER_VOCALIC_RR = '\u0960';
192: char LETTER_QA = '\u0958';
193: char LETTER_KHHA = '\u0959';
194: char LETTER_GHHA = '\u095A';
195: char LETTER_ZA = '\u095B';
196: char LETTER_DDDHA = '\u095C';
197: char LETTER_RHA = '\u095D';
198: char LETTER_FA = '\u095E';
199: char VOWEL_SIGN_VOCALIC_L = '\u0962';
200: char VOWEL_SIGN_VOCALIC_LL = '\u0963';
201: char VOWEL_SIGN_VOCALIC_RR = '\u0944';
202: char SIGN_AVAGRAHA = '\u093D';
203:
204: joinWithNukta = new char[] { SIGN_CANDRABINDU, LETTER_I,
205: LETTER_II, LETTER_VOCALIC_R, LETTER_KA, LETTER_KHA,
206: LETTER_GA, LETTER_JA, LETTER_DDA, LETTER_DDHA,
207: LETTER_PHA, VOWEL_SIGN_I, VOWEL_SIGN_II,
208: VOWEL_SIGN_VOCALIC_R, DANDA };
209:
210: nuktaForm = new char[] { SIGN_OM, LETTER_VOCALIC_L,
211: LETTER_VOCALIC_LL, LETTER_VOCALIC_RR, LETTER_QA,
212: LETTER_KHHA, LETTER_GHHA, LETTER_ZA, LETTER_DDDHA,
213: LETTER_RHA, LETTER_FA, VOWEL_SIGN_VOCALIC_L,
214: VOWEL_SIGN_VOCALIC_LL, VOWEL_SIGN_VOCALIC_RR,
215: SIGN_AVAGRAHA };
216: }
217:
218: return new IndicInputMethodImpl(keyboardMap, joinWithNukta,
219: nuktaForm, substitutionTable);
220: }
221: }
|