Author Topic: Unity 4.2 beta NGUI dynamic fonts not displaying non latin characters in metro  (Read 15048 times)

Simurr

  • Guest
We are using NGUI 2.3.3h and Unity 4.2b5 (was also an issue with 4.2b3 and 4.2b4).  The dynamic font we are using is the DroidSansFallback TTF font from Android.  Everything works fine for standalone desktop builds but when I make a Windows App Store build none of the non-latin fonts show up (Japanese, Korean, Chinese etc.).

There are no error logs from the player.  DroidSansFallback is the only font we have setup and the latin fonts look like they are using droid sans.

Any ideas what could be the problem?

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
2.3.3 is back from February. How do you expect it to work with the latest beta of a platform that did not exist at that time?

Simurr

  • Guest
Sorry, wrong version.  NGUI is at least 2.6.1d.  I was going off a readme file left in the folder.

Simurr

  • Guest
Just updated to 2.6.3.  Didn't fix the issue.  Actually added a compile issue for Windows App Store, but that's a separate problem.  Any ideas on this?

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Try creating a GUIText or a 3D Text using that font and see if it shows up.

Simurr

  • Guest
Made a simple test with 11 languages as 3d text and UILabels.  3D Text works fine, UILabels don't show non-latin characters.  I've attached example images of a standalone win build and a metro build.  Left side is 3D Text, right is UILabels. 

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Interesting. So this issue is only presenting itself in the metro beta 4.2, and only with Win8 targeted... and only in the build, not in the editor? Sounds like something fishy is going on on the Unity's side again. I can't say I'm surprised. Dynamic font support has been finicky at best.

Just to clarify -- where is the label text coming from?  Is it set in inspector, or do you load it from some file?

Simurr

  • Guest
In our game we are setting text in the editor and from a language file.  The example project only uses in editor text.

liu_yin_

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 11
    • View Profile
I ran into the same issue with Unity 4.2 and NGUI 2.6.4. Is this issue resolved in NGUI 2.7 or 3.0?

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
I honestly don't know. I don't have a win 8 device to try this on.

liu_yin_

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 11
    • View Profile
Hi ArenMook,

Thanks a lot for the quick response.

I just verified NGUI 2.7.0 with Unity3D 4.2, only English characters can be displayed on Windows Phone 8 and Windows 8 Metro. Any non-latin character will disappear when using UILabel on both platform.

I also tried to verify last NGUI 3.0 with Unity3D (I just bought Pro license today). NGUI 3.0 doesn't compile with the following error on Windows 8 Metro due to changes in EventDelegate. I guess it's probably due to incompatibility between WinRT and Mono.

Assets\NGUI\Scripts\Internal\EventDelegate.cs(104,87): error CS1061: 'EventDelegate.Callback' does not contain a definition for 'Method' and no extension method 'Method' accepting a first argument of type 'EventDelegate.Callback' could be found (are you missing a using directive or an assembly reference?)
Assets\NGUI\Scripts\Internal\EventDelegate.cs(108,49): error CS0117: 'System.Delegate' does not contain a definition for 'CreateDelegate'

If you have a Windows 8 machine with Visual Studio installed, you don't need Windows 8 or Windows Phone 8 device to repro. You can directly load the generated Metro or WP8 project in Visual Studio and run it in emulator. And VS has excellent debug support for the Metro project generated by Unity3D, you can do line by line debugging of C# script with emulator.

I will really appreciate your help here since localization is very important for the project that I am currently working on. Actually we have more non English speaking players in our game. It's a really blocking issue to us if NGUI cannot display non-latin characters on Windows Phone 8 and Windows 8 Metro device. If you can give me some hint on where to set break point and what to look for, I will be happy to debug it on my side and report back my findings.

Thanks again!


ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
So Windows 8 doesn't support reflection either, not just WP8... ew. Well, I've added it to the list of "shitty platforms" alongside Flash and WP8, so if you grab the latest it will compile now.

And no, I don't have a Win8 machine. I hate that OS. Win7 I like. M$ seems to get it "right" every other release. XP was great, Vista sucked. Win7 was great, Win8 sucked...

You having pro does make trying things quite a bit easier though. In any case, I strongly advise you submitting a bug report about this to Unity. Any inconsistencies between editor and run-time should be reported -- especially if they work on all other platforms except Win8.

liu_yin_

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 11
    • View Profile
Hi ArenMook,

Again, thanks for the quick response. But I think there may be some misunderstanding about this issue.

1) The non-latin character issue happens on both Win8 and WP8. If you happen to have WP8 device, you will also be able to repro this issue. But debugging will be pretty hard though.
2) I have tried to create 3D Text and GUI Text inside Unity with the font I use, and both of them are displayed properly in Win8 and WP8 device. Therefore, I think the issue is caused by some behavior inconsistency of dynamic font on Win8 & WP8, which NGUI's UIFont didn't expect and bail out when rendering non-latin character on both platforms.

I will for sure report this issue to Unity since it's platform inconsistency. However, giving them a project with NGUI UILabel containing non-latin character may not be that helpful. If you can shed some light and point me to the places where UILabel/UIFont expects to get data from dynamic font, and may likely to bail out, it will be very helpful since I will be able to debug it on my side and figure out where the behavior change is.

Thanks,
Yin

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
1. I understand, and I don't have either.

2. Dynamic font support is likely the cause here. Unity's dynamic font support is a recent addition, and the fact that it doesn't work on Win 8 / WP8 just shows that it's bugged. You need to report it to Unity. There is nothing I can do on the NGUI's side. All NGUI does is gets the dynamic font's characters -- which apparently doesn't work on WP8/Win8 devices. Don't worry, QA are quite used to people reporting issues shown by using NGUI in ways they did not test properly.

liu_yin_

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 11
    • View Profile
Re: Unity 4.2 NGUI dynamic font not displaying non latin character in Win8 & WP8
« Reply #14 on: September 14, 2013, 08:40:11 PM »
I just did some further debugging on my side and found there is actually a bug inside Unity's implementation of Font.GetCharacterInfo for non-latin character on WP8 and Win8 platforms. It will return false although the requested character actually exists in the texture. Fortunately, with Font.characterInfo, it's fairly easy to re-implement the logic of Font.GetCharacterInfo and patch it up for WP8 and Win8 platform. I tested my fix on both platforms and verified Font.GetCharacterInfo is the only breaking part.

I will file a bug to Unity since now the repro and root-cause is fairly clear. Hopefully they can get it fixed soon.