About Store Forum Documentation Contact
Donations:
158$/mo



Post Reply 
Reading and displaying Chinese characters from strings
Author Message
gculber Offline
Member

Post: #1
Reading and displaying Chinese characters from strings
Hello!

I'm new to Esenthel and trying to experiment with some of its features to see if its a good fit for our project. One of the features the project requires is the ability to input and output Chinese text. However, I am having some issues with this.

I looked through the Chinese font creation tutorial, and successfully created and saved a Chinese font file, but I can't get the engine to display the characters. I modified the 00 - Start.cpp as follows:

Code:
Font cnFont;
Str cnString;

Bool Init() // initialize after engine is ready
{
    // here when engine will be ready you can load your game data
    // return false when error occured
        
    if (cnFont.load("data/ChineseFont.font")) {
        Text_ds.font = &cnFont;
        cnString = "Font successfully loaded. abc中文";
    }
    else cnString = "Unable to load font.";
  
    return true;
}

void Draw()
{
...
    D.text (0,  0.1f, cnString);
...
}

The font loads successfully, but the Chinese characters show up as question marks.

Thank you for your help!

Gabriel Culbertson
05-21-2012 02:10 AM
Find all posts by this user Quote this message in a reply
Esenthel Offline
Administrator

Post: #2
RE: Reading and displaying Chinese characters from strings
you need to put L before unicode text
cnString = "Font successfully loaded. abc中文";
->
cnString = L"Font successfully loaded. abc中文";
05-21-2012 09:30 AM
Find all posts by this user Quote this message in a reply
Post Reply