mirror of
https://gitlab.bixilon.de/bixilon/minosoft.git
synced 2025-09-13 01:16:46 -04:00
fix default ascent
This commit is contained in:
parent
4eb33f282f
commit
5eecbe89b7
@ -74,8 +74,8 @@ class RasterizedCodePointRendererTest {
|
||||
fun `12px height`() {
|
||||
val consumer = object : DummyGUIVertexConsumer() {
|
||||
override fun addChar(start: Vec2, end: Vec2, index: Int) {
|
||||
assertEquals(start, Vec2(10.0f, 11.0f)) // -2 for ascent height difference, +1 for normal spacing
|
||||
assertEquals(end, Vec2(15.0f, 23.0f))
|
||||
assertEquals(start, Vec2(10.0f, 12.0f)) // -2 for ascent height difference, +1 for normal spacing, +1 for ascent fixing?
|
||||
assertEquals(end, Vec2(15.0f, 24.0f))
|
||||
}
|
||||
}
|
||||
val char = DummyCodePointRenderer(ascent = 10.0f, height = 12.0f)
|
||||
|
@ -65,7 +65,7 @@ class BitmapFontTypeTest {
|
||||
return texture
|
||||
}
|
||||
|
||||
private fun load(start: IntArray, end: IntArray, width: Int = 8, height: Int = 8, ascent: Int = 8, chars: Array<IntArray>): BitmapFontType {
|
||||
private fun load(start: IntArray, end: IntArray, width: Int = 8, height: Int = 8, ascent: Int = 7, chars: Array<IntArray>): BitmapFontType {
|
||||
val texture = createTexture(start, end, width, height, chars.size)
|
||||
|
||||
val fontType = LOAD(BitmapFontType, texture, height, ascent, chars.map { IntStream.of(*it) }.toTypedArray()) as BitmapFontType
|
||||
|
@ -21,7 +21,7 @@ class DummyCodePointRenderer(
|
||||
override val uvStart: Vec2 = Vec2(0.1f, 0.2f),
|
||||
override val uvEnd: Vec2 = Vec2(0.6f, 0.7f),
|
||||
override val width: Float = 5.0f,
|
||||
override val ascent: Float = 8.0f,
|
||||
override val ascent: Float = 7.0f,
|
||||
override val height: Float = 8.0f,
|
||||
) : AscentedCodePointRenderer {
|
||||
override val texture = DummyTexture()
|
||||
|
@ -65,7 +65,7 @@ class BitmapFontType(
|
||||
override fun build(context: RenderContext, manager: FontManager, data: JsonObject): BitmapFontType? {
|
||||
val file = data["file"]?.toString()?.let { it.toResourceLocation().texture() } ?: throw IllegalArgumentException("Missing file!")
|
||||
val height = data["height"]?.toInt() ?: 8
|
||||
val ascent = data["ascent"]?.toInt() ?: 8
|
||||
val ascent = data["ascent"]?.toInt() ?: 7
|
||||
val chars = data["chars"]?.listCast<String>() ?: throw IllegalArgumentException("Missing chars!")
|
||||
return load(file, height, ascent, chars, context)
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user