java - LibGDX autoscale text in Label -


in libgdx project have label displays number wich bigger. when number gets big, bigger label. how can size of text gets smaller when text bigger label, isn't big more?

i never tried it, if label documentation, there setfontscale method.

did try ?

the width of label given yourlabel.getprefwidth() , width of text inside label given yourlabel.getglyphlayout.width. compare both, , scale down font if width of text bigger thant width of label.

i guess use in render() :

if(yourlabel.getglyphlayout.width > yourlabel.getprefwidth()){     yourlabel.setfontscale(yourlabel.getprefwidth()/yourlabel.getglyphlayout.width); } 

Comments

Popular posts from this blog

mysql - FireDac error 314 - but DLLs are in program directory -

git - How to list all releases of public repository with GitHub API V3 -

c++ - Getting C2512 "no default constructor" for `ClassA` error on the first parentheses of constructor for `ClassB`? -