Japanese texts can't display proper on a device (newText bug?)

10 replies [Last post]
fatalita's picture
fatalita
User offline. Last seen 13 weeks 5 days ago. Offline
Joined: 19 Oct 2011

Hi ansca team!
I'm stuck in a trouble.

When I use Japanese 2-byte characters on display.newText on the simulator, it is displayed proper.
But on the device, the last character disappeared.

I found the reason.
The problem occur by "size" argument.

Here is the code.

1
2
3
for i=1, 16 do
        local myText = display.newText( "ケルベロスが生まれた", 20, 20+(10+i)*i, native.systemFont, 10+i)
end

("ケルベロスが生まれた" means "Cerberus came into the world" :-)

Here is the picture I took on the simulator.
(The latest corona SDK version: 2011.12.08)
http://s8.postimage.org/o0fide579/i_Phone.png

And, here is the picture I took on the device.
(iPod touch 4th gen 4.35)
http://s8.postimage.org/iaz9t2z11/device.png

As you can see, some size will be displayed very fine.
But some size cannot.

Is this a bug?
If this is not a bug, please tell me the solution.

Replies

fatalita's picture
fatalita
User offline. Last seen 13 weeks 5 days ago. Offline
Joined: 19 Oct 2011

I tried Chinese characters as well.
The same problem happened.

Here is the sentence I tried on that code.
"你好晚上好早上好" (this means hello :-)

I didn't try other languages though.
Japanese and Chinese character have the same problem at the display.newText on a real-device.

(display.newRetinaText also have the same problem)

peach pellen's picture
peach pellen
User offline. Last seen 1 day 12 hours ago. Offline
Staff
Joined: 12 Apr 2011

Hey guys, have either of you submitted a bug report? Bug #?

Peach :)

ingemar's picture
ingemar
User offline. Last seen 3 days 5 hours ago. Offline
Joined: 20 Jun 2011

I was just struggling with this a few hours ago!
I noticed that this can happen with any CJK text (Chinese/Japanese/Korean)

From my initial experiments I only saw this on my iOS 4.3.5 device with odd-numbered font sizes. devices with iOS 3.1.3, 5.0.1 and 5.1 beta behaved with my test texts.

However I haven't tried your simple example above yet. I will do that and update this post once done.
Don't worry, I'll also post a bug report with my findings :-)

EDIT:
Reported as bug: Case 10565
I've now done more detailed testing with font sizes ranging from 11-26 with the following results:

iOS 3.1.3 and iOS 4.3.5
Identical output: font sizes 11, 15, 18, 19, 20, 21, 22, 23 have a missing last character.

iOS 5.0.1 and 5.1 beta
Displays all characters.

Android 2.2:
(Galaxy Player) Displays all characters.

fatalita's picture
fatalita
User offline. Last seen 13 weeks 5 days ago. Offline
Joined: 19 Oct 2011

@peach pellen
No, not yet.

@ingemar
wow, Thanks a lot!
Your report is very useful for all corona users who use Chinese, Korean, and Japanese!
Seeing your report, before the iOS 5.0.1 confront this problem...
Hmm.. until ansca team fix this bug, I'll try to use sprite image texts instead.

walter
User offline. Last seen 3 hours 28 min ago. Offline
Staff
Joined: 22 Jun 2009

This will be fixed in the next daily build (715 or after).

The reason it suddenly works in iOS5 was b/c this was actually an Apple bug that they fixed in iOS5. We found a workaround that works across iOS4 and iOS5

ingemar's picture
ingemar
User offline. Last seen 3 days 5 hours ago. Offline
Joined: 20 Jun 2011

Great!
That means I'll be able to use any font size in the future. I've been getting around this issue by only using font sizes known to work with CJK text.

EDIT:
I've tested with build 715 and can confirm that the issue has been fixed. All font sizes for CJK text are now shown properly.

Tested on iOS 4.3.5, 5.0.1 and 5.1 beta2 (iOS 3.1.3 is not supported as of Corona build 707 so it has been skipped).

Thanks for the quick fix!

leixi
User offline. Last seen 19 weeks 2 days ago. Offline
Joined: 28 Jan 2011

How to Display Chinese Text?
I am a new developer. Why I use the code in the above, but only output something I can't read. Is that anything I don't know? I try it in the simular.

ingemar's picture
ingemar
User offline. Last seen 3 days 5 hours ago. Offline
Joined: 20 Jun 2011

Do you save your lua files as UTF-8?

leixi
User offline. Last seen 19 weeks 2 days ago. Offline
Joined: 28 Jan 2011

Oh, thank you.
I find the way to fix it. Yes, save it as UTF-8 without BOM.
http://developer.anscamobile.com/content/corona-fails-compile-when-mainlua-saved-utf-8-bom

fatalita's picture
fatalita
User offline. Last seen 13 weeks 5 days ago. Offline
Joined: 19 Oct 2011

Thanks to all of you.

Here is the daily build link...and I tried latest build (1/28 2012 version)
https://developer.anscamobile.com/downloads/daily-builds/

It works perfectly on my iPod touch with the iOS 4.35 version!
Great job Ansca team!! And thanks ingemar!
God bless you!

Viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.