Page 1 of 1

So Crazy Memory Used, plz Help.

Posted: Fri Aug 04, 2006 02:53
by HyperIris
I'm using 0.5 svn head, and I'm trying East language display.

When I use few characters, it seems OK,
but if I display some more different characters(about 300 ~ 500 chinese characters), it's very slow and so crazy memory used ( about 70MB+).

I had add a debug trace at

void FreeTypeFont::rasterize (utf32 start_codepoint, utf32 end_codepoint)
{
....
Imageset *is = ImagesetManager::getSingleton ().createImageset (
d_name + "_auto_glyph_images_" + int (s->first),
System::getSingleton ().getRenderer ()->createTexture ());
d_glyphImages.push_back (is);
//
OutputDebugString("Create a texture!!");

With DbgVIEW, it seems that this code segment was called more than 4000 times.

plz help, thanks a lot !

Posted: Sat Aug 05, 2006 06:35
by lindquist
The font system needs to render the glyphs when you request them.
You may be much better off predefining sets of frequent glyphs. I know basically nothing about asian languages, so I'm not sure how these codepoints are distributed in the unicode set...

The new font system is much better than the old in this regard, but, it still has a somewhat shortcoming, in that it will try to render pages of 256 glyphs. in a language where there could be hundreds/thousands between each used glyph this might not be a very optimal solution.

HTH and please let us know how this can be improved.

Posted: Mon Aug 07, 2006 07:21
by HyperIris
:shock:

I'm trying to optimize the arithmetic.

May be only need a 512x512 or a 1024 x 1024 texture in general font size.

Give me some time and wait my result.

:D

Posted: Thu Aug 10, 2006 08:59
by HyperIris
I had almost finish it.

But still some bug in dynamic font sizing, I'll fix it.

Only one 512x512 texture being used.

Image

Posted: Thu Aug 10, 2006 15:01
by lindquist
looks cool :) If only I knew what it said.