Laurens Posted December 23, 2009 Posted December 23, 2009 Hi guys, I have been busy on slapping a GUI together and was kind of surprised when I noticed that loading fonts is pretty slow. Let me explain. I have a GameScreen which renders the 3D prettiness and such. When the player hits the escape key it creates a new PauseScreen and pushes it on top of the screen stack. Because the PauseScreen has - at that point - not yet been initialized, the screen manager calls LoadContent on it where it starts loading images and fonts used. When I do not render any text to screen, the pause screen shows up instantaneously (well, for the eye) as opposed to a quarter of a second delay when it does have to load fonts. For custom fonts this delay remains even after it has been first loaded. Not so with the built-in font. The built-in font has a delay when first loaded but is instantaneous every time afterwards. I am not freeing the font in any way. Has anyone else noticed this? I am thinking of creating a FontPool that loads all used fonts at the start of game and maybe circumvent it. However, if I am the only one experiencing this delay then I'll dive deeper into my code to see whats wrong. Thanks! Quote
L B Posted December 23, 2009 Posted December 23, 2009 Loading a font is a long task for any engine or application. I suggest you create a FontPool just like you said. By the way, can you load AAed fonts? I haven't even tried yet, but it would be nice. Quote
Laurens Posted December 23, 2009 Author Posted December 23, 2009 Thanks for the response Ubu, I will do so then Any idea where the delay might be though (parsing the INI perhaps?)? Because I am not experiencing a delay when loading regular textures. That's why I was so surprised Regarding AA'd fonts: you can apply AA in Font Studio before exporting and load them up in the engine. Haven't had any problems with it. Cheers! 1 Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.