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 GurmukhiInputMethodDescriptor extends IndicIMDescriptor {
013: private static final Locale GURMUKHI = new Locale("pa", "IN"); // pa = Punjabi
014:
015: public GurmukhiInputMethodDescriptor() {
016: super (GURMUKHI, "Gurmukhi");
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 */'\u0A0D', // '!'
061: /* 22 */'\u0A20', // '"'
062: /* 23 */'\uFF00', // '#'
063: /* 24 */'\uFFFF', // '$'
064: /* 25 */'\uFFFF', // '%'
065: /* 26 */'\uFFFF', // '&'
066: /* 27 */'\u0A1F', // '''
067: /* 28 */'\u0028', // '('
068: /* 29 */'\u0029', // ')'
069: /* 2A */'\uFFFF', // '*'
070: /* 2B */'\u0A0B', // '+'
071: /* 2C */'\u002C', // ','
072: /* 2D */'\u002D', // '-'
073: /* 2E */'\u002E', // '.'
074: /* 2F */'\u0A2F', // '/'
075: /* 30 */'\u0A66', // '0'
076: /* 31 */'\u0A67', // '1'
077: /* 32 */'\u0A68', // '2'
078: /* 33 */'\u0A69', // '3'
079: /* 34 */'\u0A6A', // '4'
080: /* 35 */'\u0A6B', // '5'
081: /* 36 */'\u0A6C', // '6'
082: /* 37 */'\u0A6D', // '7'
083: /* 38 */'\u0A6E', // '8'
084: /* 39 */'\u0A6F', // '9'
085: /* 3A */'\u0A1B', // ':'
086: /* 3B */'\u0A1A', // ';'
087: /* 3C */'\u0A37', // '<'
088: /* 3D */'\u0A43', // '='
089: /* 3E */'\u0964', // '>' (Devanagari danda)
090: /* 3F */'\u0A5F', // '?'
091: /* 40 */'\u0A45', // '@'
092: /* 41 */'\u0A13', // 'A'
093: /* 42 */'\u0A34', // 'B'
094: /* 43 */'\u0A23', // 'C'
095: /* 44 */'\u0A05', // 'D'
096: /* 45 */'\u0A06', // 'E'
097: /* 46 */'\u0A07', // 'F'
098: /* 47 */'\u0A09', // 'G'
099: /* 48 */'\u0A2B', // 'H'
100: /* 49 */'\u0A18', // 'I'
101: /* 4A */'\u0A31', // 'J'
102: /* 4B */'\u0A16', // 'K'
103: /* 4C */'\u0A25', // 'L'
104: /* 4D */'\u0A36', // 'M'
105: /* 4E */'\u0A33', // 'N'
106: /* 4F */'\u0A27', // 'O'
107: /* 50 */'\u0A1D', // 'P'
108: /* 51 */'\u0A14', // 'Q'
109: /* 52 */'\u0A08', // 'R'
110: /* 53 */'\u0A0F', // 'S'
111: /* 54 */'\u0A0A', // 'T'
112: /* 55 */'\u0A19', // 'U'
113: /* 56 */'\u0A29', // 'V'
114: /* 57 */'\u0A10', // 'W'
115: /* 58 */'\u0A01', // 'X'
116: /* 59 */'\u0A2D', // 'Y'
117: /* 5A */'\u0A0E', // 'Z'
118: /* 5B */'\u0A21', // '['
119: /* 5C */'\u0A49', // '\'
120: /* 5D */'\u0A3C', // ']'
121: /* 5E */'\uFFFF', // '^'
122: /* 5F */'\u0A03', // '_'
123: /* 60 */'\u0A4A', // '`'
124: /* 61 */'\u0A4B', // 'a'
125: /* 62 */'\u0A35', // 'b'
126: /* 63 */'\u0A2E', // 'c'
127: /* 64 */'\u0A4D', // 'd'
128: /* 65 */'\u0A3E', // 'e'
129: /* 66 */'\u0A3F', // 'f'
130: /* 67 */'\u0A41', // 'g'
131: /* 68 */'\u0A2A', // 'h'
132: /* 69 */'\u0A17', // 'i'
133: /* 6A */'\u0A30', // 'j'
134: /* 6B */'\u0A15', // 'k'
135: /* 6C */'\u0A24', // 'l'
136: /* 6D */'\u0A38', // 'm'
137: /* 6E */'\u0A32', // 'n'
138: /* 6F */'\u0A26', // 'o'
139: /* 70 */'\u0A1C', // 'p'
140: /* 71 */'\u0A4C', // 'q'
141: /* 72 */'\u0A40', // 'r'
142: /* 73 */'\u0A47', // 's'
143: /* 74 */'\u0A42', // 't'
144: /* 75 */'\u0A39', // 'u'
145: /* 76 */'\u0A28', // 'v'
146: /* 77 */'\u0A48', // 'w'
147: /* 78 */'\u0A70', // 'x' (Gurmukhi TIPPI rather than BINDI)
148: /* 79 */'\u0A2C', // 'y'
149: /* 7A */'\u0A46', // 'z'
150: /* 7B */'\u0A22', // '{'
151: /* 7C */'\u0A11', // '|'
152: /* 7D */'\u0A1E', // '}'
153: /* 7E */'\u0A12', // '~'
154: /* 7F */'\u007F' // ''
155: };
156:
157: char[] RA_SUB = { '\u0A4D', '\u0A30' };
158:
159: substitutionTable = new char[][] { RA_SUB };
160:
161: // The following characters followed by Nukta should be replaced
162: // by the corresponding character as defined in ISCII91
163: char LETTER_KHA = '\u0A16';
164: char LETTER_GA = '\u0A17';
165: char LETTER_JA = '\u0A1C';
166: char LETTER_DDA = '\u0A21';
167: char LETTER_PHA = '\u0A2B';
168:
169: // The following characters replace the above characters followed by Nukta. These
170: // are defined in one to one correspondence order.
171: // NOTE: the inscript keyboard doc. lists a KA + NUKTA and a DDHA + NUKTA
172: // neither of which seem to have Unicode code points...
173: char LETTER_KHHA = '\u0A59';
174: char LETTER_GHHA = '\u0A5A';
175: char LETTER_ZA = '\u0A5B';
176: char LETTER_RRA = '\u0A5C';
177: char LETTER_FA = '\u0A5E';
178:
179: joinWithNukta = new char[] { LETTER_KHA, LETTER_GA,
180: LETTER_JA, LETTER_DDA, LETTER_PHA };
181:
182: nuktaForm = new char[] { LETTER_KHHA, LETTER_GHHA,
183: LETTER_ZA, LETTER_RRA, LETTER_FA };
184: }
185:
186: return new IndicInputMethodImpl(keyboardMap, joinWithNukta,
187: nuktaForm, substitutionTable);
188: }
189: }
|