getStringWidth

fun getStringWidth(text: Component, scale: Float = scaleToVanillaFont, shadow: Boolean = false): Float

Width of text in GUI pixels at scale, the default being vanilla's size.


abstract fun getStringWidth(text: FormattedCharSequence, shadow: Boolean = false): Float

Approximates the width of a text. Accurate except for obfuscated (§k) formatting