Skip to main content

Custom Font

Given the perspective of multilingual or unified UI design, it is required to change the LEVEL INFINITE PASS font to the game font. This section introduces the setup method.

note

The replacement font resource needs to support Roman characters.

Font

Unity does not provide font resource files by default. Before opening the LI PASS interface, call the SetPriorityFont API to change the font.If not specifically specified, Unity Arial font is used by default.

note

Arial font used by Unity cannot display Thai correctly on iOS. See the relevant topic on Unity Issue Tracker for details.
If Thai needs to be displayed, it is recommended to use other specialized Thai font resources.For more details on configuration, please refer to Multilingual Font.

Acceptance

Run the game in the editor or on a physical device to verify whether the font has changed as expected.

For example, the default font Lato has been updated to Tencent Sans.

Lato:

Tencent Sans:

Multilingual Font

To solve the problem of fonts not being displayed correctly in different character encodings, add default fonts to imported fonts in the FontName field.

FontNames Format: FontName1, FontName2, FontName3

Image Font

For more information, see Font assets.

When Unity tries to render text with a dynamic font but cannot find the font (because Include Font Data is not selected and the font is not installed on the user's computer) or the font does not contain the requested glyph (such as trying to render text in East Asian script using Latin fonts, or using bold/italic glyph text), it will try each font listed in the Font Names field. Checking whether it can find a font that matches the project font name (including font data) or whether the font installed on the user's computer has the requested glyph.If no listed backup fonts can be found or these fonts do not have the requested glyph, Unity will fall back to a hard-coded global fallback font list that includes various international fonts usually installed on the current runtime platform.

— Unity Documentation

Multilingual Font Acceptance

Run the game in the editor or on a physical device to verify whether the font has changed as expected.

If only one font is used in the game, you can directly switch between two languages to test the multilingual adaptation of the UI interface.

If the game is configured with different fonts for different languages, it is recommended to switch between languages that use different fonts for acceptance testing.
For example, English and Chinese use font A, while Thai uses font B.Acceptance testing can switch between English (font A) and Thai (font B) to confirm effect.

Below is an example of the same font adapted to both Chinese and English:

English:

Chinese: