Page 1 of 1

[solved]HiraganaCube sample

PostPosted: Tue Aug 30, 2011 2:51 am
by samsam598
Greetings,

I was wondering how to change the character to Chinese of the subjected sample?I tried to use uint16*,UTF8toUTF16 function but it desn't show the characters properly.
Code: Select all
 
//char * hiragana[6] = { "あ", "い", "う", "え", "お", "ん" };
      //char* hiragana[6]={"你","好","大","傻","瓜","蛋"};
      uint16* hiragana[6]={UTF8toUTF16("你",null),
                           UTF8toUTF16("好",null),
                           UTF8toUTF16("大",null),
                           UTF8toUTF16("大",null),
                           UTF8toUTF16("美",null),
                           UTF8toUTF16("女",null)};     
 


Thanks for the help.
Regards,
Sam

Re: HiraganaCube sample

PostPosted: Tue Aug 30, 2011 9:36 am
by jerome
Sam,

This goes through Ecere API, so UTF-8 is expected.

char* hiragana[6]={"你","好","大","傻","瓜","蛋"};

This will work, but you will need a font that contains these characters (FreeSans doesn't).
You might need to play with the size and centering as well.
Changing these lines works for me:

Code: Select all
char* hiragana[6]={"你","好","大","傻","瓜","蛋"};
//char * hiragana[6] = { "あ", "い", "う", "え", "お", "ん" };

Code: Select all
font = lfbSystem.LoadFont("MingLiu", 150, 0);
//font = lfbSystem.LoadFont("FreeSans.ttf", 175, 0);

Code: Select all
surface.WriteText((256 - tw) / 2, (256 - th) / 2 + 20, hiragana[c], strlen(hiragana[c]));
//surface.WriteText(12,-45, hiragana[c], strlen(hiragana[c]));


Cheers,

Jerome

Re: HiraganaCube sample

PostPosted: Tue Aug 30, 2011 7:59 pm
by samsam598
Thanks!