fix(renderer): adjust line height calculation in G2DDrawFont for improved text rendering
This commit is contained in:
@@ -15,7 +15,7 @@ languages:
|
|||||||
test-2: "world"
|
test-2: "world"
|
||||||
test-3: "Welcome to Exo's Game Engine Demo!"
|
test-3: "Welcome to Exo's Game Engine Demo!"
|
||||||
test-4: "Select Theme"
|
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-6: "OK"
|
||||||
test-7: "Toggle Audio"
|
test-7: "Toggle Audio"
|
||||||
test-8: "ScrollArea Demo"
|
test-8: "ScrollArea Demo"
|
||||||
@@ -26,7 +26,7 @@ languages:
|
|||||||
test-2: "welt"
|
test-2: "welt"
|
||||||
test-3: "Willkommen zu Exo's Spieleengine Demo!"
|
test-3: "Willkommen zu Exo's Spieleengine Demo!"
|
||||||
test-4: "Design auswählen"
|
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-6: "Ok"
|
||||||
test-7: "Audio umschalten"
|
test-7: "Audio umschalten"
|
||||||
test-8: "ScrollArea Demo"
|
test-8: "ScrollArea Demo"
|
||||||
|
|||||||
@@ -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());
|
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 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];
|
final CoordI2[] lineDims = new CoordI2[lines.length];
|
||||||
int maxLineWidth = 0;
|
int maxLineWidth = 0;
|
||||||
for (int i = 0; i < lines.length; i++) {
|
for (int i = 0; i < lines.length; i++) {
|
||||||
|
|||||||
Reference in New Issue
Block a user