How to get rid of error FontManager::getFont - A Font object

For help with general CEGUI usage:
- Questions about the usage of CEGUI and its features, if not explained in the documentation.
- Problems with the CMAKE configuration or problems occuring during the build process/compilation.
- Errors or unexpected behaviour.

Moderators: CEGUI MVP, CEGUI Team

lymantok
Not too shy to talk
Not too shy to talk
Posts: 39
Joined: Sun May 13, 2007 03:24

How to get rid of error FontManager::getFont - A Font object

Postby lymantok » Wed Jun 06, 2007 04:51

Any ideas on how do I get rid of this error?

Exception: FontManager::getFont - A Font object with the specified name 'Tahoma-12.font' does not exist within the system

Offending code in ceguifont.h

float getLineSpacing (float y_scale = 1.0f) const
{ return d_height * y_scale; }

Called by the following code (mine):

...setup resource paths, etc...
CEGUI::SchemeManager::getSingleton().loadScheme("TaharezLook.scheme");
CEGUI::FontManager::getSingleton().createFont("Tahoma-12.font");
CEGUI::System::getSingleton().setDefaultFont("Tahoma-12.font");

Kuehrli
Just popping in
Just popping in
Posts: 12
Joined: Tue May 22, 2007 14:03
Location: Linz, AT

Postby Kuehrli » Wed Jun 06, 2007 06:28

Skip the third line (if there's only one font setDefaultFont is not necessary) or try it this way:

Code: Select all

CEGUI::Font* myFont = CEGUI::FontManager::getSingleton().createFont("Tahoma-12.font");
CEGUI::System::getSingleton().setDefaultFont(myFont);

lymantok
Not too shy to talk
Not too shy to talk
Posts: 39
Joined: Sun May 13, 2007 03:24

Postby lymantok » Sat Jun 09, 2007 06:02

Thx Kuehrli, getting rid of the 3rd line fixed it!

User avatar
scriptkid
Home away from home
Home away from home
Posts: 1178
Joined: Wed Jan 12, 2005 12:06
Location: The Hague, The Netherlands
Contact:

Postby scriptkid » Sat Jun 09, 2007 09:04

You have probably got confused (i forgive you ;)) by the slight difference in the CreateFont and SetDefaultFont methods.

CreateFont receives a filename, however SetDefaultFont receives a font name, which is the Name attribute in your font.xml file. So this will probably work:

Code: Select all

CEGUI::System::getSingleton().setDefaultFont("Tahoma-12");


Or, as suggested by Kuehrli, pass the font itself.


Return to “Help”

Who is online

Users browsing this forum: No registered users and 33 guests