I think you want full controllcontrol of the text box, right?
Here is copiedsome code for you:
GlyphLayout layout = new GlyphLayout(); //dont do this every frame! Store it as member layout.setText("meow"); float width = layout.width;// contains the width of the current set text float height = layout.height; // contains the height of the current set text
Code it taken from:, https://stackoverflow.com/questions/16600547/how-get-a-string-width-in-libgdxsoured from another Q&A thread:
GlyphLayout layout = new GlyphLayout(); //dont do this every frame! Store it as member
layout.setText("meow");
float width = layout.width;// contains the width of the current set text
float height = layout.height; // contains the height of the current set text