Customize Font
Player Network allows you to change the font of the LEVEL INFINITE PASS login widget. Follow the instructions in this article to customize the login widget for your game client.
Font
- Unity
- Unreal Engine
Unity does not provide font asset files by default, call the SetPriorityFont
API to change fonts before opening the LI PASS UI. If not specified, Unity Arial font is used by default.
The Arial font used in Unity is unable to render Thai properly on iOS, more details regarding the issue can be found from the Unity Issue Tracker.
If Thai display is required, other specialized Thai font assets are recommended for accurate display. For information regarding configurations, see Multilingual fonts.
Unreal Engine Font Asset Description
Unreal Engine font files are divided into Font Assets (Font) and Font Face Assets (Font Face). For more information, see Font Asset and Editor.
The font asset file is smaller and is referenced by the UMG blueprint as shown in the following image for Lato.uasset
.
Font face asset files are large, hold font data, and are referenced by font asset. The same font face asset can be reused among multiple font assets. Such as the Lato-Bold.uasset
font face asset used in the Lato.uasset
font asset as shown in the following image.
You can check the font reference relationships through the Reference Viewer.
Manually replacing Unreal Engine fonts
Preparation
Prepare the font asset (font) to be replaced and put it into the font directory of the project. Take Stainless font asset as an example, open the editor and compile the Stainless.uasset
file.
Back up the Stainless font asset file (Stainless.uasset
) in the folder, record the file location, and then delete the Stainless font asset file.
The backed up font asset file will be used to replace the font.
It is recommended to manually backup and delete the fonts in the folder, the font asset reference will not change. If you delete the font asset in the editor, it will cause the font reference to change and may fail to replace the font.
Modify the LI PASS font asset file
Find the Lato font asset file used by LI PASS in the editor.
Rename the Lato font asset in the editor to the name of the font that needs to be replaced, and check the reference relationship using the Reference Viewer.
The following images is the result of modifying the name Lato to Stainless.In the editor, move the renamed Lato font (which is the current Stainless font) to the original location of the font that needs to be replaced. The editor displays a prompt to select copy or move, select move.
For example, move the Stainless font (the original Lato font) to the original location of the deleted game font Stainless (which is the file deleted and recorded in the previous step).View the reference relationships using the Reference View.
Modify the name and move the original Lato font so that the LI PASS font reference changes to point to the original location of the Stainless font to be replaced.
Replace LI PASS font asset files
Close the editor and overwrite the existing LI PASS font asset (Stainless.uasset
) file in the folder with the previously backed up font asset file (Stainless.uasset
).
It is recommended to replace the font file after closing the editor to avoid replacement failure due to file reference.
Checking LI PASS font references
Open the editor and use the Reference Viewer to check that the font references in the LI PASS UMG blueprint have been changed to the new font asset files as expected.
The fonts used for LI PASS have been completely replaced. You may confirm the changes in the interface text from the editor.
Scripting Tools to Replace Unreal Engine Fonts
Dependency on Python scripts is required. The scripting tools are provided in the INTLSample UE project.
Preparation
Prepare the font asset (font) to be replaced and put it into the font directory of the project. Take Stainless font asset as an example, open the editor and compile the Stainless.uasset
file.
Modify script configuration
Modify the configuration of the
Tools/Config.py
file in the project directory:GAME_FONT_FILE_PATH: The path of the font asset file to be replaced.
ENGINE_PATH: The engine installation path.Modify the configuration of the
Tools/RenameLIFont.py
file in the project directory to:GAME_FONT_ASSET_PATH: Path to the font asset used by the game, eg: /Game/Assets/UI/Font/Stainless.Stainless
Close the editor and execute the script command:
Execute the command in the Tools working space:
python .\LITools.py -t ReplaceLIFont -unreal 4.21
where -unreal is followed by the Unreal Engine version used for game development.
The fonts used for LI PASS have been completely replaced. You may confirm the changes in the interface text from the editor.
Font acceptance
Run the game in either the editor or on a real 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
- Unity
- Unreal Engine
To solve the problem that fonts cannot be displayed properly under different character encodings, add default fonts in the FontName fields for the imported fonts.
FontNames formats:FontName1,FontName2,FontName3
For more information, see Font assets.
When Unity tries to render text with a dynamic font, but it cannot find the font (because Include Font Data was not selected, and the font is not installed on the user machine), or the font does not include the requested glyph (like when trying to render text in east Asian scripts using a latin font, or when using styled bold/italic text), then it will try each of the fonts listed in the Font Names field, to see if it can find a font matching the font name in the project (with font data included) or installed on the user machine which has the requested glyph. If none of the listed fallback fonts are present and have the requested glyph, Unity will fall back to a hard-coded global list of fallback fonts, which contains various international fonts commonly installed on the current runtime platform.
—— Unity Documentation
To solve the problem that fonts cannot be displayed properly under different character encodings, configure the font asset to include different font families for different characters.
At present, the LI PASS default fonts, Lato and NotoSans (provided later), share a common problem in that a single font is insufficient for the display of all languages. So, it is necessary to use fonts for different encodings in conjunction with a default font to ensure the proper display of all languages.
Configure a composite font to include Lato as the default font family, with additional font families for Simplified Chinese, Japanese, Korean, Traditional Chinese CJK, and Thai. NotoSans is configured as a fallback font for the display of various languages, such as Hindi, which most fonts do not support.
Optimize default font assets
The default font asset for LI PASS includes multiple languages. For optimization, non-essential font style files may be removed, as referenced below:
File name | Description | Remarks |
---|---|---|
HuakangRoundBodyW5.uasset | Removed since LI PASS V1.14.00 | Can be deleted |
HuakangRoundBodyW5_Font.uasset | Removed since LI PASS V1.14.00 | Can be deleted |
Lato.uasset | LI PASS default font asset | Required |
Lato-Bold.uasset | LI PASS default font style | Required |
NotoSansArabic-Regular.uasset | Arabic font style used by LI PASS | Not recommended to be deleted Can be deleted if Arabic is not supported |
NotoSans-Bold.uasset | LI PASS default fallback font style | Required |
NotoSansJP-Bold.uasset | Japanese font style, removed since LI PASS V1.14.00 | Optional |
NotoSansJP-Regular.uasset | Japanese font style used by LI PASS | Not recommended to be deleted Can be deleted if Japanese is not supported |
NotoSansKR-Bold.uasset | Korean font style, removed since LI PASS V1.14.00 | Optional |
NotoSansKR-Regular.uasset | Korean font style used by LI PASS | Not recommended to be deleted Can be deleted if Korean is not supported |
NotoSansSC-Bold.uasset | Chinese font style, removed since LI PASS V1.14.00 | Optional |
NotoSansSC-Regular.uasset | Chinese font style used by LI PASS | Not recommended to be deleted Can be deleted if Chinese is not supported |
NotoSansTC-Bold.uasset | Traditional Chinese font style, removed since LI PASS V1.14.00 | Optional |
NotoSansTC-Regular.uasset | Traditional Chinese font style, removed since LI PASS V1.14.00 | Optional |
NotoSansThai-Regular.uasset | Thai font style used by LI PASS | Not recommended to be deleted Can be deleted if Thai is not supported |
Multilingual font acceptance
Run the game in either the editor or on a real device to verify whether the font has changed as expected.
If the game only has one font, it is possible to switch between two languages for testing the multilingual adaptation of the UI interface.
If the game uses different fonts for different languages, it is recommended to switch between the languages that use different fonts for acceptance testing.
For example, English and Chinese may use Font A, while Thai uses Font B. Therefore, during acceptance testing, you may choose to switch between English (Font A) and Thai (Font B) to confirm the results.
The following is an example of a single font being adapted for both English and Chinese:
English:
Chinese: