better text scaling support

This commit is contained in:
minjaesong
2024-04-28 22:25:00 +09:00
parent 2196a4b2e7
commit 87492c1f0b
2 changed files with 4 additions and 4 deletions

View File

@@ -20,7 +20,7 @@ import kotlin.math.*
class MovableType( class MovableType(
val font: TerrarumSansBitmap, val font: TerrarumSansBitmap,
val inputText: CodepointSequence, val inputText: CodepointSequence,
val paperWidth: Int, paperWidth: Int,
internal val isNull: Boolean = false internal val isNull: Boolean = false
): Disposable { ): Disposable {
@@ -285,7 +285,7 @@ class MovableType(
font.drawNormalised(batch, font.drawNormalised(batch,
it.block.text, it.block.text,
x + it.posX, x + it.posX,
y + lineNum * lineHeight y + lineNum * lineHeight * font.scale
) )
if (it.colour != null) if (it.colour != null)

View File

@@ -766,10 +766,10 @@ class TerrarumSansBitmap(
val cacheObj = getCache(s.getHash()) val cacheObj = getCache(s.getHash())
if (cacheObj != null) { if (cacheObj != null) {
return cacheObj.glyphLayout!!.width return cacheObj.glyphLayout!!.width * scale
} }
else { else {
return buildPosMap(s).width return buildPosMap(s).width * scale
} }
} }