diff --git a/core/PFont.java b/core/PFont.java index 8bf43f5b5..af8fea6a2 100644 --- a/core/PFont.java +++ b/core/PFont.java @@ -631,7 +631,7 @@ public class PFont implements PConstants { for (int index = start; index < stop; index++) { textImpl(textBuffer[index], x, y, z, parent); - x += width(textBuffer[index]); + x += parent.textSize * width(textBuffer[index]); } } @@ -688,7 +688,8 @@ public class PFont implements PConstants { if ((textBuffer[index] == ' ') || (index == length-1)) { // boundary of a word - float wordWidth = calcWidth(textBuffer, wordStart, index); + float wordWidth = parent.textSize * + calcWidth(textBuffer, wordStart, index); if (runningX + wordWidth > boxX2) { if (runningX == boxX1) { // if this is the first word, and its width is @@ -701,7 +702,8 @@ public class PFont implements PConstants { // not a single char will fit on this line. screw 'em. return; } - wordWidth = calcWidth(textBuffer, wordStart, index); + wordWidth = parent.textSize * + calcWidth(textBuffer, wordStart, index); } while (wordWidth > boxWidth); textLine(lineStart, index, lineX, currentY, boxZ, parent); diff --git a/core/PGraphics.java b/core/PGraphics.java index 02a4bede5..c6ffef713 100644 --- a/core/PGraphics.java +++ b/core/PGraphics.java @@ -1436,7 +1436,7 @@ public class PGraphics extends PImage implements PConstants { public void textSize(float size) { if (textFont != null) { textSize = size; - resetLeading(); + textLeadingReset(); } else { throw new RuntimeException("use textFont() before textSize()"); @@ -1444,8 +1444,9 @@ public class PGraphics extends PImage implements PConstants { } - protected void resetLeading() { - textLeading = (textFont.ascent() + textFont.descent()) * 1.275f; + protected void textLeadingReset() { + textLeading = textSize * + ((textFont.ascent() + textFont.descent()) * 1.275f); } diff --git a/core/todo.txt b/core/todo.txt index 300af915b..bae5d475b 100644 --- a/core/todo.txt +++ b/core/todo.txt @@ -1,4 +1,29 @@ 0078 core +X text lines were getting horizontally mashed together +X text lines also getting vertically smashed together +X make a note of the change to font.width() + +_ get SCREEN_SPACE text working again + +_ backwards rects may not be getting drawn in PGraphics2 + +_ updatePixels() not setting PApplet.pixels +_ also throwing NPEs +_ make loadPixels in PGraphics ignored, and put it in PApplet + +_ closing window w/o first hitting stop() causes freak out +_ opengl gives an OutOfMemoryError +_ java2d just goes into a lock +_ could also be code that's in an infinite loop (i.e. text error) +_ which then causes a full lock + +_ why is java2d so flickery? +_ is it because the lock was taken off (g) in PApplet? + +_ stop() not working very well +_ doesn't seem to actually be stopping things + +_ sphere() and box() should set normals and take textures - applets on osx sometimes show up 20 pixels off the top