diff --git a/src/test/kotlin/com/neptuneclient/voidui/tests/TestRenderer.kt b/src/test/kotlin/com/neptuneclient/voidui/tests/TestRenderer.kt index f156a6a..9527743 100644 --- a/src/test/kotlin/com/neptuneclient/voidui/tests/TestRenderer.kt +++ b/src/test/kotlin/com/neptuneclient/voidui/tests/TestRenderer.kt @@ -163,9 +163,10 @@ class TestRenderer : Renderer { override fun getTextBounds(text: String, font: Font): Pair { val buffer: FloatBuffer = BufferUtils.createFloatBuffer(4) + NanoVG.nvgFontSize(vg, font.size.toFloat()) NanoVG.nvgFontFace(vg, font.identifier) NanoVG.nvgTextBounds(vg, 0f, 0f, text, buffer) - return Pair(buffer.get(2), buffer.get(3)) + return Pair(buffer[2] - buffer[0], buffer[3] - buffer[1]) } } \ No newline at end of file diff --git a/src/test/kotlin/com/neptuneclient/voidui/tests/TestScreen.kt b/src/test/kotlin/com/neptuneclient/voidui/tests/TestScreen.kt index cce27fa..2938738 100644 --- a/src/test/kotlin/com/neptuneclient/voidui/tests/TestScreen.kt +++ b/src/test/kotlin/com/neptuneclient/voidui/tests/TestScreen.kt @@ -5,17 +5,19 @@ import com.neptuneclient.voidui.ui.Drawable import com.neptuneclient.voidui.ui.Screen import com.neptuneclient.voidui.ui.elements.Text import com.neptuneclient.voidui.utils.Font +import java.awt.Color import java.nio.file.Path class TestScreen(void: VoidUI) : Screen(void) { // temp - private val font = Font(void, "screen", Path.of("fonts/WorkSans-Regular.ttf"), 16) + private val font = Font(void, "screen", Path.of("fonts/WorkSans-Regular.ttf"), 40) override fun build(): Drawable { return Text( text = "Deutschland über alle", font = font, + backgroundColor = Color.RED, x = 50.vw, y = 50.vh