@@ -267,20 +267,16 @@ public PFont(Font font, boolean smooth, char[] charset) {
267
267
268
268
if (charset == null ) {
269
269
lazy = true ;
270
- // lazyFont = font;
271
270
272
271
} else {
273
- // charset needs to be sorted to make index lookup run more quickly
272
+ // The charset needs to be sorted to make index lookup run quickly
274
273
// http://dev.processing.org/bugs/show_bug.cgi?id=494
275
-
276
- // make copy of charset for sorting to not effect original array
277
- // fix for bug: https://github.com/processing/processing4/issues/197
278
- char [] sortedCharset = Arrays .copyOf (charset , charset .length );
279
-
274
+ // First make copy of charset[] so the user's array is not modified
275
+ // https://github.com/processing/processing4/issues/197
276
+ char [] sortedCharset = Arrays .copyOf (charset , charset .length );
280
277
Arrays .sort (sortedCharset );
281
278
282
279
glyphs = new Glyph [sortedCharset .length ];
283
-
284
280
glyphCount = 0 ;
285
281
for (char c : sortedCharset ) {
286
282
if (font .canDisplay (c )) {
@@ -297,28 +293,6 @@ public PFont(Font font, boolean smooth, char[] charset) {
297
293
if (glyphCount != sortedCharset .length ) {
298
294
glyphs = (Glyph []) PApplet .subset (glyphs , 0 , glyphCount );
299
295
}
300
-
301
- // foreign font, so just make ascent the max topExtent
302
- // for > 1.0.9, not doing this anymore.
303
- // instead using getAscent() and getDescent() values for these cases.
304
- // if ((ascent == 0) && (descent == 0)) {
305
- // //for (int i = 0; i < charCount; i++) {
306
- // for (Glyph glyph : glyphs) {
307
- // char cc = (char) glyph.value;
308
- // //char cc = (char) glyphs[i].value;
309
- // if (Character.isWhitespace(cc) ||
310
- // (cc == '\u00A0') || (cc == '\u2007') || (cc == '\u202F')) {
311
- // continue;
312
- // }
313
- // if (glyph.topExtent > ascent) {
314
- // ascent = glyph.topExtent;
315
- // }
316
- // int d = -glyph.topExtent + glyph.height;
317
- // if (d > descent) {
318
- // descent = d;
319
- // }
320
- // }
321
- // }
322
296
}
323
297
324
298
// If not already created, just create these two characters to calculate
0 commit comments