2
* @(#)CharToByteX11Johab.java 1.1 99/08/28
4
* The contents of this file are subject to the Mozilla Public
5
* License Version 1.1 (the "License"); you may not use this file
6
* except in compliance with the License. You may obtain a copy of
7
* the License at http://www.mozilla.org/MPL/
9
* Software distributed under the License is distributed on an "AS
10
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
11
* implied. See the License for the specific language governing
12
* rights and limitations under the License.
14
* The Original Code is CharToByteX11Johab.java
16
* The Initial Developer of the Original Code is Deogtae Kim
17
* <dtkim@calab.kaist.ac.kr> (98/05/03) and
18
* Based on: Hanterm source code adapted by Jungshik Shin
19
* <jshin@pantheon.yale.edu>
22
* Deogtae Kim <dtkim@calab.kaist.ac.kr> (99/08/28)
23
* Jungshik Shin <jshin@pantheon.yale.edu>
24
* Pierre Phaneuf <pp@ludusdesign.com>
27
* 1. Enable displaying all 11,172 Modern hangul syllables with Hanterm
29
* 2. Enable displaying some of Unicode 2.0 ancient hangul syllables
30
* with Hanterm johab fonts on Unix
31
* 3. Enable displaying all of Unicode 2.0 ancient hangul syllables with
32
* possible future extended Hanterm johab fonts on Unix
34
* - Installation Instructions:
35
* 1. Install Hanterm Johab fonts and a proper font property file to Unix system.
36
* (Confer http://calab.kaist.ac.kr/~dtkim/java/)
37
* 2. Make a directory "jdk1.x.x/classes/"
38
* 3. Compile this class into "jdk1.x.x/classes/"
40
* - Hangule syllable break rule algorithm descriptions:
41
* The algorithm used here is slightly different from that of the Unicode standard 2.0.
42
* The standard saids that a (canonical) hangul syllable block is a sequence of leading
43
* consonants and a sequence of vowels and an optional sequence of trailing
45
* I think this unncessarily complicate matters.
46
* So, the algorithm chosen here is:
47
* A (non-canonical) hangul syllable block is the longest sequence comprised of
48
* an optional leading consonant and an optional vowel and an optional trailing consonant.
49
* The skipped leading consonants and vowels are considered as fillers.
50
* The merit of this algorithm is that any sequence of jamos can be composed validly.
52
#include "nsUnicodeToX11Johab.h"
53
#include "nsUCvKODll.h"
59
NS_IMPL_ADDREF(nsUnicodeToX11Johab)
60
NS_IMPL_RELEASE(nsUnicodeToX11Johab)
61
nsresult nsUnicodeToX11Johab::QueryInterface(REFNSIID aIID,
64
if (NULL == aInstancePtr) {
65
return NS_ERROR_NULL_POINTER;
70
static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID);
72
if (aIID.Equals(NS_GET_IID(nsIUnicodeEncoder))) {
73
*aInstancePtr = (void*) ((nsIUnicodeEncoder*)this);
77
if (aIID.Equals(NS_GET_IID(nsICharRepresentable))) {
78
*aInstancePtr = (void*) ((nsICharRepresentable*)this);
82
if (aIID.Equals(kISupportsIID)) {
83
*aInstancePtr = (void*) ((nsISupports*)((nsIUnicodeEncoder*)this));
88
return NS_NOINTERFACE;
92
NS_IMETHODIMP nsUnicodeToX11Johab::SetOutputErrorBehavior(
94
nsIUnicharEncoder * aEncoder, PRUnichar aChar)
96
return NS_ERROR_NOT_IMPLEMENTED;
100
// 2 * @(#)CharToByteX11Johab.java 1.0 98/05/03
103
// 5 * 1. Enable displaying all 11,172 Modern hangul syllables with Hanterm
104
// 6 * johab fonts on Unix
105
// 7 * 2. Enable displaying some of Unicode 2.0 ancient hangul syllables
106
// 8 * with Hanterm johab fonts on Unix
107
// 9 * 3. Enable displaying all of Unicode 2.0 ancient hangul syllables with
108
// 10 * possible future extended Hanterm johab fonts on Unix
110
// 12 * Installation Instructions:
111
// 13 * 1. Install Hanterm Johab fonts and a proper font property file to Unix syste
113
// 15 * (Confer http://calab.kaist.ac.kr/~dtkim/java/ )
114
// 16 * 2. Make a directory "jdk1.x.x/classes/"
115
// 17 * 3. Compile this class into "jdk1.x.x/classes/"
117
// 19 * Author: Deogtae Kim <dtkim@calab.kaist.ac.kr>, 98/05/03
119
// 21 * Based on: Hanterm source code adapted by Jungshik Shin <jshin@pantheon.yale.
123
// 25 import sun.io.CharToByteConverter;
124
// 26 import sun.io.MalformedInputException;
125
// 27 import sun.io.UnknownCharacterException;
126
// 28 import sun.io.ConversionBufferFullException;
128
// 30 public class CharToByteX11Johab extends CharToByteConverter
130
// 32 int state = START;
132
// 34 public static final int START = 0;
133
// 35 public static final int LEADING_CONSONANT = 1;
134
// 36 public static final int VOWEL = 2;
136
// 38 int l = 0x5f; // leading consonant
137
// 39 int v = 0; // vowel
138
// 40 int t = 0; // trailing consonant
141
#define LEADING_CONSONANT 1
144
// constructor and destroctor
146
nsUnicodeToX11Johab::nsUnicodeToX11Johab()
155
nsUnicodeToX11Johab::~nsUnicodeToX11Johab()
161
// 43 * This method indicates the charset name for this font.
163
// 45 public String getCharacterEncoding()
165
// 47 return "X11Johab";
169
// 51 * This method indicates the range this font covers.
171
// 53 public boolean canConvert(char ch)
173
// 55 if ( 0xac00 <= ch && ch <= 0xd7a3 // Modern hangul syllables
174
// 56 || 0x1100 <= ch && ch <= 0x1112 // modern leading consonants (19
176
// 58 || 0x1113 <= ch && ch <= 0x1159 // ancient leading consonants (7
178
// 60 && lconBase[ch-0x1100] != 0
179
// 61 || ch == 0x115f // leading consonants filler
180
// 62 || 0x1160 <= ch && ch <= 0x1175 // modern vowels (21)
181
// 63 || 0x1176 <= ch && ch <= 0x11a2 // ancient vowels (45)
182
// 64 && vowBase[ch-0x1160] != 0
183
// 65 || 0x11a8 <= ch && ch <= 0x11c2 // modern trailing consonants (2
185
// 67 || 0x11c3 <= ch && ch <= 0x11f9 // ancient trailing consonants (
187
// 69 && tconBase[ch-0x11a7] != 0 )
192
#define canConvert(ch) \
193
(((0xac00 <=(ch))&&((ch)<= 0xd7a3)) /* Modern hangul syllables */\
194
|| ((0x1100 <=(ch))&&((ch)<= 0x1112)) /* modern leading consonants (19) */\
195
|| ((0x1113 <=(ch))&&((ch)<= 0x1159) /* ancient leading consonants (71) */\
196
&& (lconBase[ch-0x1100] != 0)) */\
197
|| ((ch) == 0x115f) /* leading consonants filler */\
198
|| ((0x1160 <=(ch))&&((ch)<= 0x1175)) /* modern vowels (21) */\
199
|| ((0x1176 <=(ch))&&((ch)<= 0x11a2) /* ancient vowels (45) */\
200
&& (vowBase[(ch)-0x1160] != 0 )) */\
201
|| ((0x11a8 <=(ch))&&((ch)<= 0x11c2))/* modern trailing consonants (27) */\
202
|| ((0x11c3 <=(ch))&&((ch)<= 0x11f9) /* ancient trailing consonants (55)*/\
203
&& (tconBase[(ch)-0x11a7] != 0 )))
207
// 75 * This method converts the unicode to this font index.
208
// 76 * Note: ConversionBufferFullException is not handled
209
// 77 * since this class is only used for character display.
211
// 79 public int convert(char[] input, int inStart, int inEnd,
212
// 80 byte[] output, int outStart, int outEnd)
213
// 81 throws MalformedInputException, UnknownCharacterException
215
NS_IMETHODIMP nsUnicodeToX11Johab::Convert(
216
const PRUnichar * input, PRInt32 * aSrcLength,
217
char * output, PRInt32 * aDestLength)
219
// 83 charOff = inStart;
220
// 84 byteOff = outStart;
221
charOff = byteOff = 0;
223
/* 86 */ for (; charOff < *aSrcLength; charOff++)
225
/* 88 */ PRUnichar ch = input[charOff];
226
/* 89 */ if (0xac00 <= ch && ch <= 0xd7a3)
228
/* 91 */ if ( state != START )
229
/* 92 */ composeHangul(output);
230
/* 93 */ ch -= 0xac00;
231
/* 94 */ l = (ch / 588); // 588 = 21*28
232
/* 95 */ v = ( ch / 28 ) % 21 + 1;
233
/* 96 */ t = ch % 28;
234
/* 97 */ composeHangul(output);
235
/* 98 */ } else if (0x1100 <= ch && ch <= 0x115f)
236
/* 99 */ { // leading consonants (19 + 71 + 1)
237
/* 100 */ if ( state != START )
238
/* 101 */ composeHangul(output);
239
/* 102 */ l = ch - 0x1100;
240
/* 103 */ state = LEADING_CONSONANT;
241
/* 104 */ } else if (1160 <= ch && ch <= 0x11a2)
242
/* 105 */ { // vowels (1 + 21 + 45)
243
/* 106 */ v = ch - 0x1160;
244
/* 107 */ state = VOWEL;
245
/* 108 */ } else if (0x11a8 <= ch && ch <= 0x11f9)
246
/* 109 */ { // modern trailing consonants (27)
247
/* 110 */ t = ch - 0x11a7;
248
/* 111 */ composeHangul(output);
251
// 114 throw new UnknownCharacterException();
255
/* 118 */ if ( state != START )
256
/* 119 */ composeHangul( output );
258
// 121 return byteOff - outStart;
260
*aDestLength = byteOff;
264
// 124 public int flush(byte output[], int i, int j)
265
// 125 throws MalformedInputException
267
NS_IMETHODIMP nsUnicodeToX11Johab::Finish(
268
char * output, PRInt32 * aDestLength)
270
/* 127 */ byteOff = 0;
271
/* 128 */ PRInt32 len = 0;
272
/* 129 */ if ( state != START )
274
/* 131 */ composeHangul( output );
275
/* 132 */ len = byteOff;
277
/* 134 */ byteOff = charOff = 0;
285
//================================================================
286
NS_IMETHODIMP nsUnicodeToX11Johab::Reset()
287
// 138 public void reset()
289
/* 140 */ byteOff = charOff = 0;
290
/* 141 */ state = START;
295
//================================================================
297
// 146 public int getMaxBytesPerChar()
302
NS_IMETHODIMP nsUnicodeToX11Johab::GetMaxLength(
303
const PRUnichar * aSrc, PRInt32 aSrcLength,
304
PRInt32 * aDestLength)
306
*aDestLength = (aSrcLength + 1) * 6;
309
//================================================================
312
// 151 // The base font index for leading consonants
314
// 153 static final short[] lconBase = {
315
static const PRUint16 lconBase[] = {
316
/* 154 */ // modern leading consonants (19)
317
/* 155 */ 1, 11, 21, 31, 41, 51,
318
/* 156 */ 61, 71, 81, 91, 101, 111,
319
/* 157 */ 121, 131, 141, 151, 161, 171,
322
/* 160 */ // ancient leading consonants (71 + reserved 5 + filler 1)
323
/* 161 */ 0, 0, 0, 0, 0, 0, // \u1113 ~ :
324
/* 162 */ 0, 0, 0, 0, 0, 201, // \u1119 ~ :
325
/* 163 */ 0, 221, 251, 0, 0, 0, // \u111f ~ :
326
/* 164 */ 0, 0, 281, 0, 0, 0, // \u1125 ~ :
327
/* 165 */ 191, 0, 211, 0, 231, 0, // \u112b ~ :
328
/* 166 */ 0, 241, 0, 0, 0, 291, // \u1131 ~ :
329
/* 167 */ 0, 0, 0, 0, 0, 0, // \u1137 ~ :
330
/* 168 */ 0, 0, 0, 261, 0, 0, // \u113d ~ :
331
/* 169 */ 0, 0, 0, 0, 0, 0, // \u1143 ~ :
332
/* 170 */ 0, 0, 0, 271, 0, 0, // \u1149 ~ :
333
/* 171 */ 0, 0, 0, 0, 0, 0, // \u114f ~ :
334
/* 172 */ 0, 0, 0, 0, 301, // \u1155 ~ :
335
/* 173 */ 0, 0, 0, 0, 0, // \u115a ~ : reserved
336
/* 174 */ 0, // \u115f : leading consonant filler
338
//================================================================
340
// 177 // The base font index for vowels
342
// 179 static final short[] vowBase = {
343
static const PRUint16 vowBase[] = {
344
/* 180 */ // modern vowels (filler + 21)
345
/* 181 */ 0,311,314,317,320,323, // (Fill), A, AE, YA, YAE, EO
346
/* 182 */ 326,329,332,335,339,343, // E, YEO, YE, O, WA, WAE
347
/* 183 */ 347,351,355,358,361,364, // OI, YO, U, WEO, WE, WI
348
/* 184 */ 367,370,374,378, // YU, EU, UI, I
350
/* 186 */ // ancient vowels (45)
351
/* 187 */ 0, 0, 0, 0, 0, 0, // \u1176 ~ : A-O, A-U, YA-O, YA-YO, EO-O, EO- U
352
/* 189 */ 0, 0, 0, 0, 0, 0, // \u117c ~ : EO-EU, YEO-O, YEO-U, O-EO, O-E, O-YE
353
/* 191 */ 0, 0, 381, 384, 0, 0, // \u1182 ~ : O-O, O-U, YO-YA, YO-YAE, YO-YEO, YO-O
354
/* 193 */ 387, 0, 0, 0, 0, 0, // \u1188 ~ : YO-I, U-A, U-AE, U-EO-EU, U-YE, U-U
355
/* 195 */ 0, 0, 0, 390, 393, 0, // \u118e ~ : YU-A, YU-EO, YU-E, YU-YEO, YU-YE , YU-U
356
/* 197 */ 396, 0, 0, 0, 0, 0, // \u1194 ~ : YU-I, EU-U, EU-EU, YI-U, I-A, I- YA
357
/* 199 */ 0, 0, 0, 0, 399, 0, // \u119a ~ : I-O, I-U, I-EU, I-ARAEA, ARAEA, ARAEA-EO
358
/* 201 */ 0, 402, 0 // \u11a0 ~ : ARAEA-U, ARAEA-I,SSANGARAEA
360
//================================================================
362
// 204 // The base font index for trailing consonants
364
// 206 static final short[] tconBase = {
365
static const PRUint16 tconBase[] = {
366
// 207 // modern trailing consonants (filler + 27)
368
/* 209 */ 405, 409, 413, 417, 421,
369
/* 210 */ 425, 429, 433, 437, 441,
370
/* 211 */ 445, 459, 453, 457, 461,
371
/* 212 */ 465, 469, 473, 477, 481,
372
/* 213 */ 485, 489, 493, 497, 501,
375
// 216 // ancient trailing consonants (55)
376
/* 217 */ 0, 0, 0, 0, 0, 0, // \u11c3 ~ :
377
/* 218 */ 0, 0, 0, 0, 0, 0, // \u11c9 ~ :
378
/* 219 */ 0, 0, 0, 0, 0, 0, // \u11cf ~ :
379
/* 220 */ 0, 0, 0, 0, 513, 517, // \u11d5 ~ :
380
/* 221 */ 0, 0, 0, 0, 0, 0, // \u11db ~ :
381
/* 222 */ 0, 0, 0, 0, 0, 0, // \u11e1 ~ :
382
/* 223 */ 0, 0, 0, 0, 0, 0, // \u11e7 ~ :
383
/* 224 */ 0, 0, 0, 525, 0, 0, // \u11ed ~ :
384
/* 225 */ 0, 0, 0, 0, 0, 0, // \u11f3 ~ :
385
/* 226 */ 521 // \u11f9:
387
//================================================================
389
// 229 // The mapping from vowels to leading consonant type
390
// 230 // in absence of trailing consonant
392
// 232 static final short[] lconMap1 = {
393
static const PRUint8 lconMap1[] = {
394
/* 233 */ 0,0,0,0,0,0, // (Fill), A, AE, YA, YAE, EO
395
/* 234 */ 0,0,0,1,3,3, // E, YEO, YE, O, WA, WAE
396
/* 235 */ 3,1,2,4,4,4, // OI, YO, U, WEO, WE, WI
397
/* 236 */ 2,1,3,0, // YU, EU, UI, I
399
// 238 // ancient vowels (45)
400
/* 239 */ 3, 4, 3, 3, 3, 4, // \u1176 ~ : A-O, A-U, YA-O, YA-YO, EO-O, EO-U
401
/* 240 */ 4, 3, 4, 3, 3, 3, // \u117c ~ : EO-EU, YEO-O, YEO-U, O-EO, O-E, O-YE
402
/* 241 */ 1, 1, 3, 3, 3, 1, // \u1182 ~ : O-O, O-U, YO-YA, YO-YAE, YO-YEO, YO-O
403
/* 242 */ 3, 4, 4, 4, 4, 2, // \u1188 ~ : YO-I, U-A, U-AE, U-EO-EU, U-YE, U-U
404
/* 243 */ 3, 3, 3, 3, 3, 2, // \u118e ~ : YU-A, YU-EO, YU-E, YU-YEO, YU-YE, YU-U
405
/* 245 */ 4, 2, 2, 4, 0, 0, // \u1194 ~ : YU-I, EU-U, EU-EU, YI-U, I-A, I-YA
406
/* 246 */ 3, 4, 3, 0, 1, 3, // \u119a ~ : I-O, I-U, I-EU, I-ARAEA, ARAEA, ARAEA-EO
407
/* 248 */ 2, 3, 1 // \u11a0 ~ : ARAEA-U, ARAEA-I, SSANGARAEA
409
//================================================================
411
// 251 // The mapping from vowels to leading consonant type
412
// 252 // in presence of trailing consonant
414
static const PRUint8 lconMap2[] = {
415
// 254 static final short[] lconMap2 = {
416
/* 255 */ 5,5,5,5,5,5, // (Fill), A, AE, YA, YAE, EO
417
/* 256 */ 5,5,5,6,8,8, // E, YEO, YE, O, WA, WAE
418
/* 257 */ 8,6,7,9,9,9, // OI, YO, U, WEO, WE, WI
419
/* 258 */ 7,6,8,5, // YU, EU, UI, I
421
// 260 // ancient vowels (45)
422
/* 261 */ 8, 9, 8, 8, 8, 9, // \u1176 ~ : A-O, A-U, YA-O, YA-YO, EO-O, EO-U
423
/* 262 */ 9, 8, 9, 8, 8, 8, // \u117c ~ : EO-EU, YEO-O, YEO-U, O-EO, O-E, O-YE
424
/* 263 */ 6, 6, 8, 8, 8, 6, // \u1182 ~ : O-O, O-U, YO-YA, YO-YAE, YO-YEO, YO-O
425
/* 264 */ 8, 9, 9, 9, 9, 7, // \u1188 ~ : YO-I, U-A, U-AE, U-EO-EU, U-YE, U-U
426
/* 265 */ 8, 8, 8, 8, 8, 7, // \u118e ~ : YU-A, YU-EO, YU-E, YU-YEO, YU-YE, Y
427
/* 267 */ 9, 7, 7, 9, 5, 5, // \u1194 ~ : YU-I, EU-U, EU-EU, YI-U, I-A, I-YA
428
/* 268 */ 8, 9, 8, 5, 6, 8, // \u119a ~ : I-O, I-U, I-EU, I-ARAEA, ARAEA, ARAEA-EO
429
/* 270 */ 7, 8, 6 // \u11a0 ~ : ARAEA-U, ARAEA-I, SSANGARAEA
431
//================================================================
433
// 273 // vowel type ; 1 = o and its alikes, 0 = others
434
// 274 static final short[] vowType = {
435
static const PRUint8 vowType[] = {
436
/* 275 */ 0,0,0,0,0,0,
437
/* 276 */ 0,0,0,1,1,1,
438
/* 277 */ 1,1,0,0,0,0,
441
// 280 // ancient vowels (45)
442
/* 281 */ 1, 0, 1, 1, 1, 0, // \u1176 ~ : A-O, A-U, YA-O, YA-YO, EO-O, EO-U
443
/* 282 */ 0, 1, 0, 1, 1, 1, // \u117c ~ : EO-EU, YEO-O, YEO-U, O-EO, O-E, O-YE
444
/* 283 */ 1, 1, 0, 0, 0, 0, // \u1182 ~ : O-O, O-U, YO-YA, YO-YAE, YO-YEO, YO-O
445
/* 284 */ 0, 0, 0, 0, 0, 0, // \u1188 ~ : YO-I, U-A, U-AE, U-EO-EU, U-YE, U-U
446
/* 285 */ 0, 0, 0, 0, 0, 0, // \u118e ~ : YU-A, YU-EO, YU-E, YU-YEO, YU-YE, YU-U
447
/* 287 */ 0, 0, 0, 0, 0, 0, // \u1194 ~ : YU-I, EU-U, EU-EU, YI-U, I-A, I-YA
448
/* 288 */ 0, 0, 0, 0, 0, 0, // \u119a ~ : I-O, I-U, I-EU, I-ARAEA, ARAEA, ARAEA-EO
449
/* 290 */ 0, 0, 0 // \u11a0 ~ : ARAEA-U, ARAEA-I, SSANGARAEA
451
//================================================================
453
// 293 // The mapping from trailing consonants to vowel type
455
// 295 static final int[] tconType = {
456
static const PRUint8 tconType[] = {
457
/* 296 */ 0, 1, 1, 1, 2, 1,
458
/* 297 */ 1, 1, 1, 1, 1, 1,
459
/* 298 */ 1, 1, 1, 1, 1, 1,
460
/* 299 */ 1, 1, 1, 1, 1, 1,
461
/* 300 */ 1, 1, 1, 1,
463
// 302 // ancient trailing consonants (55)
464
/* 303 */ 1, 1, 1, 1, 1, 1, // \u11c3 ~ :
465
/* 304 */ 1, 1, 1, 1, 1, 1, // \u11c9 ~ :
466
/* 305 */ 1, 1, 1, 1, 1, 1, // \u11cf ~ :
467
/* 306 */ 1, 1, 1, 1, 1, 1, // \u11d5 ~ :
468
/* 307 */ 1, 1, 1, 1, 1, 1, // \u11db ~ :
469
/* 308 */ 1, 1, 1, 1, 1, 1, // \u11e1 ~ :
470
/* 309 */ 1, 1, 1, 1, 1, 1, // \u11e7 ~ :
471
/* 310 */ 1, 1, 1, 1, 1, 1, // \u11ed ~ :
472
/* 311 */ 1, 1, 1, 1, 1, 1, // \u11f3 ~ :
473
/* 312 */ 1 // \u11f9:
475
//================================================================
477
// 315 // The mapping from vowels to trailing consonant type
479
// 317 static final int[] tconMap = {
480
static const PRUint8 tconMap[] = {
481
/* 318 */ 0, 0, 2, 0, 2, 1, // (Fill), A, AE, YA, YAE, EO
482
/* 319 */ 2, 1, 2, 3, 0, 0, // E, YEO, YE, O, WA, WAE
483
/* 320 */ 0, 3, 3, 1, 1, 1, // OI, YO, U, WEO, WE, WI
484
/* 321 */ 3, 3, 0, 1, // YU, EU, UI, I
486
// 323 // ancient vowels (45)
487
/* 324 */ 3, 3, 3, 3, 3, 3, // \u1176 ~ : A-O, A-U, YA-O, YA-YO, EO-O, EO-U
488
/* 325 */ 3, 3, 3, 1, 0, 0, // \u117c ~ : EO-EU, YEO-O, YEO-U, O-EO, O-E, O-YE
489
/* 326 */ 3, 3, 3, 1, 0, 3, // \u1182 ~ : O-O, O-U, YO-YA, YO-YAE, YO-YEO, YO-O
490
/* 327 */ 0, 0, 0, 0, 0, 3, // \u1188 ~ : YO-I, U-A, U-AE, U-EO-EU, U-YE, U-U
491
/* 328 */ 0, 1, 1, 1, 1, 3, // \u118e ~ : YU-A, YU-EO, YU-E, YU-YEO, YU-YE, YU- U
492
/* 330 */ 1, 3, 3, 3, 2, 2, // \u1194 ~ : YU-I, EU-U, EU-EU, YI-U, I-A, I-YA
493
/* 331 */ 3, 3, 3, 1, 3, 0, // \u119a ~ : I-O, I-U, I-EU, I-ARAEA, ARAEA, ARAEA -EO
494
/* 333 */ 3, 2, 3 // \u11a0 ~ : ARAEA-U, ARAEA-I, SSANGARAEA
496
//================================================================
498
// 336 void composeHangul(byte[] output)
499
void nsUnicodeToX11Johab::composeHangul(char* output)
504
/* 340 */ if ( lconBase[l] != 0 )
505
/* 341 */ { // non-filler and supported by Hanterm Johab fonts
506
/* 342 */ ind = lconBase[l] + ( t > 0 ? lconMap2[v] : lconMap1[v] );
507
/* 343 */ output[byteOff++] = (byte) (ind / 256);
508
/* 344 */ output[byteOff++] = (byte) (ind % 256);
511
/* 347 */ if ( vowBase[v] != 0 )
512
/* 348 */ { // non-filler and supported by Hanterm Johab fonts
513
/* 349 */ ind = vowBase[v];
514
/* 350 */ if ( vowType[v] == 1)
515
/* 351 */ { //'o' and alikes
516
/* 352 */ // GIYEOK and KIEUK got special treatment
517
/* 353 */ ind += ( (l == 0 || l == 15) ? 0 : 1)
518
/* 354 */ + (t > 0 ? 2 : 0 );
522
/* 358 */ ind += tconType[t];
525
/* 361 */ output[byteOff++] = (byte) (ind / 256);
526
/* 362 */ output[byteOff++] = (byte) (ind % 256);
529
/* 365 */ if ( tconBase[t] != 0 )
530
/* 366 */ { // non-filler and supported by Hanterm Johab fonts
531
/* 367 */ ind = tconBase[t] + tconMap[v];
532
/* 368 */ output[byteOff++] = (byte) (ind / 256);
533
/* 369 */ output[byteOff++] = (byte) (ind % 256);
534
/* 370 */ } else if (vowBase[v] == 0)
535
/* 371 */ { // give one syllable display width since current display width is 0.
536
/* 372 */ output[byteOff++] = (byte) 0;
537
/* 373 */ output[byteOff++] = (byte) 0;
540
/* 376 */ state = START;
547
NS_IMETHODIMP nsUnicodeToX11Johab::FillInfo(PRUint32* aInfo)
550
PRUint32 b = 0xac00 >> 5;
551
PRUint32 e = 0xd7a3 >> 5;
552
aInfo[ e ] |= (0xFFFFFFFFL >> (31 - ((0xd7a3) & 0x1f)));
554
aInfo[b] |= 0xFFFFFFFFL;
559
for(i=0x1100;i<=0x1112;i++)
560
SET_REPRESENTABLE(aInfo, i);
562
for(i=0x1113;i<=0x1159;i++)
563
if(lconBase[i-0x1100]!=0)
564
SET_REPRESENTABLE(aInfo, i);
566
SET_REPRESENTABLE(aInfo, 0x115f);
568
for(i=0x1160;i<=0x1175;i++)
569
SET_REPRESENTABLE(aInfo, i);
571
for(i=0x1176;i<=0x11a2;i++)
572
if(vowBase[i-0x1160]!=0)
573
SET_REPRESENTABLE(aInfo, i);
575
for(i=0x11a8;i<=0x11c2;i++)
576
SET_REPRESENTABLE(aInfo, i);
578
for(i=0x11c3;i<=0x11f9;i++)
579
if(tconBase[i-0x11a7]!=0)
580
SET_REPRESENTABLE(aInfo, i);