diff --git a/core/src/processing/core/PFont.java b/core/src/processing/core/PFont.java index 40d554e45..dcc7924a0 100644 --- a/core/src/processing/core/PFont.java +++ b/core/src/processing/core/PFont.java @@ -267,20 +267,16 @@ public class PFont implements PConstants { if (charset == null) { lazy = true; -// lazyFont = font; } else { - // charset needs to be sorted to make index lookup run more quickly + // The charset needs to be sorted to make index lookup run quickly // http://dev.processing.org/bugs/show_bug.cgi?id=494 - - // make copy of charset for sorting to not effect original array - // fix for bug: https://github.com/processing/processing4/issues/197 - char[] sortedCharset = Arrays.copyOf(charset, charset.length ); - + // First make copy of charset[] so the user's array is not modified + // https://github.com/processing/processing4/issues/197 + char[] sortedCharset = Arrays.copyOf(charset, charset.length); Arrays.sort(sortedCharset); glyphs = new Glyph[sortedCharset.length]; - glyphCount = 0; for (char c : sortedCharset) { if (font.canDisplay(c)) { @@ -297,28 +293,6 @@ public class PFont implements PConstants { if (glyphCount != sortedCharset.length) { glyphs = (Glyph[]) PApplet.subset(glyphs, 0, glyphCount); } - - // foreign font, so just make ascent the max topExtent - // for > 1.0.9, not doing this anymore. - // instead using getAscent() and getDescent() values for these cases. -// if ((ascent == 0) && (descent == 0)) { -// //for (int i = 0; i < charCount; i++) { -// for (Glyph glyph : glyphs) { -// char cc = (char) glyph.value; -// //char cc = (char) glyphs[i].value; -// if (Character.isWhitespace(cc) || -// (cc == '\u00A0') || (cc == '\u2007') || (cc == '\u202F')) { -// continue; -// } -// if (glyph.topExtent > ascent) { -// ascent = glyph.topExtent; -// } -// int d = -glyph.topExtent + glyph.height; -// if (d > descent) { -// descent = d; -// } -// } -// } } // If not already created, just create these two characters to calculate diff --git a/todo.txt b/todo.txt index 004355266..8a3077912 100755 --- a/todo.txt +++ b/todo.txt @@ -15,6 +15,9 @@ X increases export size, but impact is so worth it X Update JDK to 11.0.11+9 X modernize the RegisteredMethods code to use collections classes w/ concurrency X https://github.com/processing/processing4/pull/199 +X don't sort user's charset array when calling createFont() +X https://github.com/processing/processing4/issues/197 +X https://github.com/processing/processing4/pull/198 earlier