do cegui have a good suggestion about load font?

Forum for general chit-chat or off-topic discussion.

Moderators: CEGUI MVP, CEGUI Team

User avatar
Just popping in
Just popping in
Posts: 4
Joined: Sun Oct 09, 2005 06:46

do cegui have a good suggestion about load font?

Postby snos » Wed Oct 12, 2005 03:04

when loading the font(I use chinese), for example, using the mingliu.ttc font, I should load the chinese code point from 199868 to 40868, that would cause crash for it create a 4096 size texture; and that would spend a long long time loading; gratefully, do you have any suggestion that solve the problem?

User avatar
Just popping in
Just popping in
Posts: 3
Joined: Mon Oct 03, 2005 03:18

Re: do cegui have a good suggestion about load font?

Postby jingjie » Thu Oct 13, 2005 04:31

this problem is happened by Huge rage of CodePoint ,
Especially code points of Chinese is total amount over 40000 words so that we can't load font by <GlyphRange StartCodepoint="19968" EndCodepoint="40868" />.
I have a easy way that observes avaible glyphs.
In another word You can define glyphs immediately when using some chinese glyphs.
void ObservesAvaibleGlyphs(CEGUI::utf32 new_glyph)
//glyphs defined is recorded by m_UsedGlyph .
static CEGUI::String m_UsedGlyph;
static initGlyph = false;
CEGUI::Font* font = CEGUI::System::getSingleton().getDefaultFont();
if(!initGlyph && font)
// Get Available Glyphs;
m_UsedGlyph = font->getAvailableGlyphs();
initGlyph = true;
//observe input glyph is defined?
CEGUI::String::size_type glyph_pos = m_UseGlyph.find((CEGUI::utf32)wch);
// if not , add into defineFontGlyphs
if(glyph_pos == CEGUI::String::npos)
m_UsedGlyph += (CEGUI::utf32)new_glyph;
font->defineFontGlyphs(m_UseGlyph );
For example , if you want to prodouce "世" glyph , "世" must be transfer UTF8 Format which its codepoint is 19990
then use ObservesAvaibleGlyphs((CEGUI::utf32 )19990);

It works Well for any unicode inputs you need immediately. :D

Return to “Offtopic Discussion”

Who is online

Users browsing this forum: No registered users and 5 guests