AbstractFont.java
4.15 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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
/*
* Decompiled with CFR 0_118.
*/
package com.day.image.font;
import com.day.image.Layer;
import java.awt.*;
import java.awt.geom.Rectangle2D;
import java.text.CharacterIterator;
public abstract class AbstractFont {
public static final int PLAIN = 0;
public static final int BOLD = 1;
public static final int ITALIC = 2;
public static final int UNDERLINE = 4;
public static final int STRIKEOUT = 8;
public static final int TTFONTERSCALE = 256;
public static final int TTFONTERLINESPACING = 512;
public static final int ALIGN_VBASE = 15;
public static final int ALIGN_TOP = 0;
public static final int ALIGN_BASE = 1;
public static final int ALIGN_BOTTOM = 2;
public static final int ALIGN_HBASE = 240;
public static final int ALIGN_LEFT = 0;
public static final int ALIGN_CENTER = 16;
public static final int ALIGN_RIGHT = 32;
public static final int ALIGN_FULL = 64;
public static final int ROTBASE = 3840;
public static final int ROTODD = 768;
public static final int ROT90 = 256;
public static final int ROT270 = 512;
public static final int ROT180 = 1024;
public static final int DRAWBASE = 61440;
public static final int DRAW_UNDERLINE = 4096;
public static final int DRAW_STRIKEOUT = 8192;
public static final int DRAW_OUTLINE = 16384;
public static final int TTBASE = 983040;
public static final int TTANTIALIASED = 65536;
public static final int TTHINTED = 131072;
public static final int TTOVERSAMPLING = 262144;
@Deprecated
public static final int TTUNHINTED = 524288;
public static String createFontFileName(String faceName, int size, int style) {
StringBuffer buf = new StringBuffer();
for (int i = 0; i < faceName.length(); ++i) {
char c = faceName.charAt(i);
if (Character.isLetterOrDigit(c)) {
buf.append(Character.toLowerCase(c));
continue;
}
buf.append('_');
}
buf.append(size);
buf.append(AbstractFont.styleToString(style));
return buf.toString();
}
public static String styleToDescription(int style) {
if (style == 0) {
return "Plain";
}
StringBuilder buf = new StringBuilder();
if ((style & 1) != 0) {
buf.append("Bold ");
}
if ((style & 2) != 0) {
buf.append("Italic ");
}
if ((style & 4) != 0) {
buf.append("Underline ");
}
if ((style & 8) != 0) {
buf.append("Strikeout ");
}
return buf.toString().trim();
}
public static String styleToString(int style) {
char[] st = new char[4];
int i = 0;
if ((style & 1) != 0) {
st[i++] = 98;
}
if ((style & 2) != 0) {
st[i++] = 105;
}
if ((style & 4) != 0) {
st[i++] = 117;
}
if ((style & 8) != 0) {
st[i++] = 115;
}
return String.valueOf(st, 0, i);
}
public static int stringToStyle(String style) {
int type = 0;
if (style.indexOf(98) >= 0) {
type |= true;
}
if (style.indexOf(105) >= 0) {
type |= 2;
}
if (style.indexOf(117) >= 0) {
type |= 4;
}
if (style.indexOf(115) >= 0) {
type |= 8;
}
return type;
}
public abstract Rectangle2D getTextExtent(int var1, int var2, int var3, int var4, String var5, int var6, double var7, int var9);
public abstract int drawText(Layer var1, int var2, int var3, int var4, int var5, String var6, Paint var7, Stroke var8, int var9, double var10, int var12);
public abstract double getHeight();
public abstract double getAscent();
public abstract double getDescent();
public abstract boolean canDisplay(char var1);
public abstract int canDisplayUpTo(CharacterIterator var1, int var2, int var3);
public abstract int canDisplayUpTo(String var1);
public abstract int canDisplayUpTo(char[] var1, int var2, int var3);
public abstract String toString();
public abstract Font getAwtFont();
}