- Home /
How to Get a Char from his name ?
Hi,
I'm trying to type arabic strings within a TextMesh (font : arial Unicode MS). The problem is that Unity don't use the right characters : it always use Isolated form.
Is there a way to get a character from his name ? (exemple : ARABIC LETTER TTEHEH MEDIAL FORM)
Thanks in advance :)
See this question
http://answers.unity3d.com/questions/343716/how-to-write-in-arabic-in-unity-.html (But that is more about displaying it on the screen)
and http://docs.unity3d.com/Documentation/Components/class-Font.html it has a section about Unicode support
I do not understand what you mean by from his name. Do you mean getting a character from a string?
Thank you for your comment :)
Yeah that's it : Each character has a 'name' : http://www.unicode.org/charts/PDF/UFB50.pdf
And I wanted to know if it was possible to get the good character from the string (maybe I should create my own dictionary from these lists (look at ranges : http://en.wikipedia.org/wiki/Arabic_alphabet ))
For RTL Converter, i've already seen it, I wanted to try something before buying it, but it's not expensive, so I think I will buy it..
Edit : (no i don't want to convert a one-letter string to a char :p)
#pragma strict
function Start () {
var txt : Text$$anonymous$$esh = GetComponent(Text$$anonymous$$esh);
var rawString : String = "ææå أنا العبارة العربية";
var endString : String = "";
var utfInt : int;
for (ch in rawString){
utfInt = System.Convert.ToInt32(ch);
endString += Char.ConvertFromUtf32(utfInt);
Debug.Log(utfInt.ToString()+" "+ Char.ConvertFromUtf32(utfInt) );
}
txt.text = endString;
}
Did some testing, this worked for me. I can not verify how the Arabic text turned out. But the letters æøå I am familiar with.
I made this by using the examples at:
http://msdn.microsoft.com/en-us/library/ww9t2871.aspx and http://msdn.microsoft.com/en-us/library/system.char.convertfromutf32.aspx
If I am way off here, I apologize. And hope someone can give a better answer.
I also found a free package that might be worth a look into http://u3d.as/content/abdullah-konash/unity-arabic-support/2B8
Don't worry, thanks for your answers :)
I've tested Char.ConvertFromUtf32 before to print the characters I have in my font, and it worked.
But my goal is to get these characters from their name (not code) in order to give the initial/medial/final or isolated forms to the characters (the names seems to have a little standard, that's why I wanted to use them)
I will buy the library, it will be better, but I keep the question open if someone has an idea :)
I think the solution is to create our own dictionary, or to find one..
Answer by SkyRamon · Aug 23, 2013 at 12:31 PM
just dont type arabic strings just use English strings
If I had the choice :p
I'm currently working on the translation of my game in many languages such as the arabic one ^^
Your answer
Follow this Question
Related Questions
Dynamic vs Unicode fonts 1 Answer
3D Text Mesh produces wrong letters 1 Answer
Multiple Language Support Not Working in TextMesh Pro 0 Answers
TextMeshPro font behaviour 0 Answers
TextMesh multiplayer/network issue 0 Answers