From 6d4603431bb2190d4df1ac6f156818d7670f6d8e Mon Sep 17 00:00:00 2001 From: SomeTroglodyte <63000004+SomeTroglodyte@users.noreply.github.com> Date: Sun, 8 Oct 2023 20:38:23 +0200 Subject: [PATCH] Fix font "symbols" not showing (#10266) --- core/src/com/unciv/ui/components/Fonts.kt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/core/src/com/unciv/ui/components/Fonts.kt b/core/src/com/unciv/ui/components/Fonts.kt index 5acc7fdde4..e4081565cd 100644 --- a/core/src/com/unciv/ui/components/Fonts.kt +++ b/core/src/com/unciv/ui/components/Fonts.kt @@ -298,7 +298,8 @@ object Fonts { val boxHeight = ceil(metrics.height).toInt() val boxWidth = ceil(metrics.ascent * textureRegion.regionWidth / textureRegion.regionHeight).toInt() // In case the region's aspect isn't 1:1, scale the rounded-up width back to a height with unrounded aspect ratio - val drawHeight = textureRegion.regionHeight * (boxWidth / textureRegion.regionWidth) + // (using integer math only, do the equivalent of float math rounded to closest integer) + val drawHeight = (2 * textureRegion.regionHeight * boxWidth + 1) / textureRegion.regionWidth / 2 // place region from top of bounding box down // Adding half the descent is empiric - should theoretically be leading only val drawY = ceil(metrics.leading + metrics.descent * 0.5f).toInt()