Ecere SDK/eC Forums
http://ecere.org/community/
Print view

[solved]HiraganaCube sample
http://ecere.org/community/viewtopic.php?f=5&t=174
Page 1 of 1
Author:  samsam598 [ Tue Aug 30, 2011 2:51 am ]
Post subject:  [solved]HiraganaCube sample

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
Author:  jerome [ Tue Aug 30, 2011 9:36 am ]
Post subject:  Re: HiraganaCube sample

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
Author:  samsam598 [ Tue Aug 30, 2011 7:59 pm ]
Post subject:  Re: HiraganaCube sample

Thanks!
All times are UTC-05:00 Page 1 of 1