Skip to content

Fonts

Game fonts

You must upload all fonts used in your game interface to the fonts directory.

Fonts in your fonts directory are loaded in each player's browser when they load the game. Font formats are prioritized in this order: woff2 > woff > otf > ttf. For fonts to be deployed correctly, their filenames should not contain spaces or special characters.

You can then use them by setting font-family to the filename without its extension, with dashes replaced by spaces. You do not need to declare a @font-face rule.

The fonts should be freeware. Please include a .txt file with the license information alongside the font files.

Examples

With a file named custom-font.woff2 in the fonts directory:

  .element-with-custom-font {
    font-family: 'custom font';
  }

With a file named custom-font-bold.woff2 in the fonts directory:

  .element-with-custom-font-bold-solution1 {
    font-family: 'custom font';
    font-weight: bold;
  }
  .element-with-custom-font-bold-solution2 {
    font-family: 'custom font bold';
  }

Debugging

In your browser's developer console, run document.getElementById('bga-auto-declared-font-faces') to inspect the fonts preloaded by the framework.