do cegui have a good suggestion about load font?
Moderators: CEGUI MVP, CEGUI Team
do cegui have a good suggestion about load font?
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?
Re: do cegui have a good suggestion about load font?
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.
example:
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.![Very Happy :D](./images/smilies/icon_biggrin.gif)
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.
example:
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.
![Very Happy :D](./images/smilies/icon_biggrin.gif)
Return to “Offtopic Discussion”
Who is online
Users browsing this forum: No registered users and 9 guests