JUCE new learner appeal everybody:About Chinese messy code on GUI


#1

Anybody here? I'm  learning JUCE and met a questtion.It is messy code showed on the GUI in Chinese,I use Visual Studio 2008. I tried to use Unicode and Multi-byte of IDE settings but it doesn't work ,I also use CharPointer_UTF8(and others)  to wrapper the Chinese raw string.Who can help me write a good  locale  independent procedure code to solve this problem. Look the picture ATTACHMENT,the red messy part is Chinese.

 


#2

To do so, follow these steps;

- Build the Introjucer
- Run it
- Navigate to "Tools"
- Select "UTF-8 String Literal Helper"
- Put non-ASCII text in the first box
- Copy code from second text box to your code
- ??
- Profit


#3

Thank you for your help,I tried in your ways,but there is no output.My code below:

g.drawFittedText(String(CharPointer_UTF8 ("Chinese \xe4\xb8\xad\xe6\x96\x87")),80,90,getWidth() - 100,100,Justification::centred,1);

"\xe4\xb8\xad\xe6\x96\x87" is "中文" converted output !

 

ATTACHMENT PNG shows no output


#4

You need to use a font that actually contains those characters.


#5

Hi,jules.I'm sorry for that i cannot catch your words clearly.  use a font that actually contains those characters. the "font" means the calss Font in JUCE or other. Can u tell me how to handle it more detailed.


#6

Use Graphics::setFont to select a typeface that actually contains some Chinese characters! You can't draw Chinese characters if the current typeface doesn't contain them!