The Brand kit in Acquia Source CMS provides a central repository to manage the typography of your site. Instead of manually writing @font-face Cascading Style Sheets (CSS) or importing font packages into individual components, you can upload font files to the Brand kit a single time. Drupal Canvas generates the required CSS, loads the fonts in the editor and the published site, and provides ready-to-use code snippets for your components.
This document provides instructions about how to add, configure, and use Brand kit fonts in Drupal Canvas, including the companion Command Line Interface (CLI) workflow for teams that manage fonts in code.
To use Brand kit fonts in Drupal Canvas, ensure the following:
google, bunny, fontshare, fontsource, npm, and adobe.The Brand kit stores fonts in a single global font library shared across your entire site. Fonts are organized by font family, and each family contains multiple variants, such as different combinations of weight and style. Examples include Regular, Bold, and Italic.
After you upload a font file, Drupal Canvas reads the metadata of the file to detect the family name, weight, style, and adjustable axes for variable fonts. Drupal Canvas generates the @font-face CSS and loads the font into the editor and the front end without additional configuration.
Drupal Canvas supports static fonts, which use one file per weight and style combination, and variable fonts, which use a single file to cover a range of weights, widths, and other axes.
To open the Brand kit:
To add a font family:
Drupal Canvas uploads each file, reads the metadata, including family name, weight, style, and variable font axes, and saves the file to the Brand kit.
The @font-face CSS is generated and loaded into the editor and the published site. If a file has no readable family name, Drupal Canvas derives a name from the filename.
To add another weight or style, such as Bold or Italic, to a family:
The header displays the variant count, for example, 3 variants uploaded.
The family name is the CSS font-family value that your components reference. Select a recognizable name, such as Inter or Mona Sans.
To rename a font family:
The new name applies to every variant in the family.
For static fonts, each variant has dedicated weight and style settings.
To configure a static font variant:
Changes save as you edit.
Variable fonts expose adjustable axes detected from the font file. Instead of fixed weight and style values, you can configure each axis with a slider.
Drupal Canvas derives the CSS font-weight range and font-style from the axes. The variant label reflects the font type, such as Variable · WOFF2 or 700 Italic · TTF.
To configure a variable font variant:
wght: Weight range, such as 100 to 900wdth: Width range, such as 75 to 125opsz: Optical size range, such as 8 to 144ital or : Italic or slant settingsAfter you save, Drupal Canvas clamps values to the minimum and maximum limits of the axis.
Every selected variant displays a live preview and ready-to-use code snippets.
A font preview card renders sample text with the uploaded font and applies your current weight, style, and axis settings. Use the preview to confirm that the font displays as intended before you apply the font to components.
To review the preview:
Drupal Canvas provides two code snippets with dedicated copy buttons:
@theme {
--font-inter: "Inter", sans-serif;
}This snippet creates a font-inter utility class family.
<p class="font-inter font-[700] not-italic">
The quick brown fox jumps over the lazy dog.
</p>For a variable font, the snippet includes the axis settings:
<p class="font-inter font-[500] not-italic [font-variation-settings:'wght'_500,'opsz'_18]">
The quick brown fox jumps over the lazy dog.
</p>Drupal Canvas generates the @font-face rule. You require only the theme token and class from the snippets above.
After a font is added to the Brand kit, Drupal Canvas loads the font on the page.
To apply a font to your components:
Do not import font packages directly from JavaScript or TypeScript files of a component:
// Do not perform this in a Code Component
import '@fontsource/inter';Allow the Brand kit to load the font and reference the font by its family name or Tailwind token. This practice maintains consistent font loading across the editor and the front end and prevents duplicate font loads.
To remove a font variant:
If you remove the last variant in a family, Drupal Canvas removes the family. Font files are tracked through the File Usage API of Drupal and are removed when no font references remain.
Teams that manage fonts in source control or AI agents that configure sites programmatically can manage Brand kit fonts through code with Drupal Canvas CLI. Fonts managed through the CLI and fonts uploaded through the UI are stored in the same global Brand kit.
Brand kit synchronization is opt-in. Enable synchronization per command or with an environment variable:
npx canvas pull --include-brand-kit
npx canvas push --include-brand-kitOr set the environment variable:
export CANVAS_INCLUDE_BRAND_KIT=trueCreate a canvas.brand-kit.json file in the root directory of your project. Each font family is defined as provider-based or local:
{
"fonts": {
"defaults": {
"weights": ["400"],
"styles": ["normal"],
"subsets": ["latin"]
},
"families": [
{
"name": "Inter",
"provider": "google",
"weights": ["400", "700"],
"styles": ["normal", "italic"]
},
{
"name": "My Font",
"src": "fonts/MyFont-Regular.woff2",
"weights": ["400"],
"styles": ["normal"]
}
]
}
}Provider-based fonts use name and provider. Supported providers include google, bunny, fontshare, fontsource, npm, and adobe. The npm provider resolves @fontsource/* and @fontsource-variable/* packages from node_modules. The adobe provider requires a kit ID under providers.adobe.id. Optionally specify weights, styles, subsets, and axisDefaults, which are per-axis default overrides for variable fonts, such as "axisDefaults": { "wght": 500 }.
Local file fonts use name and src, where src is a path relative to the root directory of your project.
Use the following CLI commands to manage fonts:
canvas push --include-brand-kit: Resolves each family from the provider or local file, uploads the font files, and replaces the global Brand kit font set of the site with the contents of canvas.brand-kit.json. An empty families list clears all fonts from the Brand kit.canvas pull --include-brand-kit: Downloads the global Brand kit configuration into canvas.brand-kit.json and saves font files to a local fonts/ directory.A push and subsequent pull produce no drift, duplicates, or data loss. Provider-based variable fonts have their axes extracted and human-readable axis names added, so the Brand kit UI displays the same axis sliders as fonts uploaded through the interface.
Because a push command replaces the remote font set, maintain canvas.brand-kit.json as the single source of truth when managing fonts through code. This practice prevents a push action from removing fonts added through the UI.
@font-faceDrupal Canvas supports static fonts, which use one file per weight and style combination, and variable fonts, which use a single file to cover a range of weights, widths, and other axes.
To open the Brand kit:
To add a font family:
Drupal Canvas uploads each file, reads the metadata, including family name, weight, style, and variable font axes, and saves the file to the Brand kit.
The @font-face CSS is generated and loaded into the editor and the published site. If a file has no readable family name, Drupal Canvas derives a name from the filename.
To add another weight or style, such as Bold or Italic, to a family:
The header displays the variant count, for example, 3 variants uploaded.
The family name is the CSS font-family value that your components reference. Select a recognizable name, such as Inter or Mona Sans.
To rename a font family:
The new name applies to every variant in the family.
For static fonts, each variant has dedicated weight and style settings.
To configure a static font variant:
Changes save as you edit.
Variable fonts expose adjustable axes detected from the font file. Instead of fixed weight and style values, you can configure each axis with a slider.
Drupal Canvas derives the CSS font-weight range and font-style from the axes. The variant label reflects the font type, such as Variable · WOFF2 or 700 Italic · TTF.
To configure a variable font variant:
wght: Weight range, such as 100 to 900wdth: Width range, such as 75 to 125opsz: Optical size range, such as 8 to 144ital or : Italic or slant settingsAfter you save, Drupal Canvas clamps values to the minimum and maximum limits of the axis.
Every selected variant displays a live preview and ready-to-use code snippets.
A font preview card renders sample text with the uploaded font and applies your current weight, style, and axis settings. Use the preview to confirm that the font displays as intended before you apply the font to components.
To review the preview:
Drupal Canvas provides two code snippets with dedicated copy buttons:
@theme {
--font-inter: "Inter", sans-serif;
}This snippet creates a font-inter utility class family.
<p class="font-inter font-[700] not-italic">
The quick brown fox jumps over the lazy dog.
</p>For a variable font, the snippet includes the axis settings:
<p class="font-inter font-[500] not-italic [font-variation-settings:'wght'_500,'opsz'_18]">
The quick brown fox jumps over the lazy dog.
</p>Drupal Canvas generates the @font-face rule. You require only the theme token and class from the snippets above.
After a font is added to the Brand kit, Drupal Canvas loads the font on the page.
To apply a font to your components:
Do not import font packages directly from JavaScript or TypeScript files of a component:
// Do not perform this in a Code Component
import '@fontsource/inter';Allow the Brand kit to load the font and reference the font by its family name or Tailwind token. This practice maintains consistent font loading across the editor and the front end and prevents duplicate font loads.
To remove a font variant:
If you remove the last variant in a family, Drupal Canvas removes the family. Font files are tracked through the File Usage API of Drupal and are removed when no font references remain.
Teams that manage fonts in source control or AI agents that configure sites programmatically can manage Brand kit fonts through code with Drupal Canvas CLI. Fonts managed through the CLI and fonts uploaded through the UI are stored in the same global Brand kit.
Brand kit synchronization is opt-in. Enable synchronization per command or with an environment variable:
npx canvas pull --include-brand-kit
npx canvas push --include-brand-kitOr set the environment variable:
export CANVAS_INCLUDE_BRAND_KIT=trueCreate a canvas.brand-kit.json file in the root directory of your project. Each font family is defined as provider-based or local:
{
"fonts": {
"defaults": {
"weights": ["400"],
"styles": ["normal"],
"subsets": ["latin"]
},
"families": [
{
"name": "Inter",
"provider": "google",
"weights": ["400", "700"],
"styles": ["normal", "italic"]
},
{
"name": "My Font",
"src": "fonts/MyFont-Regular.woff2",
"weights": ["400"],
"styles": ["normal"]
}
]
}
}Provider-based fonts use name and provider. Supported providers include google, bunny, fontshare, fontsource, npm, and adobe. The npm provider resolves @fontsource/* and @fontsource-variable/* packages from node_modules. The adobe provider requires a kit ID under providers.adobe.id. Optionally specify weights, styles, subsets, and axisDefaults, which are per-axis default overrides for variable fonts, such as "axisDefaults": { "wght": 500 }.
Local file fonts use name and src, where src is a path relative to the root directory of your project.
Use the following CLI commands to manage fonts:
canvas push --include-brand-kit: Resolves each family from the provider or local file, uploads the font files, and replaces the global Brand kit font set of the site with the contents of canvas.brand-kit.json. An empty families list clears all fonts from the Brand kit.canvas pull --include-brand-kit: Downloads the global Brand kit configuration into canvas.brand-kit.json and saves font files to a local fonts/ directory.A push and subsequent pull produce no drift, duplicates, or data loss. Provider-based variable fonts have their axes extracted and human-readable axis names added, so the Brand kit UI displays the same axis sliders as fonts uploaded through the interface.
Because a push command replaces the remote font set, maintain canvas.brand-kit.json as the single source of truth when managing fonts through code. This practice prevents a push action from removing fonts added through the UI.
If this content did not answer your questions, try searching or contacting our support team for further assistance.
If this content did not answer your questions, try searching or contacting our support team for further assistance.