Iterating over all loaded fonts

For help with anything that CEGUI doesn't offer straight out-of-the-box, e.g.:
- Implementation of new features, such as new Core classes, widgets, WindowRenderers, etc. ...
- Modification of any existing features for specific purposes
- Integration of CEGUI in new engines or frameworks and writing of new plugins (Renderer, Parser, ...) or modules

Moderators: CEGUI MVP, CEGUI Team

User avatar
phoenix
Just popping in
Just popping in
Posts: 5
Joined: Thu Dec 29, 2005 11:42
Location: Germany

Iterating over all loaded fonts

Postby phoenix » Sun Jan 01, 2006 16:41

Hi all,

I'm currently trying to iterate over all loaded fonts to add the missing umlaut glyphs to each font.
So i tried the following:

Code: Select all

FontManager* fmgr = FontManager::getSingletonPtr();
String new_glyphs = "äöüÄÖÜ";

for( FontManager::FontIterator it = fmgr->getIterator(); !it.isAtEnd(); it++ )
{
   Font* font = *it;

   String glyphset( font->getAvailableGlyphs() );

   for( int i = 0; i < new_glyphs.length(); i++ )
   {
      if( glyphset.find( new_glyphs[i] ) == String::npos )
      {
         glyphset += new_glyphs[i];
      }
   }

   font->defineFontGlyphs( glyphset );
}


In my scheme file I have loaded 4 different font files. But the above code only seems to find one of them. After the first loop, dereferencing the iterator yields 0xcdcdcdcd and therefore usage of the font pointer throws an exception.

Am I using the iterator in a wrong way or is this a bug?

thx

User avatar
phoenix
Just popping in
Just popping in
Posts: 5
Joined: Thu Dec 29, 2005 11:42
Location: Germany

Re: Iterating over all loaded fonts

Postby phoenix » Sat Jan 07, 2006 20:35

*bump*
:oops:

User avatar
lindquist
CEGUI Team (Retired)
Posts: 770
Joined: Mon Jan 24, 2005 21:20
Location: Copenhagen, Denmark

Re: Iterating over all loaded fonts

Postby lindquist » Mon Jan 09, 2006 00:08

try

Code: Select all

String new_glyphs = (utf8*)"äöüÄÖÜ";

and be sure to save the source file utf8 encoded.

This did the trick for me... I did manage to get it to crash when using special character without the cast and correct encoding. It is noted.


Return to “Modifications / Integrations / Customisations”

Who is online

Users browsing this forum: No registered users and 37 guests