Change your App Font

The default font for apps is Fira Sans. This font can be changed to any other system font, or to a custom font that is uploaded to the app. System fonts need to be installed on a user's device in order for it to display in an app. If a font is specified that is not installed on a user's device, the app font will fall back to the default.

Since version 4.88.0 of the JourneyApps Runtime, it is possible to upload custom fonts into an app, and thereby ensure that the specified font displays for all users. When using custom fonts, the font does not have to be installed on a user's device since it will be included in the JourneyApps Runtime. See the Custom Fonts section below for more information.

System Fonts

To override the default font of your application ensure you have the Show configuration files setting enabled in OXIDE, and then follow these steps:

  1. Open your app's config.json file using the command palette, or

    1. Select the Overview workspace (top left)

    2. In the App Tree panel, expand Other

    3. Select the config.json file

  2. Use OXIDE's autocomplete to add the top-level font_override property to the file if it does not yet exist

  3. The font_override property takes the app's font name as its value

    1. For example, if the app's font should be Arial, specify it as "font_override": "Arial"

  4. Deploy your app

Example extract from the config.json file:

config.json
{
    "themes": [
        ...
    ],
    ...
    "font_override": "Arial" 
}

Note

  • Setting the font_override property overrides the font of the entire app. The Custom Fonts section below explains how the font of an individual component can be changed.

  • In a testing environment, you may need to restart the app for changes to take effect.

Custom Fonts

Version compatibility

  • This feature was introduced in version 4.88.0 of the JourneyApps Runtime.

  • In TypeScript apps the runtime-build version must be 2.1.8 or greater.

Current limitations

  • Only .ttf font files are currently supported

Custom fonts can be configured as follows:

Step 1: Upload the font asset

Upload the font's .ttf file as an asset to your app using OXIDE. You can trigger the Upload assets action using the command palette, or by opening the Assets panel and dragging the font file into the Assets folder:

All fonts will automatically be organized into a fonts subfolder. A preview of the font can be viewed when selecting it from the list:

Hover over a glyph to view its HTML code, and click to copy the code to your clipboard. These can be used to display special characters on a view.

Step 2: Apply the font asset

Next, we need to configure our app to use the font asset. These steps are very similar to setting a System Font, but contain a few additional steps.

  1. Open your app's config.json file (see the System Fonts instructions for more details)

  2. Use OXIDE's autocomplete to add the top-level fonts property to the file if it does not yet exist. This is an array containing a list of font objects.

  3. A font object declares the name of the custom font and associates an asset with it by setting a path to the font file in the app's Assets

    1. Note: The name provided here should be unique as it will be used to reference the particular font when configuring the font override in the app.

  4. Override the font app-wide by setting the top-level font_override property (see the System Fonts instructions for more details)

  5. Deploy your app

Example extract from the config.json file:

config.json
{
    "themes": [
        ...
    ],
    ...
    "fonts": [
        {
            "name": "Roboto",
            "path": "fonts/Roboto-Regular.ttf"
        },
        {
            "name": "NotoSansBold",
            "path": "fonts/NotoSans-Bold.ttf"
        },
        {
            "name": "NotoSansMedium",
            "path": "fonts/NotoSans-Medium.ttf"
        },
        {
            "name": "NotoSansRegular",
            "path": "fonts/NotoSans-Regular.ttf"
        }
    ],
    "font_override": "NotoSansRegular" 
}

Apply a custom font to a specific component

Since version 4.88.0 of the JourneyApps Runtime, most components also have a font attribute to override the font of individual components. The font attribute accepts the name of a custom font or a system-installed font such as Arial. If any of these fonts cannot be found, Fira Sans is used as a fallback.

Example:

main.view.xml
<button font="NotoSansRegular" label="My Tickets" on-press="$:navigate.link('my_tickets')" validate="false" />

Ensure you have the Advanced theme support setting enabled in OXIDE.

Last updated