Term order when localizing TextMesh Pro objects
9 years 1 month ago #1114
by attilam
Term order when localizing TextMesh Pro objects was created by attilam
Hi,
I've bumped into a problem where I got a huge amount of warnings from TextMesh Pro and a freeze when changing locale between English and Arabic. It complained that the font being used doesn't contain some glyph, and this for basically all characters in every object. And yet it looked like everything was in order after the switch.
Seems like the cause is in DoLocalize_TMPLabel() / DoLocalize_TMPUGUILabel() in LocalizeTextMeshPro.cs. These functions localize the main term first and then the secondary term, so first text, then font.
So all the warnings happen because TextMesh Pro tries to e.g. regenerate the mesh in Arabic with the English font still active, complains that it can't find any of the glyphs. Then the font gets updated, so everything appears correct in the end.
For the time being I have modified these functions to change the font first and it seems to work fine; could this cause any trouble? If not, could I2L be updated with this change on next version?
Thanks,
attila
I've bumped into a problem where I got a huge amount of warnings from TextMesh Pro and a freeze when changing locale between English and Arabic. It complained that the font being used doesn't contain some glyph, and this for basically all characters in every object. And yet it looked like everything was in order after the switch.
Seems like the cause is in DoLocalize_TMPLabel() / DoLocalize_TMPUGUILabel() in LocalizeTextMeshPro.cs. These functions localize the main term first and then the secondary term, so first text, then font.
So all the warnings happen because TextMesh Pro tries to e.g. regenerate the mesh in Arabic with the English font still active, complains that it can't find any of the glyphs. Then the font gets updated, so everything appears correct in the end.
For the time being I have modified these functions to change the font first and it seems to work fine; could this cause any trouble? If not, could I2L be updated with this change on next version?
public void DoLocalize_TMPLabel(string MainTranslation, string SecondaryTranslation)
{
//--[ Localize Font Object ]----------
TMPro.TextMeshProFont newFont = GetSecondaryTranslatedObj<TMPro.TextMeshProFont>(ref MainTranslation, ref SecondaryTranslation);
if (newFont!=null && mTarget_TMPLabel.font != newFont)
mTarget_TMPLabel.font = newFont;
if (!string.IsNullOrEmpty(MainTranslation) && mTarget_TMPLabel.text != MainTranslation) {
mTarget_TMPLabel.text = MainTranslation;
mTarget_TMPLabel.ForceMeshUpdate();
}
}
#if TMProBeta
public void DoLocalize_TMPUGUILabel(string MainTranslation, string SecondaryTranslation)
{
//--[ Localize Font Object ]----------
TMPro.TextMeshProFont newFont = GetSecondaryTranslatedObj<TMPro.TextMeshProFont>(ref MainTranslation, ref SecondaryTranslation);
if (newFont!=null && mTarget_TMPUGUILabel.font != newFont)
mTarget_TMPUGUILabel.font = newFont;
if (!string.IsNullOrEmpty(MainTranslation) && mTarget_TMPUGUILabel.text != MainTranslation) {
mTarget_TMPUGUILabel.text = MainTranslation;
mTarget_TMPUGUILabel.ForceMeshUpdate();
}
}
#endif
Thanks,
attila
Please Log in or Create an account to join the conversation.
9 years 1 month ago #1115
by Frank
Are you Give I2L 5 stars!
Are you Please lets us know how to improve it!
Replied by Frank on topic Term order when localizing TextMesh Pro objects
Hi,
Nice catch!
I will be updating I2L with a similar change and will switch the order for other targets as well (uGUI, NGUI, etc).
Thanks for letting me know about this issue!
Frank
Nice catch!
I will be updating I2L with a similar change and will switch the order for other targets as well (uGUI, NGUI, etc).
Thanks for letting me know about this issue!
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
The following user(s) said Thank You: attilam
Please Log in or Create an account to join the conversation.
Time to create page: 0.130 seconds