Page 1 of 1

Font size + Ogre explained?

Posted: Mon Apr 28, 2008 01:42
by sjcomp
Hello,

I'm using Ogre as the graphics engine. Ogre has overlays which can show fonts. I can use the same true font for CEGUI. But do they use the same generated texture or they are separate?

Now I'd like to change the size of the font, which looks like I'd need to create another .font file which has a different font size. The question is how many font textures will I have now?

If I want to have a fixed width font, I simply can use a fixed width ttf (such as Courier New)?

Thank you.

Posted: Mon Apr 28, 2008 07:21
by scriptkid
Hi,

Ogre and CEGUI will create their own texture, since both simply don't know about each other in that area.

And indeed, another font size means another representation hence more memory consumption. You might -at code level- fine grain the loading and destroying of fonts when they are (not) needed (anymore).

I think that -since a fixed width font is also a ttf- you can just use that like any other font.

HTH.

Re: Font size + Ogre explained?

Posted: Mon Apr 28, 2008 12:33
by Rackle
sjcomp wrote:Now I'd like to change the size of the font, which looks like I'd need to create another .font file which has a different font size.


You should have a look at these:
http://www.cegui.org.uk/wiki/index.php/GameChatBox
http://www.cegui.org.uk/wiki/index.php/DynamicFont

Posted: Mon Apr 28, 2008 13:53
by sjcomp
Thanks scriptkid and Rackle!
scriptkid wrote:Hi,
Ogre and CEGUI will create their own texture, since both simply don't know about each other in that area.

I see, I thought that given that there is a CEGUIRenderer in ogre it also handles fonts. But if I use a texture for an imageset and the same texture for an overlay, would it be loaded twice?


I see, my understanding is that using this cod for dynamic font results in the same memory consumption as if I'd use font file. If I only need two font sizes, both of which are constantly used in the menu then there is no real need to use dynamic fonts, as they will not save memory for me.

I see that font textures are defined with 800x600, but these are not power of two textures. I think modern cards do not care, but older ones do so they will use 1024x1024 instead. Why 800x600?

Thank you.

Posted: Mon Apr 28, 2008 14:35
by Rackle
My contribution was more to the effect of "you do not absolutely have to create the .font files but instead can use code". For each _new font_, which is either a .font file or created dynamically, will increase the memory consumption.

Posted: Mon Apr 28, 2008 15:36
by sjcomp
Rackle wrote:My contribution was more to the effect of "you do not absolutely have to create the .font files but instead can use code". For each _new font_, which is either a .font file or created dynamically, will increase the memory consumption.
Got it! Thanks a lot.