---
description: Using your own fonts in a template — why fonts must be bundled under assets/fonts, the @font-face rule for each file with the right format, weight and style, and the font-display setting for signs.
---

# Fonts

Linking fonts through external scripts or Content Delivery Networks (CDNs) such as [Google Fonts](https://fonts.google.com/) may not work when displaying the preview or on the digital sign. Therefore, any custom fonts must be downloaded and placed inside the `assets/fonts` folder and defined as custom font faces in your CSS file.

Signs cache the template's own files and may run without internet access; a font that
has to be fetched from a CDN is the most common reason a sign falls back to Arial.

## Bundling the files

Put the font files under `assets/fonts/`, one subfolder per family if you have several
(`assets/fonts/roboto/Roboto-Regular.woff2`). `.woff2` is the smallest and the format to
prefer; `.woff` and `.ttf` also work. Bundle only the weights and styles the template uses —
a family's twelve files add up.

## Declaring them

Each file gets one `@font-face` rule at the top of `styles.css`:

```css
@font-face {
  font-family: "Roboto";
  src: url("./assets/fonts/roboto/Roboto-Regular.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: block;
}

@font-face {
  font-family: "Roboto";
  src: url("./assets/fonts/roboto/Roboto-BoldItalic.woff2") format("woff2");
  font-weight: 700;
  font-style: italic;
  font-display: block;
}
```

| Property | Value |
| --- | --- |
| `font-family` | The name you will use in your CSS; the same name for every file of a family |
| `src` | The relative path, with `format("woff2")`, `format("woff")` or `format("truetype")` for `.ttf` |
| `font-weight` | The weight the file holds (see the table) |
| `font-style` | `normal` or `italic` |
| `font-display` | `block`: the text waits for the font instead of flashing a fallback. Since the sign pre-caches the files, the wait is negligible |

Weights by their usual names:

| Name | `font-weight` |
| --- | --- |
| Thin / Hairline | 100 |
| Extra Light / Ultra Light | 200 |
| Light | 300 |
| Regular / Normal | 400 |
| Medium | 500 |
| Semi Bold / Demi Bold | 600 |
| Bold | 700 |
| Extra Bold / Ultra Bold | 800 |
| Black / Heavy | 900 |

Then use the family as usual, with a generic fallback:

```css
html,
body {
  font-family: "Roboto", sans-serif;
}
```

If a weight you use in the CSS has no matching `@font-face`, the browser synthesizes it
from the nearest one, which looks worse than the real file — declare every weight you use.

## Related

- [Getting started with templates](../getting_started.md)
- [Background and banner images](layout_assets_configuration.md)
- [Testing and troubleshooting templates](../testing_troubleshooting.md) — when text shows in a fallback font
