Archive 17/01/2023.

Use right to left languages

hassanrahimi

hi all
I want to use right to left language in text in the urho3d, I try this but don’t work.
please help me.
thanks

hassanrahimi

hi all i try to make a font , but dont work correct, in persian(farsi) language, word must stick to other
it is result of make new font that is incorrect

Capture

please anyone answer to me!

Modanung

I wish I could help you. But apart from changing the alignment of Text I don’t know if Urho (already) has full support for right-to-left languages.
Would it be enough to reverse the order of each string/line as a work-around? Adding this as a parameter shouldn’t be too hard. Maybe you could create a pull request for this?

Welcome to the forums, btw! :confetti_ball: :slight_smile:

hassanrahimi

Thanks for your sympathy.thanks,I Changed text alignment but dont work.
in editor i cant insert farsi language in text3d.
i think in core editor dose not ready for enter right to left language.
i dont know how to develop urho3d editor to possibility use right to left language.

Modanung

But would reversing the string before use solve your problem?

hassanrahimi

hi ,thank you.
don’t work.:anguished:

Modanung

Isn’t the order of the characters all that needs to change?

Omid

@hassanrahimi I think you need Persian Reshaper.
I search and i found one for C#


I don’t know which platform do you using now.

Omid

btw write your word in Character map and paste it to your code for test.
image

hassanrahimi

thanks mr Omid and thanks Mr Modanung
it’s Solved.

for todays, before support RTL languages in Urho3d , Combine two methods
1: Write your text in Character Map and copy text to string in c#(click start menu and write Charactor Map)
2: reverse your string
3: show in value in text.
Capture

    protected override void Start()
		{

                     string str = "ﺳﻠﺎﻡ ﺑﻪ ﻫﻤﻪ";   
                    var cache = ResourceCache;
                    var helloText = new Text()
              {
                
                Value = Reverse(str),
             
					HorizontalAlignment = HorizontalAlignment.Center,
					VerticalAlignment = VerticalAlignment.Center,                    
                    
				};
			helloText.SetColor(new Color(0f, 1f, 0f));
			helloText.SetFont(font: cache.GetFont("Fonts/BYekan1.sdf"), size: 30);
            
            UI.Root.AddChild(helloText);
            
			
			Graphics.SetWindowIcon(cache.GetImage("Textures/UrhoIcon.png"));
			Graphics.WindowTitle = "UrhoSharp Sample";

			// Subscribe to Esc key:
			Input.SubscribeToKeyDown(args => { if (args.Key == Key.Esc) Exit(); });
		}


//Reverse method
 private static string Reverse(string str)
        {
            string revStr = string.Empty;
            for (int i = str.Length - 1; i >= 0; i--)
            {
                revStr += str[i].ToString();
            }
            return revStr;
        }

thnaks again.:sunflower::sunflower::sunflower::sunflower::confetti_ball::tada::confetti_ball: