PDA

View Full Version : Help to create UTF8 surface cache!!!



feelthat
03-07-2013, 02:33 PM
Follows are loading font example
bool RTFont::FreeFont_LoadUTF8(string fileName)
{
FileInstance f2("interface/UTF00.bmp", true); //sunset.bmp is 32bit BGRA file
m_surxmp.LoadFileFromMemory(f2.GetAsBytes(), f2.GetSize());
}


void RTFont::DrawScaledUTF8( float x, float y, const wstring &wtext, float scale /*= 1.0f*/, unsigned int color/*=MAKE_RGBA(255,255,255,255)*/, FontStateStack *pState, RenderBatcher *pBatcher )
{

src.left = 0;
src.top = 0;
src.right = src.left + font_width;
src.bottom = src.top + font_height;
pBatcher->BlitEx(&m_surxmp, dst, src, pState->front().m_color + curAlpha);
}

If one bmp is one UTF8 font image
Now I have 20000 UTF8 image
Could someone support any way to create a bmp cache?

what are my choise?
1. put all words in a big surface
like rttx font surface

2. one words once surface

and whiat is right time put into cache?
1. Load all 20000 UTF8 bmp file in first time

2. When a word is new one then put into cache

feelthat
03-18-2013, 05:28 AM
here is example on win 32 after ios and android done will release the source

feelthat
04-09-2013, 09:16 AM
Now I use ios or android UiView system layer cover on proton

It's faster then use UTF8 on proton!!!

3145


here is example on win 32 after ios and android done will release the source