Author Topic: Arab Font in NGUI  (Read 4965 times)

ivomarel

  • Jr. Member
  • **
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 53
    • View Profile
Arab Font in NGUI
« on: April 17, 2013, 02:08:09 AM »
Hey guys,

Hurray for NGUI supporting dynamic Fonts! Life saver and thanks to all those who worked on that.

This morning I was trying to get the Arab font working for my game and I just managed to do that. I'm just sharing this to save other people some work and perhaps even get some feedback.

Basically for the UILabel, it was super easy.
  1. myLabel.text = UnityPersianPatcher.PersianCharacterPatcher.Patch(arabicText);
  2. myLabel.pivot = UIWidget.Pivot.Right;
  3.  

I used the Unity Persian Patcher, which is used to create actual Arab words out of the separate characters. Little lesson about Arab (which I only learned this morning), the characters change depending on their adjacent characters, unlike Western characters, which stay the same no matter what they're surrounded by.
It's a free asset and I would recommend it over the 2 45 USD alternatives, which seem to offer nothing more.

Done deal, as simple as that.

Then my second 'challenge' was to fix this for the UIInput-class, since my Arab customers also fancy a chat.

Since I had to make many changes there, I just added the class UIInputML (ML= MultiLanguage & yes I know it's only Arab) to this post. All changes are commented (wherever it says
  1. //Ivo: any comment
  2.  
, I actually made a change.

It worked on my iOS device, where of course I had to use my Arab keyboard (Settings > General > Keyboard > Keyboards > Add New Keyboard... > Arabic) to see that it worked.

Specs:
Worked with: Mac Mini - OSX Unity 4.1.0f4
Tested on: iPad Mini - iOS 6.1.3

Complications:
I did not manage to type Arab text in the UIInput, while working in the Editor.

[EDIT] I just found out the numbers don't work properly. Will work on that later!
[EDIT2] I also found out Multiline doesn't work. Maybe I shouldn't have uploaded this yet ;)
« Last Edit: April 17, 2013, 02:57:35 AM by ivomarel »