Merge pull request #3746 from JakubValtar/text-fix

Render text starting with space properly
This commit is contained in:
Ben Fry
2015-08-31 08:19:40 -04:00
+4 -3
View File
@@ -4708,10 +4708,11 @@ public class PGraphics extends PImage implements PConstants {
// boundary of a word or end of this sentence
if ((buffer[index] == ' ') || (index == stop)) {
// System.out.println((index == stop) + " " + wordStart + " " + index);
if (start != stop && wordStart == index) { // end of line, nothing is fitting
return false;
float wordWidth = 0;
if (index > wordStart) {
// we have a non-empty word, measure it
wordWidth = textWidthImpl(buffer, wordStart, index);
}
float wordWidth = textWidthImpl(buffer, wordStart, index);
if (runningX + wordWidth >= boxWidth) {
if (runningX != 0) {