Skip to content

Custom Fonts

⚠️ To set up custom fonts, your website pages must be created with templates from a child theme. You will need to complete the child theme setup first.

Custom Fonts

POWER theme uses the Google font library, if you own the license to a different font or are using Typekit you can follow these instructions to update.

⚠️ Setting up custom fonts requires the use of Design Tools and some familiarity with code.

This documentation is designed to assist developers and those with code experience in properly setting up fonts for compatibility with the theme. If that's not you, please submit a ticket and we will gladly assist with the setup!

Font File Prep

You will need to gather the font files and identify the font you will use for the Base font and the Accent font.

If you will use more than two fonts (including weights/variations), it is only recommended that you load the specific font families needed (additional font files increase page load times).

There are several font file types for use with websites that have changed over time with changes to browsers and devices.

We recommend WOFF and WOFF2 as the most practical level of browser support, then adding browser-specific file types as needed.

Depending on your user's device/browser data you may need to load alternate versions of the file to provide support for older browsers.

  • True Type Font (TTF) - most common font type for Mac and Windows
  • Open Type Font (OTF) - scalable version of true type used by most platforms
  • Web Open Font Format (WOFF) - developed specifically for web pages, it is essentially a compressed version of TTF or OTF with additional metadata
  • Web Open Font Format 2 (WOFF2) - similar to WOFF with better compression (smaller file sizes)
  • Embedded Open Type Font (EOT) - is a compact form of OTF that is embedded on web pages and designed by Microsoft and is only supported by IE 6-11 (retired and not-preferred)
  • Scalable Vector Graphics (SVG) - most commonly used to display glyphs 

For more information about the best font files for browser support, including the deepest possible browser support, we recommend reading this article: How to use @font-face in CSS.

To check browser compatibility based on your user data, you can type any of these file formats into caniuse.com for a more detailed view.

Here is an example for WOFF from Can I Use (current as of 9 June 2022):

can-i-use-woff

Once you have determined the correct file types, you will need to load them to the HubSpot Files directory.

“Marketing” → “Files and Templates” → “Files”→ then create a folder named "fonts" and upload the necessary files.

 

Adding Custom Fonts

To add a custom font to your website theme using these instructions requires v24 or later.

The fonts will be added directly to your child.css file, it may have a different name depending on how the files were named when the child theme was created.

If you have not made any previous revisions to your child.css file, you will need to add the include statement at the top:

Next, copy this code and add to your child.css file:

You can modify the code for your font name, file location, file type(s), etc. accordingly.

You can copy this code and repeat these steps for each font you are adding.

Importing From Typekit

For Typekit, you'll only need to add the @import for the Typekit URL provided.

Replacing Theme Defaults

Once all of the fonts have been loaded, you will need to update the code for the base and accent fonts.

Just below the @font-face setup, you can add this code to set the  Base Font Family (ff-base) and Accent Font Family (ff-accent).

This is where you can replace the theme settings with the local name for your font.

Overwriting CSS Classes

We highly recommend doing any class overwrites in the child.css file so that any overwrites to the child theme are easier to find/identify in a single location.

As noted above, if you have not added anything to the child.css file previously, make sure to add the include statement for _pwr-style-settings.css at the top: