wrapping up fixes for #197, #198

This commit is contained in:
Ben Fry
2021-06-14 12:28:35 -04:00
parent 1522aead6d
commit 3ec2f283ef
2 changed files with 7 additions and 30 deletions
+4 -30
View File
@@ -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
+3
View File
@@ -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