PocketMatrix forums

A read-only archive of the PocketMatrix forums (2001–2014). Posting and accounts are closed.

Question about E2DSurface::PrepareFontWrap

Hi! I'm adding support for scrollable text in my GUI system and, apparently, the E2DSurface::PrepareFontWrap method is not giving me correct results. More specifically, the output string has fewer characters than the original one.

I've made a very simple example in order to reproduce the error:

Code:

wchar_t wszAuxBuffer[1024] = {0};

std::wstring wMsg = L"Welcome to this building:\n"
L"* OPTION A: Do something.\n"
L"* OPTION B: Do something else.\n";
display->fontinternal.PrepareFontWrap((unsigned short*)wszAuxBuffer,
(unsigned short*)(wMsg.c_str()),389);


After executing PrepareFontWrap, wszAuxBuffer contains the following text: "Welcome to th\n*OPTION A: \n* OPTION B: Do something else.\n".

Any idea on where should I look into in order to solve this problem?

Thanks in advance,

--Nacho
Hi Nacho,

When I change the code as seen below, it works:
Code:

wchar_t wszAuxBuffer[1024] = {0};
wchar_t wMsg[] = L"Welcome to this building:\n"
L"* OPTION A: Do something.\n"
L"* OPTION B: Do something else.\n";
display->fontinternal.PrepareFontWrap((unsigned short*)wszAuxBuffer, (unsigned short*)(wMsg),389);


Does it also work in your application? Also, which EDGELIB version are you using?
Hi edge,

Thanks for your reply. Unfortunately, the code sample doesn't work on my application (I'm attaching a screenshot that shows the debugger output). I'm using the 3.70 version (evaluation). Maybe I should tweak certain settings in the compiler?

--Nacho
Attachments:
PrepareFontWrap.rar (27 KB)
Hi Nacho,

I've taken a look and it seems that there is a bug with unicode wrapped strings in EDGELIB 3.70. This is already fixed for 3.80 which will be released soon.
Hi edge,

Thanks for your answer. I'll wait until the release of the 3.80 version then :D

--Nacho