Highlight > Typography
Customizing the fonts
- Enter the Typography tab.
- From the Headings list, choose a font for all of your store's titles and call to actions.
- From the Body list, choose a font for the general typography of your store.
- From the Testimonials list, choose a font for the testimonials sections (this will load only if you are using the section on your homepage).
- You can also play with the Base size of both the headings and the body font, in order to make sure that the chosen font is properly displayed.
Adding your own font
Highlight theme includes different fonts, as any Shopify theme, that can be selected from the Theme Customizer > General > Typography (screenshot). But if you decide to use a custom font, there are a few methods to do this:
1. Use the @font-face declaration (add your own font files)
Please start by uploading your new font in Content > Files. The best font file format for compatibility with all browsers is the woff, or even better, woff2 format.
Open /snippets/head-variables.liquid and right at the top, remove this code:
{%- assign headings_font = settings.headings_font -%}
{%- assign body_font = settings.body_font -%}
{%- unless headings_font.system? -%}
<link rel="preload" href="{{ headings_font | font_url }}" as="font" type="font/woff2" crossorigin>
{%- endunless -%}
{%- unless body_font.system? -%}
<link rel="preload" href="{{ body_font | font_url }}" as="font" type="font/woff2" crossorigin>
{%- endunless -%}
{%- unless quote_font.system? -%}
<link rel="preload" href="{{ settings.quote_font | font_url }}" as="font" type="font/woff2" crossorigin>
{%- endunless -%}
Now, go a bit further and identify the place where the current fonts are created, and delete those lines as well:
echo headings_font | font_face: font_display: 'swap'
assign headings_font_bold = headings_font | font_modify: 'weight', '+100'
if headings_font_bold == blank
assign headings_font_bold = headings_font | font_modify: 'weight', '700'
endif
echo headings_font_bold | font_face: font_display: 'swap'
echo body_font | font_face: font_display: 'swap'
assign body_font_bold = body_font | font_modify: 'weight', '+100'
if body_font_bold == blank
assign body_font_bold = body_font | font_modify: 'weight', '700'
endif
echo body_font_bold | font_face: font_display: 'swap'
Back at the top, you should see the style opening declaration (line 8)
<style>
Right after this line of code, add your own font, like this:
@font-face {
font-family: "MyFont";
src: url('Your_font_link_URL') format("woff2");
}
Add this declaration for all the fonts that you wish to use (if you want to change two fonts, one for headings, one for body, you'll need to font declarations, with the names you declare. If your font has style variations (italic, bold), you need to add font files for those as well, like this:
@font-face {
font-family: "MyFont";
src: url('{{ "MyFont-regular.woff2" | asset_url }}') format("woff2");
}
@font-face {
font-family: "MyFont";
font-weight: 500;
src: url('{{ "MyFont-medium.woff2" | asset_url }}') format("woff2");
}
@font-face {
font-family: "MyFont";
font-weight: 700;
src: url('{{ "MyFont-bold.woff2" | asset_url }}') format("woff2");
}
@font-face {
font-family: "MyFont";
font-weight: 400;
font-style: italic;
src: url('{{ "MyFont-italic.woff2" | asset_url }}') format("woff2");
}
Now that your font is ready to be loaded, you need to modify the font variables. Go down again, and search for the code snippet below.
/* Font variables */
--font-stack-headings: {{ headings_font.family }}, {{ headings_font.fallback_families }};
--font-weight-headings: {{ headings_font.weight }};
--font-weight-headings-bold: {% if headings_font_bold %} {{ headings_font_bold.weight }} {% else %} {{ headings_font.weight }} {% endif %};
--font-style-headings: {{ headings_font.style }};
--font-stack-body: {{ body_font.family }}, {{ body_font.fallback_families }};
--font-weight-body: {{ body_font.weight }};
--font-weight-body-bold: {% if body_font_bold %} {{ body_font_bold.weight }} {% else %} {{ body_font.weight }} {% endif %};
--font-style-body: {{ body_font.style }};
--base-headings-size: {{ settings.headings_size }};
--base-body-size: {{ settings.body_size }};
Delete this entirely and replace it with your own font stack here, like this:
/* Font variables */
--font-stack-headings: "MyFont", sans-serif;
--font-weight-headings: 400;
--font-weight-headings-bold: 700;
--font-style-headings: normal;
--font-stack-body: "MyFont", sans-serif;
--font-weight-body: 400;
--font-weight-body-bold: 700;
--font-style-body: normal;
--base-headings-size: 36;
--base-body-size: 18;
You can have three different fonts, or use the same font for all typography, just make sure that you add the source files properly for all the fonts that you wish to use.
2. Use Google Fonts
After you select the font you need to use from Google fonts, a code will be generated for you to insert in the theme.
Please embed the generated code in the theme.liquid file, just before the </head> closing tag (screenshot
For example, for the Poiret One font the code generated by Google is:
<link href="https://fonts.googleapis.com/css?family=Poiret+One" rel="stylesheet">
Then go back at STEP 1 and apply the steps in order for the theme to use your font. Just skip the "@font-face" declaration, but the rest is the same.. You will be using the selected font from Google instead. So in all above examples, where we've used "MyFont", here it will be "Poiret One".