I'm loading multiple labels (100+) with different font types (max 10), but they have different sizes.

As I read the code and did the research, it's not possible to 'reuse' the font.

For instance, I have 5 labels made with GILL_SANS font but these labels must have different scales (font scales).

Should I really make 5 different BitmapFont objects for different scales (AND LOAD THESE TERRIBLE GRAPHICS AGAIN AND AGAIN) or is there any way to optimize this (without loading .fnt and .png again)?

One load takes 2mbs of RAM (huge png) + ~2ms which is unacceptable for 100 labels.

Edit I've check that. Label caches fonts so you can scale the same font and use setFontScale() on each label. But what about TextField?

  • \$\begingroup\$ One thing could be just load those letter that you are using \$\endgroup\$ – Alex Sifuentes Nov 3 '16 at 20:36

As written here: http://www.badlogicgames.com/forum/viewtopic.php?f=15&t=24124&sid=afb7ff8255e632d2dfcc9383c8001603

The best way to achieve this is to copy the whole Textfield class, add some variables like:

float fontScaleX, fontScaleY;

and scale and unscale them in draw().


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.