Page 1 of 1

Help!! How can I create my own font class?

Posted: Sat Aug 08, 2009 08:01
by q68576021
I want to create my own font class just like this:
class ColorFont:public CEGUI::FreeTypeFont
{
public:
ColorFont(const CEGUI::String& name, const CEGUI::String& fontname,
const CEGUI::String& resourceGroup = "");
void drawTextLine (const CEGUI::String& text, const CEGUI::Vector3& position,
const CEGUI::Rect& clip_rect, const CEGUI::ColourRect& colours, float x_scale = 1.0f, float y_scale = 1.0f);
}
and overwrite the drawTextLine function, so I can change the font colour by the text.

However, when i compile it, these are something wrong , and I don't know how to solve,please help!!! I want a multicolour text.

error LNK2001: 无法解析的外部符号 "protected: __thiscall CEGUI::FreeTypeFont::FreeTypeFont(class CEGUI::String const &,class CEGUI::String const &,class CEGUI::String const &)" (??0FreeTypeFont@CEGUI@@IAE@ABVString@1@00@Z)
1>ColorFont.obj : error LNK2001: 无法解析的外部符号 "protected: virtual void __thiscall CEGUI::FreeTypeFont::updateFont(void)" (?updateFont@FreeTypeFont@CEGUI@@MAEXXZ)
1>ColorFont.obj : error LNK2001: 无法解析的外部符号 "public: virtual void __thiscall CEGUI::FreeTypeFont::rasterize(unsigned int,unsigned int)" (?rasterize@FreeTypeFont@CEGUI@@UAEXII@Z)
1>ColorFont.obj : error LNK2001: 无法解析的外部符号 "protected: virtual void __thiscall CEGUI::FreeTypeFont::writeXMLToStream_impl(class CEGUI::XMLSerializer &)const " (?writeXMLToStream_impl@FreeTypeFont@CEGUI@@MBEXAAVXMLSerializer@2@@Z)
1>ColorFont.obj : error LNK2001: 无法解析的外部符号 "public: virtual void __thiscall CEGUI::FreeTypeFont::load(void)" (?load@FreeTypeFont@CEGUI@@UAEXXZ)
1>ColorFont.obj : error LNK2001: 无法解析的外部符号 "protected: virtual __thiscall CEGUI::FreeTypeFont::~FreeTypeFont(void)" (??1FreeTypeFont@CEGUI@@MAE@XZ)

Re: Help!! How can I create my own font class?

Posted: Sat Aug 08, 2009 08:33
by CrazyEddie
It looks like you're not linking against the CEGUIBase lib.

CE.

Re: Help!! How can I create my own font class?

Posted: Sat Aug 08, 2009 09:14
by q68576021
CrazyEddie wrote:It looks like you're not linking against the CEGUIBase lib.

CE.


but i have linked to it. if i don't use this class, the cegui performs very well in my game.I don't know what happened

Re: Help!! How can I create my own font class?

Posted: Sat Aug 08, 2009 09:33
by CrazyEddie
Yeah, I just looked at the code for CEGUI::FreeTypeFont - it turns out we're not exporting the symbols from the DLL (because further subclassing is not actually the intended usage of those classes).

As a slight aside, the latest trunk code for CEGUI has some support for coloured text (along with lots of other things) - it's not interface compatible with the old version though and the code is still being debugged and tuned.

CE.