Jump to content

Recommended Posts

Posted

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!

Posted

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.

Posted

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!

  • Upvote 1

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...