Learn how to include custom fonts in a theme that content creators can use in rich text fields.
fonts
folder that contain the custom font files and font.json
config file. This folder and its contents can be named and structured in any way.font.json
file within the fonts
folder that defines the font and its variations for use in the theme.theme.json
, a custom_fonts
array containing a list of paths to the font folders within the theme.fonts
folder, include a font.json
file that defines the font and its variations for use in the theme.
Parameter | Type | Description |
---|---|---|
name | String | The name of the font. |
default | String | The name of the font variant to use as the default, as specified in the variants array. If no default is specified, HubSpot will automatically designate the first variant in the variants array as the default. |
fallback | String | Comma-separated fallback fonts to be appended to the end of the custom font CSS. For example, "fallback:": 'Times New Roman', serif" will result in: font-family: 'Custom font', 'Times New Roman', serif . |
variants | Array | A list of font variants, including the default font. For each variant, include the following fields:
|
file
property.
For example, if you had a single variable font file (myfont.ttf
), which contained the bold and italic versions, you would format your font.json
file as follows:
files
array for that variant instead of styles
.
font.json
file, you’ll add a custom_fonts
array listing the paths to the font
folder within the theme.