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

iamsam

  • Newbie
  • *
  • Posts: 6
Re: RTL Support in auto line breaks/wrapping
« Reply #15 on: August 21, 2015, 07:01:06 PM »
How do we access the RTL function through script? If I enable it in the editor, does it enable the corresponding method in code? It would be great if you could let me know an ETA on the beta that incorporates this in code and UGUI component. From my testing this is really working well, so you could include it as is in the next beta. If I can test it using scripts it will help me see how it holds up as most of my text is using localization from scripts and I rarely use the editor to set the text.

Thanks again for this amazing asset.

Stephan B.

  • Administrator
  • Hero Member
  • *****
  • Posts: 5687
Re: RTL Support in auto line breaks/wrapping
« Reply #16 on: August 21, 2015, 10:05:37 PM »
How do we access the RTL function through script? If I enable it in the editor, does it enable the corresponding method in code? It would be great if you could let me know an ETA on the beta that incorporates this in code and UGUI component. From my testing this is really working well, so you could include it as is in the next beta. If I can test it using scripts it will help me see how it holds up as most of my text is using localization from scripts and I rarely use the editor to set the text.

Thanks again for this amazing asset.

I would love to get a bunch of test strings / sentences showing me how they are suppose to look with proper word wrapping and line breaking. I need strings / text that I can copy paste to compare. It really sucks not to be able to read certain languages for testing.

Brain

  • Beta User
  • Full Member
  • *
  • Posts: 128
Re: RTL Support in auto line breaks/wrapping
« Reply #17 on: August 22, 2015, 07:55:36 AM »
Could you just test with whatever sentences you can find from the web and compare to how the browser renders them? For example http://www.omniglot.com/language/phrases/arabic.php (dragging the window smaller lets you see them on multiple lines).

Edit: My use case will be 100% through scripts (translations), gonna need to use Arabic in maybe 2-3 months.
« Last Edit: August 22, 2015, 07:58:11 AM by Brain »

iamsam

  • Newbie
  • *
  • Posts: 6
Re: RTL Support in auto line breaks/wrapping
« Reply #18 on: August 22, 2015, 12:22:47 PM »
I would love to get a bunch of test strings / sentences showing me how they are suppose to look with proper word wrapping and line breaking. I need strings / text that I can copy paste to compare. It really sucks not to be able to read certain languages for testing.

Sure Stephan, I can send you two or three sentences along with screenshots in Unity, is there a way I can IM you here? I am currently on a trip and don't have access to Unity so will message them to you tomorrow.

Stephan B.

  • Administrator
  • Hero Member
  • *****
  • Posts: 5687
Re: RTL Support in auto line breaks/wrapping
« Reply #19 on: August 22, 2015, 01:14:17 PM »
I would love to get a bunch of test strings / sentences showing me how they are suppose to look with proper word wrapping and line breaking. I need strings / text that I can copy paste to compare. It really sucks not to be able to read certain languages for testing.

Sure Stephan, I can send you two or three sentences along with screenshots in Unity, is there a way I can IM you here? I am currently on a trip and don't have access to Unity so will message them to you tomorrow.

You can PM me here or just email the Support@DigitalNativeStudios.com

iamsam

  • Newbie
  • *
  • Posts: 6
Re: RTL Support in auto line breaks/wrapping
« Reply #20 on: August 22, 2015, 02:03:46 PM »
Thanks  :). Sent you PM, let me know if you need ASCII codes for those letters.

Brain

  • Beta User
  • Full Member
  • *
  • Posts: 128
Re: RTL Support in auto line breaks/wrapping
« Reply #21 on: September 07, 2015, 02:31:32 AM »
Any progress on this?

I was also thinking if there should/could be some automated way to change left aligned text to right aligned string when using RTL strings since my case will be shared scenes and prefabs with dynamically localized strings.

Stephan B.

  • Administrator
  • Hero Member
  • *****
  • Posts: 5687
Re: RTL Support in auto line breaks/wrapping
« Reply #22 on: September 07, 2015, 02:37:41 AM »
Any progress on this?

I was also thinking if there should/could be some automated way to change left aligned text to right aligned string when using RTL strings since my case will be shared scenes and prefabs with dynamically localized strings.

I haven't had time to revisit the RTL support since I am working on the Multi Font & Material support.

In terms of changing the alignment automatically, I think it would be safer to manually select the appropriate alignment or use the <align=right> tag in the localized strings. That way you can set and be certain the alignment is correct for any given string.

Brain

  • Beta User
  • Full Member
  • *
  • Posts: 128
Re: RTL Support in auto line breaks/wrapping
« Reply #23 on: September 07, 2015, 05:49:40 AM »
I was reading about the ICU BiDi implementation and the way they do things is that there's global text direction flag that can be overridden. There are Unicode BiDi characters to mark the text direction, but I guess tags like <dir=RTL> would work better with TMP.

Anyway, I think a global flag for a project is important, since then you'd have to only add tags to LTR text parts instead of everything, if a project is mostly using RTL. It should then be easy for me to add custom code to change the alignment too.

Brain

  • Beta User
  • Full Member
  • *
  • Posts: 128
Re: RTL Support in auto line breaks/wrapping
« Reply #24 on: September 30, 2015, 02:09:21 AM »
I know you're busy since Unity 5.2 is such a hot mess, but do you have an idea when you'll have time to work on this? I will be needing RTL support in early-mid November both for regular objects and UI. I can hack around stuff if necessary and am also willing help in any way I can. I won't need any of the extra stuff I've suggested at that point - just working RTL text objects (with script access).

Stephan B.

  • Administrator
  • Hero Member
  • *****
  • Posts: 5687
Re: RTL Support in auto line breaks/wrapping
« Reply #25 on: September 30, 2015, 02:55:23 PM »
I know you're busy since Unity 5.2 is such a hot mess, but do you have an idea when you'll have time to work on this? I will be needing RTL support in early-mid November both for regular objects and UI. I can hack around stuff if necessary and am also willing help in any way I can. I won't need any of the extra stuff I've suggested at that point - just working RTL text objects (with script access).

I am hoping the Unity 5.2 patch on Friday will address the remaining masking issues. If that is the case, I'll be able to resume working on new features.

Have you played with the current RTL implementation using the normal TextMeshPro component?

Brain

  • Beta User
  • Full Member
  • *
  • Posts: 128
Re: RTL Support in auto line breaks/wrapping
« Reply #26 on: October 01, 2015, 02:08:39 AM »
I've tried it out with 0.1.5 Beta 2.2. and Unity 5.1.3. Used the RTL support asset too and with some manual fiddling the Arabic text displays properly as far as I can see (I have a JPG of the text as a comparison). Copy pasting the processed string to a UI TMP object also works. Mixed LTR/RTL in a text is problematic, but maybe I won't need that.
« Last Edit: October 01, 2015, 02:12:16 AM by Brain »

daterre

  • Newbie
  • *
  • Posts: 8
Re: RTL Support in auto line breaks/wrapping
« Reply #27 on: February 10, 2016, 03:58:21 AM »
Hi,

2 questions:
1. Does the RTL beta work for the UGUI component as well?
2.Is a version of the RTL beta for Unity 4.7 or 5.2+, I'd be happy to provide some feedback, I need it for Hebrew which I believe is more straightforward than Arabic.

Thanks!
« Last Edit: February 10, 2016, 08:06:06 AM by daterre »

Stephan B.

  • Administrator
  • Hero Member
  • *****
  • Posts: 5687
Re: RTL Support in auto line breaks/wrapping
« Reply #28 on: February 10, 2016, 12:28:01 PM »
Hi,

2 questions:
1. Does the RTL beta work for the UGUI component as well?
2.Is a version of the RTL beta for Unity 4.7 or 5.2+, I'd be happy to provide some feedback, I need it for Hebrew which I believe is more straightforward than Arabic.

Thanks!

RTL will be available for both text components in the next release for Unity 5.0 ~ 5.1 and Unity 5.2 ~ 5.4.

ARafay

  • Full Member
  • ***
  • Posts: 133
Re: RTL Support in auto line breaks/wrapping
« Reply #29 on: March 24, 2016, 05:01:13 AM »
I am going to need some input on how best to implement support for Right to Left. It looks like there are a few ways this could be implemented.

1. I can modify the text component to layout the text Right to Left. So as you type each character, they flow right to left and word wrapping works as expected. However, given the Unity text input box is left to right, the text in it for Right to Left languages is backwards. If you only paid attention to the text output on screen, this would behave as expected (minus) potential character substitution rules.


(Attachment Link)

2. Alternatively, the Arabic Support plugin could be used which re-formats the text where you can read it in the text input box however, this makes parsing the text and doing layout and warping more complex since the characters in the string are not sequential. Ie. the first character in the string is the last character of the first line and as more lines are displayed and wrapping needs to occur this gets more complex.

It seems to me that method 1 where the characters are entered right to left and flow naturally along with wrapping is the better choice. It seems like implementing some editor script that flips the text in the text input box to mirror the Right to Left while keeping the source input intact might be a better choice.

Update - Just for testing I added a Text Box showing the Source text reversed.

(Attachment Link)

This means that text input filtering for character substitution would also have to be implemented.

What do you guys think?

Can you provide me with a few short lines and sentences and text to work with? I would like to be able to copy paste those. Please also include some visual references.


Update 2 I guess I could use the Right to Left Text Input Box to make it possible to paste text from the Arabic Support plugin. Since this plugin expects the layout to be done Left to Right and reverses the text, I would have to re-reverse his text. Do you know if there is a way to get the text from this plugin not reversed (ie. Right to left sequence)?

(Attachment Link)

Bottom image is from the Arabic Support plugin, Top is in TextMesh Pro and word wrapped.



Hi Stephan,

Can you please tell me how did you generate this Arabic Text?
- What font and Range did you use to generate font asset
- In short, how can i achieve same thing?
« Last Edit: March 24, 2016, 07:41:33 AM by manofspirit »