Table of Contents
When do you need this
The fonts that come with XWVM support the Latin alphabet, including the accented letters of most European languages, such as Swedish, German, Spanish and French. They don't include characters of other writing systems, for example Greek, Cyrillic, Chinese, Japanese, Korean or Arabic.
If your language needs such characters, your translation can provide its own font. The game loads it when your language is selected and unloads it when another language is selected. If your translation provides no font, the game uses only the fonts that come with it.
How it works
Your font is added as a fallback to the fonts of the game. The text is still drawn with the font of the game. The characters that font lacks are drawn with your font. As a result, Latin text keeps its original look, and your characters appear in your font.
Your font must contain all the characters your translation uses.
The language dropdown of the settings window shows each language by its own name, such as Español, when the font can draw all the characters of that name. When it can't, the dropdown shows the English name instead. With your font loaded, your language shows with its own name.
Folder layout
Create a folder with the locale code of your translation inside Localization/Fonts. Use the same code as in the names of your XLIFF and CSV files. Put your font files and a file named fonts.json in it.
Localization/
Fonts/
zh-CN/
fonts.json
IBMPlexSansSC-Medium.ttf
The Localization folder is the same one that holds your CSV and XLIFF folders:
- Windows and Linux:
<XWVM-install-dir>/XWVM_Data/StreamingAssets/Localization/ - macOS:
/Library/Application Support/XWVM Team/XWVM/StreamingAssets/Localization/
The fonts.json file
The simplest fonts.json names one font for everything:
{
"version": 1,
"default": "IBMPlexSansSC-Medium.ttf"
}
This is the file that the Chinese translation (zh-CN) uses.
A fuller example, where two kinds of text use their own fonts:
{
"version": 1,
"default": "IBMPlexSansSC-Medium.ttf",
"roles": {
"briefing-small": "SmallText.ttf",
"intro-crawl": "CrawlText.otf"
}
}
| Entry | Meaning |
|---|---|
version |
Required. Always 1. |
default |
Optional. The font for every kind of text that has no entry of its own. |
roles |
Optional. Each entry names the font for one kind of text (a "role", listed below). |
Rules for font files:
- Font files are
.ttfor.otffiles. - They sit in the same folder as
fonts.json. - Write only the file name, without any folder in it. A file name with a path is ignored.
- A role without an entry, and no
default, keeps the font of the game only.
Start with a single default font. Add roles entries when another font suits one kind of text better, for example a font that stays readable at small sizes.
Roles
A role is a kind of text in the game. Role names are case sensitive.
| Role | Text it covers |
|---|---|
ui |
Menus, settings and most windows |
ui-display |
Headings and labels in the registration desk, craft selection, pilot assignment and briefing screen |
subtitles |
Subtitles during flight |
subtitles-interaction |
The subtitle lines that describe the player's actions (when the setting for a different font is on) |
briefing |
Briefing and debriefing text |
briefing-small |
Small text in the briefing screen |
briefing-popup |
The pop-up shown when the mouse hovers a flight group icon on the briefing map |
cockpit |
Cockpit instruments, targeting computer and multifunction displays |
intro-tagline |
The "A long time ago in a galaxy far, far away" title in the intro |
intro-crawl |
The crawl text and disclaimer in the intro |
Testing your fonts
- Put your
Fonts/<locale>folder in theLocalizationfolder of your XWVM installation, as shown above. - Start the game and select your language in the settings menu. The game loads your fonts at that moment.
- Look at the texts of your language in the places where they appear. Check the menus, the briefing, the cockpit, the subtitles and the intro, since each uses a different role.
Changing the language asks for a restart of the game. Text that is already on screen keeps the font it was drawn with until then.
If something does not work, the game writes a message to its log file. On Windows the log is %USERPROFILE%\AppData\LocalLow\XWVM Team\XWVM\Player.log. Messages from this feature start with LocaleFontLoader. The game ignores the entry that causes a problem and keeps loading the rest.
| Message says | What to fix |
|---|---|
Not valid JSON |
Check commas, quotes and brackets in fonts.json. |
Missing integer 'version' |
Add "version": 1. |
Unsupported version |
Set version to 1. |
Unknown role '<name>' ignored |
The role name is misspelled. Compare with the table of roles. |
is not a plain file name |
Remove the folder from the file name. |
is not a .ttf or .otf file |
Use a .ttf or .otf font file. |
font file <path> not found |
The file name does not match a file in the folder. |
could not be turned into a font asset |
The font file could not be read. Try another font file. |
Tips
- Large fonts, such as complete Chinese or Japanese fonts, work fine. The game builds only the characters it needs while it runs.
- Choose a font with the characters of your language and a clear look at small sizes.
- Check that the license of a font allows including it with the game before you add it to your translation.