TextMesh Pro: Using <font="fontAssetName">-tags with different font per language

More
5 years 5 months ago #3889 by paulsamson
Thanks for a great plugin!

I'm using it with TextMesh Pro - and in TextMesh Pro I use the <font="fontAssetName">-tags to change fonts in the middle of a text.

However now I'm starting to localize to non-latin langs, so I need different fonts for those langs - and using secondary terms for that. But how does I get that to play well with the <font="fontAssetName">-tags?

(Those tags only point to a single font file...)

Thanks in advance!

Please Log in or Create an account to join the conversation.

More
5 years 5 months ago #3890 by Frank
You can use parameters:
inter-illusion.com/assets/I2LocalizationManual/Parameters.html

Basically, just replace your font name with a parameter tag and then have a global parameter manager that returns the correct font depending on the language:

e.g. your text:
'xxxxxx <font="{[Font1]}"> xxxx'

and your manager:
public virtual string GetParameterValue( string ParamName )
{
   if (ParamName == "Font1") 
	return LocalizationManager.GetTranslation("Font1");

   return null; // not found is defined null, not ""
}

Then, create a term named "Font1" and set the corresponding font for each language

Another alternative if you need even more control is to use callbacks to detect those cases and apply any change you need to the text:
inter-illusion.com/assets/I2LocalizationManual/Callbacks.html

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

Please Log in or Create an account to join the conversation.

Time to create page: 0.160 seconds
Template by JoomlaShine