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,21 +494,14 @@ class TerrarumSansBitmap(
tempLinotype = cacheObj.glyphLayout!!.linotype tempLinotype = cacheObj.glyphLayout!!.linotype
} }
if (!flipY) {
batch.draw(tempLinotype, x.toFloat(), (y - pixmapOffsetY).toFloat())
}
else {
batch.draw(tempLinotype, batch.draw(tempLinotype,
x.toFloat(), x.toFloat(),
(y - pixmapOffsetY + (tempLinotype.height)).toFloat(), (y - pixmapOffsetY).toFloat() + (if (flipY) (tempLinotype.height) else 0) * scale,
(tempLinotype.width.toFloat()), tempLinotype.width.toFloat() * scale,
-(tempLinotype.height.toFloat()) (tempLinotype.height.toFloat()) * (if (flipY) -1 else 1) * scale
) )
} }
}
return null return null
} }

View File

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