Label v3.0 unicode characters?

The old LabelTTF supports unicode characters. I did a quick test and it seems that the new Label v3.0 does not support unicode characters or maybe I’m just missing something? And does/will it support tab spacing()? I’m thinking if it supports unicode then this will be covered also.

Another observation: when I use the new Label v3.0 to create a MenuItemLabel, it seems that the bounding box is a bit off. It detects touches at the bottom half of the label extending half the label’s height below it and it does not detect touches at the upper half.

Side note: I know the new GUI system should easily accomplish this task of MenuItemLabel, and I’ll be happy to use it but I can’t due to some header file inclusion anomaly.

If nothing else, I may have to stick with the old LabelTTF which do the job but slow and ugly.

Thanks in advance for any info or help. :slight_smile:

The new label support unicode characters,u can see the sample in testcpp.[LabelTestNew—>LabelTTFUnicodeChinese/LabelFNTUnicodeChinese].

I will check up the issue that use the new Label v3.0 to create a MenuItemLabel,thanks for yout feedback.

Hi WenHai,

Thanks for replying. I can see that in sample projects, the new label works perfectly well with unicode characters as seen in the screenshot you provided; also, I ran the sample projects myself as well. However, when I tried to test it on the default helloworld start project, unicode wont work (see attached image). I copied the exact line from the sample project, I also copied over the font ttf file to the helloworld project. I’m not sure what I’m doing wrong here.

About the bounding box of the new label, it is way off downwards. I’ve made a simple test by drawing the bounding rect (overloaded the draw() function as DEBUG_DRAW doesn’t show it) and attached image is what I’ve found.

Side note: there’s also some bits showing inside the bounding rect.

EDIT: Also is the default anchor point of the new label at lower left corner?

Thanks again! :slight_smile:

Well,

  • Bounding box looks like a bug, and probably caused by mechanism of multiple resolution. We should fix it.
  • About the problem in Unicode, please check if your visual studio “save” your source code file into GBK “automatically” and “by default”. This is a common mistake.

Thanks Zhe,

Forgive me but I can’t seem to find the settings for save source code file into GBK in visual studio. Can you kindly tell me where I can find these settings? Thanks.

You should save source code file into UTF8 in visual studio when the file contain unicode char.You can find the configuration item follow the path:[File —>Advanced Save Options]

I have created an issue for the bounding box a bit off : http://cocos2d-x.org/issues/3642. We will fix it as soon as possible.Thanks for your feedback.

Thank you WehHai,

It seems that visual studio is so stubborn, even though I saved it as UTF-8 encoding, it still won’t display the unicode characters. I’ve resulted to loading the text from a file, which is my plan anyway.

Thanks for submitting the ticket. :slight_smile:

@Jonah T
I fixed the issue that bounding box of new label is incorrect at https://github.com/cocos2d/cocos2d-x/pull/5164.

@WenHail Lin
Hi WenHai, I have tested on your fixing, but I still have the problem that all the charaters on Label, are offseting on their Y axis. That’s to say they are all outside the Label bounding.