@@ -91,18 +91,15 @@ public Glyph(int code, int width, Integer unicode, int[] bbox) {
91
91
}
92
92
93
93
public Glyph (int width , Integer unicode ) {
94
- this (-1 , width , unicode , unicode != null ? TextUtil . convertFromUtf32 (unicode ) : null , false );
94
+ this (-1 , width , unicode , getChars (unicode ), false );
95
95
}
96
96
97
97
public Glyph (int code , int width , Integer unicode , char [] chars , boolean IsMark ) {
98
98
this .code = code ;
99
99
this .width = width ;
100
100
this .unicode = unicode ;
101
101
this .isMark = IsMark ;
102
- this .chars = chars ;
103
- if (chars == null && unicode != null && Character .isValidCodePoint (unicode )) {
104
- this .chars = TextUtil .convertFromUtf32 (unicode );
105
- }
102
+ this .chars = chars != null ? chars : getChars (unicode );
106
103
}
107
104
108
105
public Glyph (Glyph glyph ) {
@@ -129,11 +126,7 @@ public Glyph(Glyph glyph, int xPlacement, int yPlacement, int xAdvance, int yAdv
129
126
}
130
127
131
128
public Glyph (Glyph glyph , Integer unicode ) {
132
- this .code = glyph .code ;
133
- this .width = glyph .width ;
134
- this .isMark = glyph .isMark ;
135
- this .chars = unicode != null ? TextUtil .convertFromUtf32 (unicode ) : null ;
136
- this .unicode = unicode ;
129
+ this (glyph .code , glyph .width , unicode , getChars (unicode ), glyph .isMark ());
137
130
}
138
131
139
132
public int getCode () {
@@ -154,7 +147,7 @@ public Integer getUnicode() {
154
147
155
148
public void setUnicode (Integer unicode ) {
156
149
this .unicode = unicode ;
157
- this .chars = unicode != null ? TextUtil . convertFromUtf32 (unicode ) : null ;
150
+ this .chars = getChars (unicode );
158
151
}
159
152
160
153
public char [] getChars () {
@@ -259,4 +252,8 @@ private static Integer codePoint(char[] a) {
259
252
}
260
253
return null ;
261
254
}
255
+
256
+ private static char [] getChars (Integer unicode ) {
257
+ return unicode != null ? TextUtil .convertFromUtf32 (unicode ) : null ;
258
+ }
262
259
}
0 commit comments