Skip to content

Commit

Permalink
implement getTextBounds
Browse files Browse the repository at this point in the history
  • Loading branch information
grngxd committed Mar 12, 2024
1 parent 8b5c9d3 commit 35b416c
Show file tree
Hide file tree
Showing 3 changed files with 130 additions and 2 deletions.
124 changes: 124 additions & 0 deletions .idea/uiDesigner.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,10 @@ class TestRenderer : Renderer {
}

override fun getTextBounds(text: String, font: Font): Pair<Float, Float> {
TODO("Not yet implemented")
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))
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import com.neptuneclient.voidui.ui.Drawable
import com.neptuneclient.voidui.ui.ReactiveComponent
import com.neptuneclient.voidui.ui.elements.TestElement

class Label : ReactiveComponent() {
class Label(text: String) : ReactiveComponent() {

private var counter by state(0)

Expand Down

0 comments on commit 35b416c

Please sign in to comment.