0
\$\begingroup\$

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?

\$\endgroup\$
1
  • \$\begingroup\$ One thing could be just load those letter that you are using \$\endgroup\$ Commented Nov 3, 2016 at 20:36

1 Answer 1

0
\$\begingroup\$

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().

\$\endgroup\$
1
  • \$\begingroup\$ 404 :c. Would've loved that read \$\endgroup\$
    – centenond
    Commented Jan 25, 2022 at 21:02

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .