making use of the long-neglected scale variable

This commit is contained in:
minjaesong
2021-11-28 12:42:34 +09:00
parent 14ea4d8d84
commit ce31a5a6ef
2 changed files with 17 additions and 32 deletions

View File

@@ -306,12 +306,11 @@ class TerrarumSansBitmap(
glyphProps[0] = GlyphProps(0) glyphProps[0] = GlyphProps(0)
} }
override fun getLineHeight(): Float = H.toFloat() override fun getLineHeight(): Float = H.toFloat() * scale
override fun getXHeight() = 8f * scale
override fun getXHeight() = 8f override fun getCapHeight() = 12f * scale
override fun getCapHeight() = 12f override fun getAscent() = 3f * scale
override fun getAscent() = 3f override fun getDescent() = 3f * scale
override fun getDescent() = 3f
override fun isFlipped() = flipY override fun isFlipped() = flipY
override fun setFixedWidthGlyphs(glyphs: CharSequence) { override fun setFixedWidthGlyphs(glyphs: CharSequence) {
@@ -495,19 +494,12 @@ class TerrarumSansBitmap(
tempLinotype = cacheObj.glyphLayout!!.linotype tempLinotype = cacheObj.glyphLayout!!.linotype
} }
batch.draw(tempLinotype,
if (!flipY) { x.toFloat(),
batch.draw(tempLinotype, x.toFloat(), (y - pixmapOffsetY).toFloat()) (y - pixmapOffsetY).toFloat() + (if (flipY) (tempLinotype.height) else 0) * scale,
} tempLinotype.width.toFloat() * scale,
else { (tempLinotype.height.toFloat()) * (if (flipY) -1 else 1) * scale
batch.draw(tempLinotype, )
x.toFloat(),
(y - pixmapOffsetY + (tempLinotype.height)).toFloat(),
(tempLinotype.width.toFloat()),
-(tempLinotype.height.toFloat())
)
}
} }
return null return null

View File

@@ -384,19 +384,12 @@ class TerrarumTypewriterBitmap(
tempLinotype = cacheObj.glyphLayout!!.linotype tempLinotype = cacheObj.glyphLayout!!.linotype
} }
batch.draw(tempLinotype,
if (!flipY) { (x - linotypePad).toFloat(),
batch.draw(tempLinotype, (x - linotypePad).toFloat(), (y - pixmapOffsetY).toFloat()) (y - pixmapOffsetY).toFloat() + (if (flipY) (tempLinotype.height) else 0),
} (tempLinotype.width.toFloat()),
else { (tempLinotype.height.toFloat()) * (if (flipY) -1 else 1)
batch.draw(tempLinotype, )
(x - linotypePad).toFloat(),
(y - pixmapOffsetY + (tempLinotype.height)).toFloat(),
(tempLinotype.width.toFloat()),
-(tempLinotype.height.toFloat())
)
}
} }
return null return null