mirror of
https://github.com/processing/processing4.git
synced 2026-02-26 00:35:41 +01:00
textAlign Right print correctly
This commit is contained in:
@@ -4549,13 +4549,12 @@ public class PGraphics extends PImage implements PConstants {
|
||||
if ((buffer[index] == ' ') || (index == stop)) {
|
||||
float wordWidth = textWidthImpl(buffer, wordStart, index);
|
||||
|
||||
if (runningX + wordWidth > boxWidth) {
|
||||
if (runningX + wordWidth >= boxWidth) {
|
||||
if (runningX != 0) {
|
||||
// Next word is too big, output the current line and advance
|
||||
index = wordStart;
|
||||
textSentenceBreak(lineStart, index);
|
||||
// Eat whitespace because multiple spaces don't count for s*
|
||||
// when they're at the end of a line.
|
||||
// Eat whitespace before the first word on the next line.
|
||||
while ((index < stop) && (buffer[index] == ' ')) {
|
||||
index++;
|
||||
}
|
||||
@@ -4588,8 +4587,8 @@ public class PGraphics extends PImage implements PConstants {
|
||||
index++;
|
||||
|
||||
} else { // this word will fit, just add it to the line
|
||||
runningX += wordWidth + spaceWidth;
|
||||
wordStart = index + 1; // move on to the next word
|
||||
runningX += wordWidth;
|
||||
wordStart = index ; // move on to the next word including the space before the word
|
||||
index++;
|
||||
}
|
||||
} else { // not a space or the last character
|
||||
|
||||
Reference in New Issue
Block a user