001: /*
002: * (C) Copyright IBM Corp. 1998-2004. All Rights Reserved.
003: *
004: * The program is provided "as is" without any warranty express or
005: * implied, including the warranty of non-infringement and the implied
006: * warranties of merchantibility and fitness for a particular purpose.
007: * IBM will not be liable for any damages suffered by you as a result
008: * of using the Program. In no event will IBM be liable for any
009: * special, indirect or consequential damages or lost profits even if
010: * IBM has been advised of the possibility of their occurrence. IBM
011: * will not be liable for any third party claims against you.
012: */
013: /*
014: *
015: * (C) Copyright IBM Corp. 1998, All Rights Reserved
016: */
017:
018: package com.ibm.richtext.textpanel;
019:
020: /*
021: For any incoming character C
022: if you can map C using the following FakeArabicTable, return
023: FakeArabicTable(C)
024: else if C is from A through Z, return FakeArabicTable(lowercase(C))
025: else just return C
026:
027:
028: FakeArabicTable is defined by the following mapping
029:
030: 0 0660;ARABIC-INDIC DIGIT ZERO;Nd;0;AN;;0;0;0;N;;;;;
031: 1 0661;ARABIC-INDIC DIGIT ONE;Nd;0;AN;;1;1;1;N;;;;;
032: 2 0662;ARABIC-INDIC DIGIT TWO;Nd;0;AN;;2;2;2;N;;;;;
033: 3 0663;ARABIC-INDIC DIGIT THREE;Nd;0;AN;;3;3;3;N;;;;;
034: 4 0664;ARABIC-INDIC DIGIT FOUR;Nd;0;AN;;4;4;4;N;;;;;
035: 5 0665;ARABIC-INDIC DIGIT FIVE;Nd;0;AN;;5;5;5;N;;;;;
036: 6 0666;ARABIC-INDIC DIGIT SIX;Nd;0;AN;;6;6;6;N;;;;;
037: 7 0667;ARABIC-INDIC DIGIT SEVEN;Nd;0;AN;;7;7;7;N;;;;;
038: 8 0668;ARABIC-INDIC DIGIT EIGHT;Nd;0;AN;;8;8;8;N;;;;;
039: 9 0669;ARABIC-INDIC DIGIT NINE;Nd;0;AN;;9;9;9;N;;;;;
040:
041: % 066A;ARABIC PERCENT SIGN;Po;0;ET;;;;;N;;;;;
042: . 066B;ARABIC DECIMAL SEPARATOR;Po;0;AN;;;;;N;;;;;
043: , 060C;ARABIC COMMA;Po;0;R;;;;;N;;;;;
044: - 0640;ARABIC TATWEEL;Lm;0;R;;;;;N;;;;;
045: ' 0652;ARABIC SUKUN;Mn;34;R;;;;;N;;;;;
046: " 0651;ARABIC SHADDA;Mn;33;R;;;;;N;ARABIC SHADDAH;;;;
047: ; 061B;ARABIC SEMICOLON;Po;0;R;;;;;N;;;;;
048: ? 061F;ARABIC QUESTION MARK;Po;0;R;;;;;N;;;;;
049:
050: a 0627;ARABIC LETTER ALEF;Lo;0;R;;;;;N;;;;;
051: A 0639;ARABIC LETTER AIN;Lo;0;R;;;;;N;;;;;
052: b 0628;ARABIC LETTER BEH;Lo;0;R;;;;;N;ARABIC LETTER BAA;;;;
053: c 0635;ARABIC LETTER SAD;Lo;0;R;;;;;N;;;;;
054: d 062F;ARABIC LETTER DAL;Lo;0;R;;;;;N;;;;;
055: D 0630;ARABIC LETTER THAL;Lo;0;R;;;;;N;;;;;
056: E 064B;ARABIC FATHATAN;Mn;27;R;;;;;N;;;;;
057: e 064E;ARABIC FATHA;Mn;30;R;;;;;N;ARABIC FATHAH;;;;
058: f 0641;ARABIC LETTER FEH;Lo;0;R;;;;;N;ARABIC LETTER FA;;;;
059: g 063A;ARABIC LETTER GHAIN;Lo;0;R;;;;;N;;;;;
060: h 062D;ARABIC LETTER HAH;Lo;0;R;;;;;N;ARABIC LETTER HAA;;;;
061: H 0647;ARABIC LETTER HEH;Lo;0;R;;;;;N;ARABIC LETTER HA;;;;
062: I 064D;ARABIC KASRATAN;Mn;29;R;;;;;N;;;;;
063: i 0650;ARABIC KASRA;Mn;32;R;;;;;N;ARABIC KASRAH;;;;
064: j 062C;ARABIC LETTER JEEM;Lo;0;R;;;;;N;;;;;
065: K 062E;ARABIC LETTER KHAH;Lo;0;R;;;;;N;ARABIC LETTER KHAA;;;;
066: k 0643;ARABIC LETTER KAF;Lo;0;R;;;;;N;ARABIC LETTER CAF;;;;
067: l 0644;ARABIC LETTER LAM;Lo;0;R;;;;;N;;;;;
068: m 0645;ARABIC LETTER MEEM;Lo;0;R;;;;;N;;;;;
069: n 0646;ARABIC LETTER NOON;Lo;0;R;;;;;N;;;;;
070: o 064F;ARABIC DAMMA;Mn;31;R;;;;;N;ARABIC DAMMAH;;;;
071: p 0628;ARABIC LETTER BEH;Lo;0;R;;;;;N;ARABIC LETTER BAA;;;;
072: q 0642;ARABIC LETTER QAF;Lo;0;R;;;;;N;;;;;
073: r 0631;ARABIC LETTER REH;Lo;0;R;;;;;N;ARABIC LETTER RA;;;;
074: s 0633;ARABIC LETTER SEEN;Lo;0;R;;;;;N;;;;;
075: S 0634;ARABIC LETTER SHEEN;Lo;0;R;;;;;N;;;;;
076: t 062A;ARABIC LETTER TEH;Lo;0;R;;;;;N;ARABIC LETTER TAA;;;;
077: T 062B;ARABIC LETTER THEH;Lo;0;R;;;;;N;ARABIC LETTER THAA;;;;
078: U 064C;ARABIC DAMMATAN;Mn;28;R;;;;;N;;;;;
079: u 064F;ARABIC DAMMA;Mn;31;R;;;;;N;ARABIC DAMMAH;;;;
080: v 0641;ARABIC LETTER FEH;Lo;0;R;;;;;N;ARABIC LETTER FA;;;;
081: w 0648;ARABIC LETTER WAW;Lo;0;R;;;;;N;;;;;
082: x 0633;ARABIC LETTER SEEN;Lo;0;R;;;;;N;;;;;
083: y 064A;ARABIC LETTER YEH;Lo;0;R;;;;;N;ARABIC LETTER YA;;;;
084: z 0632;ARABIC LETTER ZAIN;Lo;0;R;;;;;N;;;;;
085: Z 0638;ARABIC LETTER ZAH;Lo;0;R;;;;;N;ARABIC LETTER DHAH;;;;
086:
087: */
088:
089: /**
090: * This class implements KeyRemap to produce transliterated Arabic
091: * characters from Latin-1 characters.
092: */
093:
094: final class ArabicTransliteration extends KeyRemap {
095:
096: static final String COPYRIGHT = "(C) Copyright IBM Corp. 1998-1999 - All Rights Reserved";
097:
098: public char remap(char c) {
099:
100: switch (c) {
101: case '0':
102: return '\u0660'; // ARABIC-INDIC DIGIT ZERO
103: case '1':
104: return '\u0661'; // ARABIC-INDIC DIGIT ONE
105: case '2':
106: return '\u0662'; // ARABIC-INDIC DIGIT TWO
107: case '3':
108: return '\u0663'; // ARABIC-INDIC DIGIT THREE
109: case '4':
110: return '\u0664'; // ARABIC-INDIC DIGIT FOUR
111: case '5':
112: return '\u0665'; // ARABIC-INDIC DIGIT FIVE
113: case '6':
114: return '\u0666'; // ARABIC-INDIC DIGIT SIX
115: case '7':
116: return '\u0667'; // ARABIC-INDIC DIGIT SEVEN
117: case '8':
118: return '\u0668'; // ARABIC-INDIC DIGIT EIGHT
119: case '9':
120: return '\u0669'; // ARABIC-INDIC DIGIT NINE
121:
122: case '%':
123: return '\u066A'; // ARABIC PERCENT SIGN
124: // the Traditional Arabic font does not contain this character
125: // case '.': return '\u066B'; // ARABIC DECIMAL SEPARATOR
126: case ',':
127: return '\u060C'; // ARABIC COMMA
128: case '-':
129: return '\u0640'; // ARABIC TATWEEL
130: case '\'':
131: return '\u0652'; // ARABIC SUKUN
132: case '"':
133: return '\u0651'; // ARABIC SHADDA
134: case ';':
135: return '\u061B'; // ARABIC SEMICOLON
136: case '?':
137: return '\u061F'; // ARABIC QUESTION MARK
138:
139: case 'a':
140: return '\u0627'; // ARABIC LETTER ALEF
141: case 'A':
142: return '\u0639'; // ARABIC LETTER AIN
143: case 'b':
144: return '\u0628'; // ARABIC LETTER BEH
145: case 'B':
146: return '\u0628'; // ARABIC LETTER BEH
147: case 'c':
148: return '\u0635'; // ARABIC LETTER SAD
149: case 'C':
150: return '\u0635'; // ARABIC LETTER SAD
151: case 'd':
152: return '\u062F'; // ARABIC LETTER DAL
153: case 'D':
154: return '\u0630'; // ARABIC LETTER THAL
155: case 'e':
156: return '\u064E'; // ARABIC FATHA
157: case 'E':
158: return '\u064B'; // ARABIC FATHATAN
159: case 'f':
160: return '\u0641'; // ARABIC LETTER FEH
161: case 'F':
162: return '\u0641'; // ARABIC LETTER FEH
163: case 'g':
164: return '\u063A'; // ARABIC LETTER GHAIN
165: case 'G':
166: return '\u063A'; // ARABIC LETTER GHAIN
167: case 'h':
168: return '\u062D'; // ARABIC LETTER HAH
169: case 'H':
170: return '\u0647'; // ARABIC LETTER HEH
171: case 'i':
172: return '\u0650'; // ARABIC KASRA
173: case 'I':
174: return '\u064D'; // ARABIC KASRATAN
175: case 'j':
176: return '\u062C'; // ARABIC LETTER JEEM
177: case 'J':
178: return '\u062C'; // ARABIC LETTER JEEM
179: case 'k':
180: return '\u0643'; // ARABIC LETTER KAF
181: case 'K':
182: return '\u062E'; // ARABIC LETTER KHAH
183: case 'l':
184: return '\u0644'; // ARABIC LETTER LAM
185: case 'L':
186: return '\u0644'; // ARABIC LETTER LAM
187: case 'm':
188: return '\u0645'; // ARABIC LETTER MEEM
189: case 'M':
190: return '\u0645'; // ARABIC LETTER MEEM
191: case 'n':
192: return '\u0646'; // ARABIC LETTER NOON
193: case 'N':
194: return '\u0646'; // ARABIC LETTER NOON
195: case 'o':
196: return '\u064F'; // ARABIC DAMMA
197: case 'O':
198: return '\u064F'; // ARABIC DAMMA
199: case 'p':
200: return '\u0628'; // ARABIC LETTER BEH
201: case 'P':
202: return '\u0628'; // ARABIC LETTER BEH
203: case 'q':
204: return '\u0642'; // ARABIC LETTER QAF
205: case 'Q':
206: return '\u0642'; // ARABIC LETTER QAF
207: case 'r':
208: return '\u0631'; // ARABIC LETTER REH
209: case 'R':
210: return '\u0631'; // ARABIC LETTER REH
211: case 's':
212: return '\u0633'; // ARABIC LETTER SEEN
213: case 'S':
214: return '\u0634'; // ARABIC LETTER SHEEN
215: case 't':
216: return '\u062A'; // ARABIC LETTER TEH
217: case 'T':
218: return '\u062B'; // ARABIC LETTER THEH
219: case 'U':
220: return '\u064C'; // ARABIC DAMMATAN
221: case 'u':
222: return '\u064F'; // ARABIC DAMMA
223: case 'v':
224: return '\u0641'; // ARABIC LETTER FEH
225: case 'V':
226: return '\u0641'; // ARABIC LETTER FEH
227: case 'w':
228: return '\u0648'; // ARABIC LETTER WAW
229: case 'W':
230: return '\u0648'; // ARABIC LETTER WAW
231: case 'x':
232: return '\u0633'; // ARABIC LETTER SEEN
233: case 'X':
234: return '\u0633'; // ARABIC LETTER SEEN
235: case 'y':
236: return '\u064A'; // ARABIC LETTER YEH
237: case 'Y':
238: return '\u064A'; // ARABIC LETTER YEH
239: case 'z':
240: return '\u0632'; // ARABIC LETTER ZAIN
241: case 'Z':
242: return '\u0638'; // ARABIC LETTER ZAH
243: }
244:
245: return c;
246: }
247: }
|