java - Calculate a fitting text size -


i want calculate size font needs, text displayed in 1 line without clipping.

example

|-100px---here's text---100px-|

i have dpi , there stuff. testing isn't way, using libgdx , text ist display button (scene2d ui).

call bitmapfont.getbounds(). textbounds returns tell need. can try medium font, go or down based on how big or small bounds are. use method scale ui sizes old droid 1s new hd displays.

http://libgdx.badlogicgames.com/nightlies/docs/api/com/badlogic/gdx/graphics/g2d/bitmapfont.html


Comments

Popular posts from this blog

mongodb - Struggling to get ordered results from the last retrieved article, given array of elements to search in -

c# - Pausing a storyboard on TabItem mouse over -

c# - Attribute value in root node of xml Linq to XML -