Code:
void putcharH(int c, int x, int y)
{
y *= width;
for (int i = 0; i < charWidth[c] * charHeight; i++) {
int xpos = x + i % charWidth[c];
int pos = xpos + y + (i / charWidth[c]) * width;
if (chars[c][i] == 0xff000000 && xpos < clipX2 && pos >= clipOffset1 && pos < clipOffset2) {
target.pixels[pos] = col;
}
}
}
public void writeH (String text, int x, int y, int wrap) {
target.loadPixels();
int indent = 0;
for (int i = 0; i < text.length(); i++) {
int c = (int)text.charAt(i);
if (c < 32 || (wrap > 0 && indent > wrap)) {
indent = 0;
y += lineHeight;
}
if (c > 31) {
putcharH(c - 32, x + indent, y);
indent += charWidth[c - 32];
}
}
target.updatePixels();
}
public void writeH (String text, int x, int y) {
writeH (text, x, y, clipX2 - x);
}
void putcharV (int c, int x, int y) {
int[] cData = chars[c];
int xpos = x;
int i = 0;
y *= width;
for (int xx = 0; xx < charHeight; xx++) {
for (int yy = 0; yy < charWidth[c]; yy++) {
int pos = y + xpos - yy * width;
if (cData[i] == 0xff000000 && xpos < clipX2 && pos > clipOffset1 && pos < clipOffset2) {
target.pixels[pos] = col;
}
i++;
}
xpos++;
}
}
public void writeV (String text, int x, int y, int wrap) {
target.loadPixels();
int indent = 0;
for (int i = 0; i < text.length(); i++) {
int c = (int)text.charAt(i);
if (c < 32 || (wrap > 0 && indent > wrap)) {
indent = 0;
x += lineHeight;
}
if (c > 31) {
putcharV(c - 32, x, y - indent);
indent += charWidth[c - 32];
}
}
target.updatePixels();
}
public void writeV (String text, int x, int y) {
writeV(text, x, y, -1);
}
public int getPixelWidth (String s) {
int len = 0;
int sl = s.length();
for (int i = 0; i < sl; i++) {
int c = (int)s.charAt(i);
if (c >= 32)
len += charWidth[c - 32];
}
return len;
}
public String getSubstringForWidth(String s, int w, boolean wordWrap) {
int i, len = 0, lastWS = 0, sl = s.length();
for (i = 0;(i < sl && len < w); i++) {
int c = (int)s.charAt(i);
if (c >= 32) {
len += charWidth[c - 32];
if (c <= 32)
lastWS = i;
}
}
if (wordWrap) {
return s.substring(0, (lastWS > 0 && len >= w) ? lastWS : i);
}
else {
return s.substring(0, i);
}
}
private int clamp(int a, int b, int c) {
return (a < b ? b : (a > c ? c : a));
}
}
i think the latest (original) code is here:
http://processing.org/discourse/yabb/YaBB.cgi?board=Programs;action=display;num=1094833496;start=13
F