getWidth

fun getWidth(context: MeasureContext, text: CharSequence? = null, width: Int = DEF_LAYOUT_SIZE, height: Int = DEF_LAYOUT_SIZE, rotationDegrees: Float = 0.0f, pad: Boolean = text == null): Float

Returns the width of this TextComponent for the given text and the available width and height. pad defines whether to extend text by such a number of blank lines that it has lineCount lines.