I take it you're using UnicodeFont? IMO you are going about this the wrong way.
Firstly, you shouldn't load images/fonts/etc. during
your animations. These should be loaded once
, generally during initialization, and then re-used throughout.
Secondly, instead of changing the font size (which is expensive), you should be changing the scale
at which you render the text (which is cheap).
Here's a few ideas. AngelCodeFont is very quick to load, and fast enough to render directly to the screen.
A) Use a single AngelCodeFont and load the font image with FILTER_LINEAR. Use g.scale and g.translate before drawing your text in order to "resize" it.
The downside is that scaling artifacts may appear, especially if you up-scale the text or if you rely on pixel-perfect fonts.
B) If you need smoother down-scaling, one option is to use mip mapping
. This means OpenGL will select the best size to show based on the scale you're rendering your text. To achieve Mipmapping with slick, you need the dev branch and this code
However, depending on your font and how far you are pushing the down-scaling, it may look ugly. Also, it doesn't help the up-scaling artifacts.
C) A third solution would be to load multiple AngelCodeFonts at different sizes, then select which AngelCodeFont to render based on the desired text size.
Ideally you would choose the next greatest
size, so that you're always scaling the font image down
as opposed to scaling it up.
Chances are, since your animation is probably relatively quick (i.e. only a couple seconds) the user won't notice any scaling artifacts. This is why I'd suggest using (A) for simplicity's sake.