Author Topic: Fallback Font Asset List on TMP text object  (Read 2695 times)

yuewah

  • Jr. Member
  • **
  • Posts: 64
Fallback Font Asset List on TMP text object
« on: May 30, 2018, 12:39:15 AM »
Is it possible to add Fallback Font Asset List on TMP text object, just like Sprite Asset ?
for some reason, we can't use the <font="FontName" material="Material"> tag.

Stephan B.

  • Administrator
  • Hero Member
  • *****
  • Posts: 5687
Re: Fallback Font Asset List on TMP text object
« Reply #1 on: May 30, 2018, 01:01:17 AM »
Is it possible to add Fallback Font Asset List on TMP text object, just like Sprite Asset ?
for some reason, we can't use the <font="FontName" material="Material"> tag.

The <font> tag is used to change / use multiple font assets in the same text object.

The fallbacks are used to locate missing characters for a given font asset which indirectly results in using other font assets in the same text object but how this is triggered is very different.

What is the use case for assigning a list of fallbacks to a text object?


yuewah

  • Jr. Member
  • **
  • Posts: 64
Re: Fallback Font Asset List on TMP text object
« Reply #2 on: May 30, 2018, 07:39:05 PM »
the use case is similar to Sprite Asset that allow fallback in TMP text object level instead of global level.
e.g
case 1: Chinese Font A fallback to English Font A (Default)
case 2: Chinese Font A fallback to English Font B

for localize text, we want to simplify the text that don;t use <font> tag to support case 2.

Stephan B.

  • Administrator
  • Hero Member
  • *****
  • Posts: 5687
Re: Fallback Font Asset List on TMP text object
« Reply #3 on: May 31, 2018, 12:59:29 AM »
the use case is similar to Sprite Asset that allow fallback in TMP text object level instead of global level.
e.g
case 1: Chinese Font A fallback to English Font A (Default)
case 2: Chinese Font A fallback to English Font B

for localize text, we want to simplify the text that don;t use <font> tag to support case 2.

Just trying to make sure I fully understand.

What is the case for Chinese Font A fallback to English Font A and then in case 2 going from the same Chinese Font A to a different English Font? What is the difference between English Font A and English Font B?

yuewah

  • Jr. Member
  • **
  • Posts: 64
Re: Fallback Font Asset List on TMP text object
« Reply #4 on: May 31, 2018, 04:51:24 AM »
just two different fonts which are generated by different .ttf

Stephan B.

  • Administrator
  • Hero Member
  • *****
  • Posts: 5687
Re: Fallback Font Asset List on TMP text object
« Reply #5 on: May 31, 2018, 11:35:37 AM »
just two different fonts which are generated by different .ttf

In your example, you are going form the same Chinese Font A to two different English fonts. What defines whether you want to fallback to English Font A or English Font B?

Normally the fallback only occurs when there is a missing glyph. So if your Chinese Font A is assigned as Primary and you then type the letter A, the fallback system would use the first font asset assigned in the fallback list of the Chinese Font A that contains the letter A.

In TMP, you can currently assign fallbacks per Font Assets which are specific to that font asset or via the TMP Settings where those are general.

In your case, you want to use the same Chinese Font Asset to which the English A could be assigned as fallback but then you also want to switch that sometimes to English Font B.

Again in trying to understand the use case, do you have text objects in the scene that would be using Chinese Font A - falling back to English A as well as Chinese Font A - falling back to English B? If no, you could via script change what font asset is assigned as fallback to this Chinese Font A. At load time, you could even populate the fallback list of these font assets. There are several TMP user who do that in conjunction with using Asset Bundles.

yuewah

  • Jr. Member
  • **
  • Posts: 64
Re: Fallback Font Asset List on TMP text object
« Reply #6 on: May 31, 2018, 07:28:12 PM »
we need two text coexist in the same scene, so having script to change the fallback list of font asset is not possible.

Stephan B.

  • Administrator
  • Hero Member
  • *****
  • Posts: 5687
Re: Fallback Font Asset List on TMP text object
« Reply #7 on: June 01, 2018, 01:31:54 AM »
we need two text coexist in the same scene, so having script to change the fallback list of font asset is not possible.

I am still trying to figure out what the use case is for going from Chinese Font A to English A and then Chinese Font A to English B? Why switch to a different English Font Asset from the same Chinese Font?

yuewah

  • Jr. Member
  • **
  • Posts: 64
Re: Fallback Font Asset List on TMP text object
« Reply #8 on: June 01, 2018, 02:03:51 AM »
we have many mini games with different art style using different english font.
when doing localization e.g. Chinese, we only use one chinese font for all mini games to simpify the work load, however, the localized text still contain some english characters, so we want to fallback to different english font.