mirror of
https://github.com/processing/processing4.git
synced 2026-02-12 01:50:44 +01:00
bug fix for text() getting smashed together
This commit is contained in:
@@ -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);
|
||||
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user