FontAssets created with TMP_FontAsset.CreateFontAsset do not render correctly on Android

Unity Version : 2021.3.17f LTS

When using CreateFontAssetFromFamily on Android, fonts are rendered with strange spaces.

The device tested is the Galaxy Z Fold II and the screenshots are as follows.
8964147--1231740--Screenshot_20230421_152312_Brick Shooter  World Tour.jpg
8964147--1231734--Screenshot_20230421_152843_Brick Shooter  World Tour.jpg

And this problem seems to happen when the text is long.
8964147--1231737--Screenshot_20230421_152318_Brick Shooter  World Tour.jpg

The specified Font Family is Roboto - Regular and the last shot shows the difference from the regular LiberationSans SDF.
(The one labeled Test below is a LiberationSans SDF pre-built in the editor)
8964147--1231731--Screenshot_20230421_154936_Brick Shooter  World Tour.jpg

The code used is roughly this

var asset = TMP_FontAsset.CreateFontAsset
    familyName: "Roboto",
    styleName: "Regular",
    pointSize: 90

For a CreateFontAsset function that specifies a Font Family, there are limited additional parameters that can be specified here.

How can I solve this problem?

Note 1. I have never encountered this issue in the Unity Editor (macOS, Windows) and the standalone player Windows.

Note 2. I used the DeepL translator, so the context may be a bit awkward.

Note 3. I am trying to use the CreateFontAsset function at runtime for text localization. The only Android phone I have is the Galaxy Z Fold 2, so I don't know the results on other Android phones yet.

Note 4. TMP version = 3.2.0-pre.4

I left out some important information in the previous post.

The fonts I created with CreateFontAsset are working with fallbackFontAssetTable.

I first prepared NotoSans with the built-in dummy and set the Atlas Population Mode to Dynamic OS.

Then I set up the following fallback to actually replace those fonts with the system fonts.

var asset = TMP_FontAsset.CreateFontAsset
    familyName: "Roboto",
    styleName: "Regular",
    pointSize: 90

if (null == builtInFont.fallbackFontAssetTable)
    builtInFont.fallbackFontAssetTable = new List<TMP_FontAsset>();


This causes text rendering issues on Android (Galaxy Z Fold 2).

Hi, could you please file a bug report

Ten minutes ago I created a new sample project, successfully reproduced the issue and submitted a bug report.

Now I'm waiting for a confirmation email.

Also, I didn't specify the TMP version in the first post, it's 3.2.0-pre.4.

1 Like

I'll share a sample here as well.

How to reproduce the issue

Step 1
Download the sample project and open it with Unity 2021.3 LTS version

Step 2
Build the SampleScene on Android

I expect the same issue to always occur when running the build on the Galaxy Z Fold 2.

I'm also curious if this happens on other phones as well. (1.81 MB)

Noto Sans CJK KR did not have the problem.

So far, we've found that this only happens on Android's "Roboto", so it seems to be a "specific font issue".

So for now, I think I can specialize to not put certain fonts in the fallback.
(It's a little scary not knowing everything about case-by-case if a particular font will cause problems on a particular device)

And I was wondering if it is normal for this to happen when TMP encounters certain fonts.