Bug fix for TextMesh pro and RTL
8 years 3 weeks ago - 8 years 3 weeks ago #2139
by mcmorry
Bug fix for TextMesh pro and RTL was created by mcmorry
Hi,
I found and fixed a bug connected with Text Mesh Pro and Arabic text.
Wen Text Mesh Pro try to wrap an RTL fails if the isRightToLeftText property is not set.
What I did to resolve it, was to change inside the LocalizeTextMeshPro file, the two methods DoLocalize_TMPLabel and DoLocalize_TMPUGUILabel.
After setting the alignment I also set the isRightToLeftText property of TMP.
The issue is that after doing this TMP expects to receive the text reversed. I don't know why, but I found this solution in his forum: forum post
Here is the code for the two metods:
I also added somewhere in the file the ReverseText method:
Let me know if you foresee some issue after this change and if you can integrate it in next versions.
I found and fixed a bug connected with Text Mesh Pro and Arabic text.
Wen Text Mesh Pro try to wrap an RTL fails if the isRightToLeftText property is not set.
What I did to resolve it, was to change inside the LocalizeTextMeshPro file, the two methods DoLocalize_TMPLabel and DoLocalize_TMPUGUILabel.
After setting the alignment I also set the isRightToLeftText property of TMP.
The issue is that after doing this TMP expects to receive the text reversed. I don't know why, but I found this solution in his forum: forum post
Here is the code for the two metods:
mTarget_TMPLabel.alignment = LocalizationManager.IsRight2Left ? mAlignmentTMPro_RTL : mAlignmentTMPro_LTR;
mTarget_TMPLabel.isRightToLeftText = LocalizationManager.IsRight2Left;
if (LocalizationManager.IsRight2Left) MainTranslation = ReverseText(MainTranslation);
I also added somewhere in the file the ReverseText method:
string ReverseText(string source) {
char[] output = new char[source.Length];
for (int i = 0; i < source.Length; i++)
{
output[(output.Length - 1) - i] = source[i];
}
return new string(output);
}
Let me know if you foresee some issue after this change and if you can integrate it in next versions.
Last edit: 8 years 3 weeks ago by mcmorry.
Please Log in or Create an account to join the conversation.
8 years 3 weeks ago #2140
by Frank
Are you
Give I2L
5 stars!
Are you
Please lets us know how to improve it!
Replied by Frank on topic Bug fix for TextMesh pro and RTL
Hi,
Thanks a lot for finding a solution to this.
I verified it and added the fix to v2.6.11b4, which is now in the beta folder.
Thanks!
Frank
Thanks a lot for finding a solution to this.
I verified it and added the fix to v2.6.11b4, which is now in the beta folder.
Thanks!
Frank
Are you

Are you

To get the betas as soon as they are ready,
check this out
The following user(s) said Thank You: mcmorry
Please Log in or Create an account to join the conversation.
Time to create page: 0.131 seconds