Fix font "symbols" not showing (#10266)

This commit is contained in:
SomeTroglodyte 2023-10-08 20:38:23 +02:00 committed by GitHub
parent 6dc7f0ec4c
commit 6d4603431b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -298,7 +298,8 @@ object Fonts {
val boxHeight = ceil(metrics.height).toInt() val boxHeight = ceil(metrics.height).toInt()
val boxWidth = ceil(metrics.ascent * textureRegion.regionWidth / textureRegion.regionHeight).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 // 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 // place region from top of bounding box down
// Adding half the descent is empiric - should theoretically be leading only // Adding half the descent is empiric - should theoretically be leading only
val drawY = ceil(metrics.leading + metrics.descent * 0.5f).toInt() val drawY = ceil(metrics.leading + metrics.descent * 0.5f).toInt()