Skip to content

Commit e4df27d

Browse files
committed
fixed text orientation
1 parent d39ae3e commit e4df27d

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

core/src/processing/opengl/PGraphicsOpenGL.java

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3475,7 +3475,7 @@ public void text(char c, float x, float y) {
34753475
defaultFontOrDeath("text");
34763476
}
34773477

3478-
int sign = glCoordsEnabled ? +1 : -1;
3478+
int sign = glCoordsEnabled ? -1 : +1;
34793479

34803480
if (textAlignY == CENTER) {
34813481
y += sign * textAscent() / 2;
@@ -3498,7 +3498,7 @@ public void text(String str, float x, float y) {
34983498
defaultFontOrDeath("text");
34993499
}
35003500

3501-
int sign = glCoordsEnabled ? +1 : -1;
3501+
int sign = glCoordsEnabled ? -1 : +1;
35023502

35033503
int length = str.length();
35043504
if (length > textBuffer.length) {
@@ -3550,7 +3550,7 @@ public void text(String str, float x1, float y1, float x2, float y2) {
35503550
defaultFontOrDeath("text");
35513551
}
35523552

3553-
int sign = glCoordsEnabled ? +1 : -1;
3553+
int sign = glCoordsEnabled ? -1 : +1;
35543554

35553555
float hradius, vradius;
35563556
switch (rectMode) {
@@ -3627,21 +3627,23 @@ public void text(String str, float x1, float y1, float x2, float y2) {
36273627

36283628
if (textAlignY == CENTER) {
36293629
float lineHigh = textAscent() + textLeading * (lineCount - 1);
3630-
float y = glCoordsEnabled ? y1 + textAscent() + (boxHeight - lineHigh) / 2 : y2 - textAscent() - (boxHeight - lineHigh) / 2;
3630+
float y = glCoordsEnabled ? y2 - textAscent() - (boxHeight - lineHigh) / 2 :
3631+
y1 + textAscent() + (boxHeight - lineHigh) / 2;
36313632
for (int i = 0; i < lineCount; i++) {
36323633
textLineAlignImpl(textBuffer, textBreakStart[i], textBreakStop[i], lineX, y);
36333634
y += sign * textLeading;
36343635
}
36353636

36363637
} else if (textAlignY == BOTTOM) {
3637-
float y = glCoordsEnabled ? y2 - textDescent() - textLeading * (lineCount - 1) : y1 + textDescent() + textLeading * (lineCount - 1);
3638+
float y = glCoordsEnabled ? y1 + textDescent() + textLeading * (lineCount - 1) :
3639+
y2 - textDescent() - textLeading * (lineCount - 1);
36383640
for (int i = 0; i < lineCount; i++) {
36393641
textLineAlignImpl(textBuffer, textBreakStart[i], textBreakStop[i], lineX, y);
36403642
y += sign * textLeading;
36413643
}
36423644

36433645
} else { // TOP or BASELINE just go to the default
3644-
float y = glCoordsEnabled ? y1 + textAscent() : y2 - textAscent();
3646+
float y = glCoordsEnabled ? y2 - textAscent() : y1 + textAscent();
36453647
for (int i = 0; i < lineCount; i++) {
36463648
textLineAlignImpl(textBuffer, textBreakStart[i], textBreakStop[i], lineX, y);
36473649
y += sign * textLeading;

0 commit comments

Comments
 (0)