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

c# - How Configure Devart dotConnect for SQLite Code First? -

java - Copying object fields -

c++ - Clear the memory after returning a vector in a function -