Arabic translation not connected correctly
5 years 10 months ago #3508
by elusiven
Replied by elusiven on topic Arabic translation not connected correctly
I got rid of the rectangles, which is a progress, the tool for charsets helped. Arabic displays fine now however URDU is still rendered incorrectly. I posted this also on unity forum on TMP, however no answers, no support. It seems like a problem that no one is able to solve.
Attached a screenshot with the wrong text.. It should say بنیادی
Attached a screenshot with the wrong text.. It should say بنیادی
Please Log in or Create an account to join the conversation.
5 years 10 months ago - 5 years 10 months ago #3509
by Frank
Are you Give I2L 5 stars!
Are you Please lets us know how to improve it!
Replied by Frank on topic Arabic translation not connected correctly
Hi,
The problem you are seeing seems to be related to the text not using the correct ligatures.
That can happen because of three things:
1- The ligature characters may not be present in your atlas
Remember that real text you placed is: ب ن ی ا د ی
But when rendering, some character combinations are merged using the ligatures to form بنیادی
If this is the problem, the solution is to verify the needed ligatures are in the atlas, and add them if not.
2- If The text was placed directly in the TextMeshPro component without applying the arabic fix.
If you just place the text, it will render each of the characters as is. To add the ligatures, a parser needs to run to do the adjustments. If the text is placed automatically by the Localize component, and the language is Arabic, Persian, etc. I2 Localization will automatically execute the parser and fix the text.
But if you are placing the text manually, then you need to call the parser yourself:
cmp.Text = RTLFixer.Fix("بنیادی")
3- If the parser ran, and the ligature characters are there, but they show too much or too little space, so they look apart, then thats because the font was not setting the kerning values correctly. In TMP you can select the characters and see if the kerning is right. And adjust it to make the characters come closer toguether.
Hope that helps,
Frank
The problem you are seeing seems to be related to the text not using the correct ligatures.
That can happen because of three things:
1- The ligature characters may not be present in your atlas
Remember that real text you placed is: ب ن ی ا د ی
But when rendering, some character combinations are merged using the ligatures to form بنیادی
If this is the problem, the solution is to verify the needed ligatures are in the atlas, and add them if not.
2- If The text was placed directly in the TextMeshPro component without applying the arabic fix.
If you just place the text, it will render each of the characters as is. To add the ligatures, a parser needs to run to do the adjustments. If the text is placed automatically by the Localize component, and the language is Arabic, Persian, etc. I2 Localization will automatically execute the parser and fix the text.
But if you are placing the text manually, then you need to call the parser yourself:
cmp.Text = RTLFixer.Fix("بنیادی")
3- If the parser ran, and the ligature characters are there, but they show too much or too little space, so they look apart, then thats because the font was not setting the kerning values correctly. In TMP you can select the characters and see if the kerning is right. And adjust it to make the characters come closer toguether.
Hope that helps,
Frank
Are you Give I2L 5 stars!
Are you Please lets us know how to improve it!
To get the betas as soon as they are ready,
check this out
Last edit: 5 years 10 months ago by Frank.
Please Log in or Create an account to join the conversation.
5 years 10 months ago - 5 years 10 months ago #3510
by elusiven
Replied by elusiven on topic Arabic translation not connected correctly
I have replicated the issue in newest Unity 2018. Downloaded TMP Pro, I2.loc.
I've setup the font, added all the unicode including ligeratures, over 1000 characters in total.
Text is placed through translation and then added secondary translation for the font, so it should apply the fix automatically.
Same thing happens though...... Screenshot attached and also I attached the test project. Requires unity 2018.3
www5.zippyshare.com/v/I7kjEu9Z/file.html
I've setup the font, added all the unicode including ligeratures, over 1000 characters in total.
Text is placed through translation and then added secondary translation for the font, so it should apply the fix automatically.
Same thing happens though...... Screenshot attached and also I attached the test project. Requires unity 2018.3
www5.zippyshare.com/v/I7kjEu9Z/file.html
Last edit: 5 years 10 months ago by elusiven.
Please Log in or Create an account to join the conversation.
5 years 10 months ago #3511
by elusiven
Replied by elusiven on topic Arabic translation not connected correctly
Ok I managed to get a plugin that sorts the ligeratuer issue out. Is there a way to get a callback right after localization is completed to call the api to fix the ligeratures? The current callback that I'm using which is onlocalized event does nto seem to work but if I do it manually with a button then it does.
public class FixArabicUrdu : MonoBehaviour
{
private Localize _localizeCom;
// Start is called before the first frame update
void Start()
{
_localizeCom = GetComponent<Localize>();
_localizeCom.LocalizeEvent.AddListener(FixUrdu);
}
public void FixUrdu()
{
var textToParse = GetComponent<TMP_Text>().text;
GetComponent<TMP_Text>().SetText(EasyArabicCore.CorrectTextMeshPro(textToParse));
}
}
public class FixArabicUrdu : MonoBehaviour
{
private Localize _localizeCom;
// Start is called before the first frame update
void Start()
{
_localizeCom = GetComponent<Localize>();
_localizeCom.LocalizeEvent.AddListener(FixUrdu);
}
public void FixUrdu()
{
var textToParse = GetComponent<TMP_Text>().text;
GetComponent<TMP_Text>().SetText(EasyArabicCore.CorrectTextMeshPro(textToParse));
}
}
Please Log in or Create an account to join the conversation.
Time to create page: 0.187 seconds