java - Libgdx font height -


does know formula calculate height of bitmap font specific size? know when draw string on screen i'm creating rectangle , want know height of rectangle.

if you're using libgdx version >= 1.5.6 can height of font glyphlayout.

bitmap font = new bitmapfont(); glyphlayout layout = new glyphlayout();  layout.settext(font, "meow"); float height = layout.height;  //height of "meow" 

but if still you're using libgdx api < 1.5.6, can height this

float height = font.getbounds("meow").height; 

Comments