Skip to content

Commit 98cc9a9

Browse files
committed
add extra test case for text layout (fixes processing#3487)
1 parent 3d7298a commit 98cc9a9

2 files changed

Lines changed: 6 additions & 0 deletions

File tree

core/src/processing/core/PGraphics.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4683,6 +4683,7 @@ public void text(String str, float x1, float y1, float x2, float y2) {
46834683
/**
46844684
* Emit a sentence of text, defined as a chunk of text without any newlines.
46854685
* @param stop non-inclusive, the end of the text in question
4686+
* @return false if cannot fit
46864687
*/
46874688
protected boolean textSentence(char[] buffer, int start, int stop,
46884689
float boxWidth, float spaceWidth) {
@@ -4696,6 +4697,10 @@ protected boolean textSentence(char[] buffer, int start, int stop,
46964697
while (index <= stop) {
46974698
// boundary of a word or end of this sentence
46984699
if ((buffer[index] == ' ') || (index == stop)) {
4700+
// System.out.println((index == stop) + " " + wordStart + " " + index);
4701+
if (wordStart == index) { // end of line, nothing is fitting
4702+
return false;
4703+
}
46994704
float wordWidth = textWidthImpl(buffer, wordStart, index);
47004705

47014706
if (runningX + wordWidth >= boxWidth) {

core/todo.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
X dataPath() not working when app is not run from app dir on Linux
33
X https://github.com/processing/processing/issues/2195
44

5+
56
earlier
67
X are we clear on sketchPath() for OS X?
78
X working dir (user.dir?) returns home dir, not app dir in Oracle Java

0 commit comments

Comments
 (0)