Changes

1,127 bytes added ,  02:51, 26 November 2021
→‎Provide the font files: make example self-contained
Line 205: Line 205:  
Now you just need to make them available through the game's <samp>Content/Fonts</samp> folder. Make sure the target for the <samp>.fnt</samp> file matches what you specified via <tt>UseFontFile</tt> in the [[#Add a custom language|language data]], and the target for the image matches what you specified via <samp>pages</samp> in the [[#Font files|font data]].
 
Now you just need to make them available through the game's <samp>Content/Fonts</samp> folder. Make sure the target for the <samp>.fnt</samp> file matches what you specified via <tt>UseFontFile</tt> in the [[#Add a custom language|language data]], and the target for the image matches what you specified via <samp>pages</samp> in the [[#Font files|font data]].
   −
For example, using Content Patcher:
+
For example, here's the previous Esperanto example with a custom font (note the <samp>UseLatinFont</samp> and <samp>FontFile</samp> fields in the language data, and the two new patches at the bottom):
<syntaxhighlight lang="js">
+
{{#tag:syntaxhighlight|
 
{
 
{
     "Format": "1.23.0",
+
     "Format": "{{Content Patcher version}}",
 
     "Changes": [
 
     "Changes": [
 +
        // define language
 +
        {
 +
            "Action": "EditData",
 +
            "Target": "Data/AdditionalLanguages",
 +
            "Entries": {
 +
                "Pathoschild.Esperanto": { // for technical reasons, you need to specify the ID here *and* in the "ID" field
 +
                    "ID": "Pathoschild.Esperanto",
 +
                    "LanguageCode": "eo",
 +
                    "ButtonTexture": "Mods/Pathoschild.Esperanto/Button",
 +
                    "UseLatinFont": false,
 +
                    "FontFile": "Fonts/Esperanto",
 +
                    "TimeFormat": "[HOURS_24_00]:[MINUTES]",
 +
                    "ClockTimeFormat": "[HOURS_24_00]:[MINUTES]",
 +
                    "ClockDateFormat": "[DAY_OF_WEEK] [DAY_OF_MONTH]"
 +
                }
 +
            }
 +
        },
 +
 +
        // load button texture
 +
        {
 +
            "Action": "Load",
 +
            "Target": "Mods/Pathoschild.Esperanto/Button",
 +
            "FromFile": "assets/button.png"
 +
        }
 +
 
         // load font files
 
         // load font files
 
         {
 
         {
 
             "Action": "Load",
 
             "Action": "Load",
             "Target": "Fonts/YourLanguage",
+
             "Target": "Fonts/Esperanto",
             "FromFile": "assets/YourLanguage.fnt"
+
             "FromFile": "assets/Esperanto.fnt"
 
         },
 
         },
 
         {
 
         {
 
             "Action": "Load",
 
             "Action": "Load",
             "Target": "Fonts/YourLanguage_0",
+
             "Target": "Fonts/Esperanto_0",
             "FromFile": "assets/YourLanguage_0.png"
+
             "FromFile": "assets/Esperanto_0.png"
 
         }
 
         }
 
     ]
 
     ]
}
+
}|lang=javascript}}
</syntaxhighlight>
      
==See also==
 
==See also==
translators
8,404

edits