fix(renderer): adjust line height calculation in G2DDrawFont for improved text rendering

This commit is contained in:
extio-de
2026-01-01 18:45:36 +01:00
parent fa45c5d5e3
commit 04a1127110
2 changed files with 3 additions and 3 deletions

View File

@@ -15,7 +15,7 @@ languages:
test-2: "world"
test-3: "Welcome to Exo's Game Engine Demo!"
test-4: "Select Theme"
test-5: "This is a message\\n\\n123...\\n\\nHave a nice day!"
test-5: "This is a message\\n123...\\nHave a nice day!"
test-6: "OK"
test-7: "Toggle Audio"
test-8: "ScrollArea Demo"
@@ -26,7 +26,7 @@ languages:
test-2: "welt"
test-3: "Willkommen zu Exo's Spieleengine Demo!"
test-4: "Design auswählen"
test-5: "Dies ist eine Nachricht\\n\\n123...\\n\\nSchönen Tag noch!"
test-5: "Dies ist eine Nachricht\\n123...\\nSchönen Tag noch!"
test-6: "Ok"
test-7: "Audio umschalten"
test-8: "ScrollArea Demo"

View File

@@ -91,7 +91,7 @@ public class G2DDrawFont extends G2DAbstractRenderingBo implements DrawFontRende
graphics.setColor(this.color == null ? this.rendererData.getThemeManager().getCurrentTheme().getTextNormal().toColor() : this.color.toAwtColor());
final var lines = this.text.contains("\n") ? this.text.split("\n", -1) : new String[] { this.text };
final var lineHeight = getTextDimensions("M", graphics, this.size, 1.0).getY() + (int) (Math.max(FONT_SIZE_MIN, this.size) * 0.4 * scaleFactor);
final var lineHeight = getTextDimensions("M", graphics, this.size, 1.0).getY() + (int) (Math.max(FONT_SIZE_MIN, this.size) * 0.5);
final CoordI2[] lineDims = new CoordI2[lines.length];
int maxLineWidth = 0;
for (int i = 0; i < lines.length; i++) {