Page 1 of 1

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

Posted: Wed Jun 06, 2007 04:51
by lymantok
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");

Posted: Wed Jun 06, 2007 06:28
by Kuehrli
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);

Posted: Sat Jun 09, 2007 06:02
by lymantok
Thx Kuehrli, getting rid of the 3rd line fixed it!

Posted: Sat Jun 09, 2007 09:04
by scriptkid
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.