Ecere SDK/eC Forums • View topic - [solved]HiraganaCube sample




Ecere SDK/eC Forums

Ecere Developers Community

[solved]HiraganaCube sample

General help with the Ecere Cross Platform GUI toolkit: Window, common controls, events, etc.
Help with the 2D Graphics library: Surface, Display, Bitmap, Font and others.

[solved]HiraganaCube sample

Postby samsam598 » Tue Aug 30, 2011 2:51 am

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
Last edited by samsam598 on Thu Sep 08, 2011 12:12 am, edited 1 time in total.
samsam598
 
Posts: 208
Joined: Thu Apr 14, 2011 9:44 pm

Re: HiraganaCube sample

Postby jerome » Tue Aug 30, 2011 9:36 am

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
jerome
Site Admin
 
Posts: 623
Joined: Sat Jan 16, 2010 11:16 pm

Re: HiraganaCube sample

Postby samsam598 » Tue Aug 30, 2011 7:59 pm

Thanks!
samsam598
 
Posts: 208
Joined: Thu Apr 14, 2011 9:44 pm


Return to GUI Toolkit & 2D Graphics

Who is online

Users browsing this forum: No registered users and 9 guests

cron