Page 1 of 1

font maker tool

PostPosted: Nov 6, 2008 @ 11:32am
by mamahow
Is it possible to use font maker to build up CJK characters? I've tried it to input two Chinese characters, but it seems to be not correct, please check my attached picture.

MAMAHOW

PostPosted: Nov 11, 2008 @ 10:02am
by edge

PostPosted: Mar 30, 2009 @ 7:14am
by mamahow
Hi,
Please check my setting of Font Maker
and the font image output of Chinese character seems to be chooped out.

Thanks,
Monky

PostPosted: Mar 30, 2009 @ 9:47am
by edge
Hi,

We've tested our makefont tool with Chinese characters without any trouble. Can you post the truetype font file and character set you're using (save the contents of the input box to a unicode textfile).

PostPosted: Apr 17, 2009 @ 3:28am
by maya

PostPosted: Apr 18, 2009 @ 1:09pm
by edge

PostPosted: Apr 21, 2009 @ 4:40am
by maya
Hi,
Thanks for your reply.
I create font surface and coding as follows,

font.SetFontCharacters(0, 127);
font.BuildFont(true);
buffer->DrawFont(100, 100, &font, "一二八", EFO_HCENTER | EFO_VCENTER | EFX_OPACITY, 255);

but can't see any font. Anything goes wrong?

PostPosted: Apr 22, 2009 @ 11:06am
by edge
Hi Maya,

To use non-ascii characers (such as Chinese), we recommend using font.SetCharacterSet. Also make sure to use WCHAR strings instead of char to support unicode.

PostPosted: Apr 24, 2009 @ 8:05am
by maya
I try it as follow,
if (ef.Open("font.epk", EFOF_READ))
{
if (!ef.PackAuthorize(0)){
SetErrorMsg("Pack Authorize fail!!!");
return(E_ERROR);
}
ClassEMemory::DeAlloc(filedata);
}
else{
SetErrorMsg("Open epk fail!!!");
return(E_ERROR);
}
if (ef.PackGetFileData(filedata, filedatasize, "test.png") == E_OK)
{
if (display->CreateSurface(&shared.test, filedata, filedatasize) != E_OK)
{
SetErrorMsg("CreateSurface fail!--> test.png");
return(E_ERROR);
}

WCHAR testFont = (WCHAR)L"一乙丁七乃九了二人儿入八几刀刁力";

shared.test.SetFontCharacterSet(&testFont);

shared.test.BuildFont(true);
ClassEMemory::DeAlloc(filedata);
}
WCHAR testFont1 = (WCHAR)L"一二八";
buffer->DrawFont(iconRC.left+iconWidth/2, iconRC.top+70+offsetH, &shared->test, &testFont1, EFO_HCENTER | EFO_VCENTER | EFX_OPACITY, imgOpacity);

but I still can't see any font.
Could you show me the sample code about Drawing font using non-ASCII character set? thanks a lot!

PostPosted: Apr 28, 2009 @ 7:10am
by edge

PostPosted: May 4, 2009 @ 4:20am
by maya
Hi,
Thanks for your reply.
I try your suggestion, it's work.
But I want to show string dynamically,the string is composed of any text in testFont.txt(continue last post), such as "九十","十入"...,because I don't know what string I will draw,I can't store my string in a unicode text file in advance,I try draw as follows,


WCHAR myText[]= L"九十".
buffer->DrawFont(100, 100, &font, myText, EFO_HCENTER | EFO_VCENTER | EFX_OPACITY, 255);

It have compile error as follows,
error C2440: 'initializing' : cannot convert from 'const wchar_t [4]' to 'unsigned short []'
2> There is no context in which this conversion is possible

how can I do?

PostPosted: May 4, 2009 @ 8:21pm
by edge
Hi Maya,

Unfortunately, that's not possible. It's mainly due to the difference between the wchar_t and WCHAR datatypes. The only solution would be to write your own wchar_t to WCHAR converter.