Skip to content

Commit ac4f55c

Browse files
authored
Merge pull request #20 from shotstack/derk/font-family-guidance
[2/2] docs: document filename-first font.family and Roboto fallback
2 parents 2c06c4f + 59a5871 commit ac4f55c

4 files changed

Lines changed: 14 additions & 10 deletions

File tree

‎skills/shotstack/references/fonts.md‎

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,11 @@ Load a font from a public URL via `timeline.fonts[]`, then reference its **file
3232
}
3333
```
3434

35-
The `font.family` value is the URL's filename without extension, and it **must** match the URL's basename exactly. For URL `https://fonts.gstatic.com/s/montserrat/v31/JTUSjIg1_i6t8kCHKm45xW5rygbi49c.ttf`, family = `JTUSjIg1_i6t8kCHKm45xW5rygbi49c`. If `family` and the URL basename diverge, the font silently fails to load.
35+
The `font.family` value is the URL's filename without extension, matched ignoring case (a `-Regular` or `-Bold` style suffix can also be dropped). For URL `https://fonts.gstatic.com/s/montserrat/v31/JTUSjIg1_i6t8kCHKm45xW5rygbi49c.ttf`, family = `JTUSjIg1_i6t8kCHKm45xW5rygbi49c`.
36+
37+
The family name stored inside the font file also matches, but it isn't always the name on Google Fonts: a variable font whose default weight isn't Regular stores the weight too (Space Grotesk's file calls itself `Space Grotesk Light`). Prefer the filename, which can't differ from what you loaded.
38+
39+
A `font.family` that matches nothing renders in Roboto without a render error. The exception is a lone entry in `timeline.fonts[]`, which is used whatever `font.family` says, so a wrong name stays hidden until a second font is added. `shotstack validate` warns on any `font.family` that isn't a built-in or a loaded filename.
3640

3741
## Verified font catalogue
3842

@@ -77,9 +81,9 @@ These twelve fonts are pre-installed in the render engine and don't need a `time
7781

7882
The renderer accepts both spaced (`Open Sans`) and concatenated (`OpenSans`) family names for these.
7983

80-
## Why system fonts fail
84+
## Why system fonts don't work
8185

82-
System fonts like `Arial`, `Helvetica`, `Times New Roman`, `Courier New`, etc. are **not installed** on the render engine. Using them produces a "Font not found" error at render time.
86+
System fonts like `Arial`, `Helvetica`, `Times New Roman`, `Courier New`, etc. are **not installed** on the render engine. Text set in them renders in Roboto, with no render error.
8387

8488
**Wrong:**
8589

‎skills/shotstack/references/timeline.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ Custom fonts loaded from a URL, available to all `rich-text` and `rich-caption`
114114
}
115115
```
116116

117-
The `font.family` you reference in an asset must be the **basename of the file** (without `.ttf`/`.otf`/`.woff`).
117+
Reference a loaded font in `font.family` by the **basename of the file** (without `.ttf`/`.otf`/`.woff`). It always matches; a family that matches nothing renders in Roboto without an error.
118118

119119
For the Montserrat URL above, `font.family` is `JTUSjIg1_i6t8kCHKm45xW5rygbi49c`.
120120

‎skills/shotstack/references/troubleshooting.md‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ Common errors and the fix for each. **Catch most of them before rendering:** `sh
77
- "Unknown property: alignment" / wrong property names
88
- "Invalid option: expected one of top|middle|bottom"
99
- Video looks stretched / squishing after rendering
10-
- "Font not found"
10+
- Text renders in Roboto instead of your font
1111
- Captions cover the whole frame
1212
- Clips flicker / "clips overlap" on one track
1313
- Timeline renders but layers are wrong
@@ -54,11 +54,11 @@ The Shotstack `fit` enum is **inverted from CSS**:
5454

5555
**Fix:** use `fit: "crop"` (or omit `fit` — `crop` is the default) for the typical "scale and crop" behaviour you'd expect from CSS `object-fit: cover`.
5656

57-
## "Font not found"
57+
## Text renders in Roboto instead of your font
5858

59-
You used a font name that isn't in the built-in list and didn't load it via `timeline.fonts[]`.
59+
`font.family` didn't match any font, so the renderer fell back to Roboto without an error. Either the font isn't built in and wasn't loaded via `timeline.fonts[]`, or `family` doesn't match the loaded font: a typo, or a name that differs from the one stored in the font file.
6060

61-
**Fix:** add the font URL to `timeline.fonts[]` and use the file basename as `family`. See `references/fonts.md`. If you really need a system font, use `Roboto` (built-in) as a substitute.
61+
**Fix:** add the font URL to `timeline.fonts[]` and use the file basename as `family`. `shotstack validate` flags a `family` that isn't a built-in or a loaded filename. See `references/fonts.md`. If you really need a system font, use `Roboto` (built-in) as a substitute.
6262

6363
## Captions cover the whole frame
6464

‎skills/shotstack/shared/agent-core.md‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -264,7 +264,7 @@ One overlay is a `rich-text` job. **Several videos "in different styles" is not*
264264

265265
## Fonts
266266

267-
Use **custom Google Fonts via `timeline.fonts[]`**. System fonts (`Arial`, `Helvetica`, `Times New Roman`) are NOT installed and will fail with "Font not found".
267+
Use **custom Google Fonts via `timeline.fonts[]`**. System fonts (`Arial`, `Helvetica`, `Times New Roman`) are NOT installed; text set in them renders in Roboto, with no render error.
268268

269269
**CRITICAL: Do NOT construct or fabricate Google Fonts URLs from memory.** Google rotates them (`v26 → v31 → ...`) and the hash filenames change with each version. Any URL you reconstruct from training data is almost certainly a 404. **Use ONLY the verified entries below, copied verbatim.**
270270

@@ -313,7 +313,7 @@ Variable fonts cover the full weight range (100–900) from a single URL — set
313313
}
314314
```
315315

316-
The `font.family` value MUST match the `family` column in the table above (it's the filename basename without `.ttf`). If `family` and the URL's basename don't match, the font will not load.
316+
Use the `family` column from the table above: the URL's filename without `.ttf`, matched ignoring case. The family name stored inside the font file also matches, but it isn't always the name on Google Fonts (Space Grotesk's file calls itself `Space Grotesk Light`), so the filename is the safe choice. A `font.family` that matches nothing renders in Roboto with no error. The exception is a lone entry in `timeline.fonts[]`, which is used whatever `font.family` says, so a wrong name only shows once a second font is added. `shotstack validate` warns on any `font.family` that isn't a built-in or a loaded filename.
317317

318318
## Top 5 mistakes
319319

0 commit comments

Comments
 (0)