Author Topic: RTL Support in auto line breaks/wrapping  (Read 45270 times)

Stephan B.

  • Administrator
  • Hero Member
  • *****
  • Posts: 5687
Re: RTL Support in auto line breaks/wrapping
« Reply #45 on: April 18, 2016, 02:25:00 PM »
I'll take a look later today and let you know what I find.

Any update?

I am still trying to get to this. Will give you an update today regardless.

Update
Is this how it is suppose to appear?
« Last Edit: April 18, 2016, 05:59:00 PM by Stephan B. »

ARafay

  • Full Member
  • ***
  • Posts: 133
Re: RTL Support in auto line breaks/wrapping
« Reply #46 on: April 18, 2016, 10:45:17 PM »
I'll take a look later today and let you know what I find.

Any update?

I am still trying to get to this. Will give you an update today regardless.




Update
Is this how it is suppose to appear?


Yes, thats what i want.
I think you have solved it [almost], now i dont know if its Font issue or not, but usually that Sine shape come with same gap over I shape.
In your example, its just sitting on top of I shape without any gap.
It should appear like this
http://baask.com/sayadganj/img/alif_mad_aa.gif

BUT again, im not sure if its font issue or not.


Secondly can you please tell me which font and which Hex Character Range you used to display it? So i'm able to show it atleast.

Thanks

Stephan B.

  • Administrator
  • Hero Member
  • *****
  • Posts: 5687
Re: RTL Support in auto line breaks/wrapping
« Reply #47 on: April 18, 2016, 11:55:11 PM »
I used the following string with the ARIAL font with the character ranges below.

Code: C#
  1. string sourceText = ArabicSupport.ArabicFixer.Fix("آم", true, true);
  2.  

600-603,60B-615,61B,61E-61F,621-63A,640-65E,660-6FF,750-76D,FB50-FBB1,FBD3-FBE9,FBFC-FBFF,FC5E-FC62,FD3E-FD3F,FDF2,FDFC,FE80-FEFC


ARafay

  • Full Member
  • ***
  • Posts: 133
Re: RTL Support in auto line breaks/wrapping
« Reply #48 on: April 19, 2016, 12:32:00 AM »
I used the following string with the ARIAL font with the character ranges below.

Code: C#
  1. string sourceText = ArabicSupport.ArabicFixer.Fix("آم", true, true);
  2.  

600-603,60B-615,61B,61E-61F,621-63A,640-65E,660-6FF,750-76D,FB50-FBB1,FBD3-FBE9,FBFC-FBFF,FC5E-FC62,FD3E-FD3F,FDF2,FDFC,FE80-FEFC


You are AWESOME, its working fine on my side.
Can you please tell me from where you got that range? Because i was using following range
0600-06FF,0750-077F,08A0-08FF,FB50-FDFF,FE70-FEFF,10E60-10E7F,1EE00-1EEFF

Stephan B.

  • Administrator
  • Hero Member
  • *****
  • Posts: 5687
Re: RTL Support in auto line breaks/wrapping
« Reply #49 on: April 19, 2016, 12:39:51 AM »
I used the following string with the ARIAL font with the character ranges below.

Code: C#
  1. string sourceText = ArabicSupport.ArabicFixer.Fix("آم", true, true);
  2.  

600-603,60B-615,61B,61E-61F,621-63A,640-65E,660-6FF,750-76D,FB50-FBB1,FBD3-FBE9,FBFC-FBFF,FC5E-FC62,FD3E-FD3F,FDF2,FDFC,FE80-FEFC


You are AWESOME, its working fine on my side.
Can you please tell me from where you got that range? Because i was using following range
0600-06FF,0750-077F,08A0-08FF,FB50-FDFF,FE70-FEFF,10E60-10E7F,1EE00-1EEFF

The initial range was done by taking a look at the ranges for Arabic from the unicode chart available at unicode.org (which appears to be down for me). Maybe the font you were using was missing those characters as you range appears to be the same.

The ranges I posted came from pulling the characters from my previously generated font asset using the soon to be released new feature I added yesterday http://digitalnativestudios.com/forum/index.php?topic=863.msg7861#msg7861

« Last Edit: April 19, 2016, 12:41:43 AM by Stephan B. »

ARafay

  • Full Member
  • ***
  • Posts: 133
Re: RTL Support in auto line breaks/wrapping
« Reply #50 on: April 19, 2016, 01:33:15 AM »
I used the following string with the ARIAL font with the character ranges below.

Code: C#
  1. string sourceText = ArabicSupport.ArabicFixer.Fix("آم", true, true);
  2.  

600-603,60B-615,61B,61E-61F,621-63A,640-65E,660-6FF,750-76D,FB50-FBB1,FBD3-FBE9,FBFC-FBFF,FC5E-FC62,FD3E-FD3F,FDF2,FDFC,FE80-FEFC


You are AWESOME, its working fine on my side.
Can you please tell me from where you got that range? Because i was using following range
0600-06FF,0750-077F,08A0-08FF,FB50-FDFF,FE70-FEFF,10E60-10E7F,1EE00-1EEFF

The initial range was done by taking a look at the ranges for Arabic from the unicode chart available at unicode.org (which appears to be down for me). Maybe the font you were using was missing those characters as you range appears to be the same.

The ranges I posted came from pulling the characters from my previously generated font asset using the soon to be released new feature I added yesterday http://digitalnativestudios.com/forum/index.php?topic=863.msg7861#msg7861

I'll have to use 2 fonts to cover all the characters (nice timing for Fallback Fonts)

Now i have another feature request. Currently i can either render RTL or LTR. I cant use both.
Can you please introduce a tag support or something like that where i can do something

"english sentence is starting and its meaning is <rtl>long arabic word which render perfectly when it become multiline</rtl> and then remaining english text"

This is i guess the last step for it to work completely fine.

Stephan B.

  • Administrator
  • Hero Member
  • *****
  • Posts: 5687
Re: RTL Support in auto line breaks/wrapping
« Reply #51 on: April 19, 2016, 02:16:22 AM »
I used the following string with the ARIAL font with the character ranges below.

Code: C#
  1. string sourceText = ArabicSupport.ArabicFixer.Fix("&#1575;&#1619;&#1605;", true, true);
  2.  

600-603,60B-615,61B,61E-61F,621-63A,640-65E,660-6FF,750-76D,FB50-FBB1,FBD3-FBE9,FBFC-FBFF,FC5E-FC62,FD3E-FD3F,FDF2,FDFC,FE80-FEFC


You are AWESOME, its working fine on my side.
Can you please tell me from where you got that range? Because i was using following range
0600-06FF,0750-077F,08A0-08FF,FB50-FDFF,FE70-FEFF,10E60-10E7F,1EE00-1EEFF

The initial range was done by taking a look at the ranges for Arabic from the unicode chart available at unicode.org (which appears to be down for me). Maybe the font you were using was missing those characters as you range appears to be the same.

The ranges I posted came from pulling the characters from my previously generated font asset using the soon to be released new feature I added yesterday http://digitalnativestudios.com/forum/index.php?topic=863.msg7861#msg7861

I'll have to use 2 fonts to cover all the characters (nice timing for Fallback Fonts)

Now i have another feature request. Currently i can either render RTL or LTR. I cant use both.
Can you please introduce a tag support or something like that where i can do something

"english sentence is starting and its meaning is <rtl>long arabic word which render perfectly when it become multiline</rtl> and then remaining english text"

This is i guess the last step for it to work completely fine.

That is definitely something that I plan on supporting although potentially tricky to implement. No ETA yet on when I can work on this but certainly on the list.

ARafay

  • Full Member
  • ***
  • Posts: 133
Re: RTL Support in auto line breaks/wrapping
« Reply #52 on: April 19, 2016, 11:10:20 PM »
That is definitely something that I plan on supporting although potentially tricky to implement. No ETA yet on when I can work on this but certainly on the list.

Please consider it on your top 5 list ;)
This is the only remaining piece of puzzle thats not allowing us to launch the app.

MAG

  • Newbie
  • *
  • Posts: 1
Re: RTL Support in auto line breaks/wrapping
« Reply #53 on: April 19, 2016, 11:13:07 PM »
I'm waiting as well  and keeping my eyes on this thread  :D
+1  8)

MirzaBeig

  • Newbie
  • *
  • Posts: 1
Re: RTL Support in auto line breaks/wrapping
« Reply #54 on: May 10, 2016, 10:47:24 PM »
Just wanted to say how awesome the support is for this asset. I had some trouble (I was really out of the loop) on rendering Arabic along with the transliteration and Stephan helped me out really quick with that.

The conversation was on the Unity forums, and for future reference, starts from this post onward:

http://forum.unity3d.com/threads/text-mesh-pro-the-ultimate-text-solution-for-unity-powerful-flexible-advanced-text-rendering.248636/page-21#post-2629815

jvo

  • Newbie
  • *
  • Posts: 10
Re: RTL Support in auto line breaks/wrapping
« Reply #55 on: July 08, 2016, 02:44:16 AM »
Like we talked about on the Unity forum, I'm trying to get some justified Arabic to look correctly. Working with Release 0.1.54 Beta 3b and I made the adjustments to the TMPro_Private and TMPro_UGUI_Private scripts to enable right aligning the last line of a justified block if RTL is enabled. It seems however that m_isRightToLeft is never true and I'm unable to find it as setting in the editor. The project also uses TMP to show justified English text, so just hardwiring m_isRightToLeft to true doesn't provide an easy fix.

I'm using a different plugin to fix the arabic by the way, RTL Plugin. (Because this plugin can also add line breaks, so it works with text display that doesn't handle RTL text.) But that should make no difference. I have things justified now, but the last line is still left aligned.

Stephan B.

  • Administrator
  • Hero Member
  • *****
  • Posts: 5687
Re: RTL Support in auto line breaks/wrapping
« Reply #56 on: July 08, 2016, 04:06:44 AM »
Like we talked about on the Unity forum, I'm trying to get some justified Arabic to look correctly. Working with Release 0.1.54 Beta 3b and I made the adjustments to the TMPro_Private and TMPro_UGUI_Private scripts to enable right aligning the last line of a justified block if RTL is enabled. It seems however that m_isRightToLeft is never true and I'm unable to find it as setting in the editor. The project also uses TMP to show justified English text, so just hardwiring m_isRightToLeft to true doesn't provide an easy fix.

I'm using a different plugin to fix the arabic by the way, RTL Plugin. (Because this plugin can also add line breaks, so it works with text display that doesn't handle RTL text.) But that should make no difference. I have things justified now, but the last line is still left aligned.

The enable RTL via script, you have to use the isRightToLeftText property as follows:

Code: C#
  1. textComponent.isRightToLeftText = true;

jvo

  • Newbie
  • *
  • Posts: 10
Re: RTL Support in auto line breaks/wrapping
« Reply #57 on: July 08, 2016, 07:52:45 AM »
Ah, so that's why I didn't see it in the editor. Better, but it seems the RTL plugin I use already reverses the characters sentence by sentence, so that doesn't work.

I'll try the other Arabic fixer plugin. Ok, that works better. If I have newlines in there though, it also reverses the paragraphs, so I had to update the ReverseText method a bit to maintain the paragraph order:

private string ReverseText (string source)
{
   char [] split = { '\n' };
   string [] paragraphs = source.Split(split);
   string result = "";
   foreach (string paragraph in paragraphs)
   {
      char [] output = new char [paragraph.Length];
      for (int i = 0; i < paragraph.Length; i++)
      {
         output [(output.Length - 1) - i] = paragraph ;
      }
      result += new string (output);
      result += "\n";
   }
   return result;
}

And then I used it like:

string convertedText = ReverseText(ArabicSupport.ArabicFixer.Fix (inputText));
textPro.isRightToLeftText = true;
textPro.text = convertedText;

tosiabunio

  • Newbie
  • *
  • Posts: 9
Re: RTL Support in auto line breaks/wrapping
« Reply #58 on: December 06, 2017, 12:07:08 PM »
What is the current status of mixed RTL/LTR texts? I'm facing my Farsi localization and I don't see how I could that. All 11 localizations (including Russian, Japanese, Chinese and Korean) so far have been done with rich text tags only which helped me a lot as I didn't have to change anything with TMP components. I don't see any tags related to RTL and mixed directions.

Stephan B.

  • Administrator
  • Hero Member
  • *****
  • Posts: 5687
Re: RTL Support in auto line breaks/wrapping
« Reply #59 on: December 06, 2017, 01:36:09 PM »
What is the current status of mixed RTL/LTR texts? I'm facing my Farsi localization and I don't see how I could that. All 11 localizations (including Russian, Japanese, Chinese and Korean) so far have been done with rich text tags only which helped me a lot as I didn't have to change anything with TMP components. I don't see any tags related to RTL and mixed directions.

Support for bidirectional text (BIDI) is not currently supported.

This is planned for the new text system / integrated version of TMP. I don't have an ETA yet on this.

P.S. As I have stated before, if there are opportunities to add some of the new functionality into TMP before the release of the new system, I will certainly consider it.
« Last Edit: December 06, 2017, 01:37:46 PM by Stephan B. »