From 769938a3e3126de209dfd06d466d56923bf7b1d5 Mon Sep 17 00:00:00 2001 From: benfry Date: Sat, 13 Feb 2010 14:32:04 +0000 Subject: [PATCH] a little more efficient --- core/src/processing/core/PFont.java | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/core/src/processing/core/PFont.java b/core/src/processing/core/PFont.java index ddda5e0bb..616cb264e 100644 --- a/core/src/processing/core/PFont.java +++ b/core/src/processing/core/PFont.java @@ -629,26 +629,27 @@ public class PFont implements PConstants { } else { for (int i = 0; i < charCount; i++) { // System.out.println(i + " of " + charCount + " is " + (char)glyphs[i].value); - int value = glyphs[i].value; - if (value > glyph.value) { + //int value = glyphs[i].value; + //if (glyphs[i].value > glyph.value) { + if (glyphs[i].value > c) { for (int j = charCount; j > i; --j) { // System.out.println(" moving " + (char)glyphs[j-1].value); // + // //" to " + (char)glyphs[j].value); glyphs[j] = glyphs[j-1]; -// if (value < 128) { -// ascii[value] = j; -// } + if (glyphs[j].value < 128) { + ascii[glyphs[j].value] = j; + } } //System.out.println("setting " + i + " to " + (char)glyph.value); glyphs[i] = glyph; // cache locations of the ascii charset - //if (c < 128) ascii[c] = i; - for (int k = 0; k < charCount+1; k++) { // charCount not incremented yet - if (glyphs[k].value < 128) { -// System.out.println("ascii[" + (char) glyphs[k].value + "] to " + k); - ascii[glyphs[k].value] = k; // re-set the ascii values - } - } + if (c < 128) ascii[c] = i; +// for (int k = 0; k < charCount+1; k++) { // charCount not incremented yet +// if (glyphs[k].value < 128) { +//// System.out.println("ascii[" + (char) glyphs[k].value + "] to " + k); +// ascii[glyphs[k].value] = k; // re-set the ascii values +// } +// } // charCount++; // return; break;