HangulFormatter.java
1.52 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
/*
* Decompiled with CFR 0_118.
*/
package com.adobe.fontengine.inlineformatting.infontformatting;
import com.adobe.fontengine.inlineformatting.AttributedRun;
import com.adobe.fontengine.inlineformatting.infontformatting.GenericFormatter;
public final class HangulFormatter
extends GenericFormatter {
private boolean isL(int ch) {
return 4352 <= ch && ch < 4371;
}
private boolean isV(int ch) {
return 4449 <= ch && ch < 4470;
}
private boolean isT(int ch) {
return 4519 <= ch && ch < 4547;
}
private boolean isLV(int ch) {
return 44032 <= ch && ch < 55204 && (ch - 44032) % 28 == 0;
}
public int firstPass(AttributedRun run, int start, int limit) {
int current = start;
int pendingChar = run.elementAt(current);
++current;
while (current < limit) {
int currentChar = run.elementAt(current);
if (this.isL(pendingChar) && this.isV(currentChar)) {
pendingChar = 44032 + ((pendingChar - 4352) * 21 + (currentChar - 4449)) * 28;
run.replace(current - 1, current + 1, pendingChar);
--limit;
continue;
}
if (this.isLV(pendingChar) && this.isT(currentChar)) {
run.replace(current - 1, current + 1, pendingChar += currentChar - 4519);
--limit;
continue;
}
pendingChar = currentChar;
++current;
}
return super.firstPass(run, start, limit);
}
}