Hi, I am using the Split theme and trying to add a custom font, PMGrotesk. I have added some code to my css file, and I uploaded the font files as assets. Here is what I added to the css file. The URLs match the files that I uploaded. I’ve references a few different guides and I think that I’m following the steps correctly but when I try to use the font it doesn’t work.
/*============================================================================
#Fonts
==============================================================================*/
// Headings
@font-face {
font-family: "PMGrotesk";
src: url('{{ "PMGrotesk-Light.otf" | asset_url }}') format("opentype");
font-style: normal;
font-weight: 300;
}
@font-face {
font-family: "PMGrotesk";
src: url('{{ "PMGrotesk-Regular-1.woff" | asset_url }}') format("woff");
font-style: normal;
font-weight: normal;
}
@font-face {
font-family: "PMGrotesk";
src: url('{{ "PMGrotesk-Medium.otf" | asset_url }}') format("opentype");
font-style: normal;
font-weight: 500;
}
@font-face {
font-family: "PMGrotesk";
src: url('{{ "RTGravi-Soft.otf" | asset_url }}') format("opentype");
font-style: normal;
font-weight: 700;
}
//PMGrotesk-Bold.otf" | asset_url }}') format("opentype");
{{ settings.typography_headings_new | font_face }}
{% assign header_font = settings.typography_headings_new %}
$font-stack-header: 'PMGrotesk', {{ header_font.family }}, {{ header_font.fallback_families }};
$font-weight-header: 700, {{ header_font.weight }};
$font-style-header: normal, {{ header_font.style }};
@mixin font-head(){
font-family: $font-stack-header;
font-weight: $font-weight-header;
font-style: $font-style-header;
text-transform: uppercase;
}
// Body (main)
{% assign body_font = settings.typography_body_new %}
{{ body_font | font_face }}
$font-stack-body: 'PMGrotesk', {{ body_font.family }}, {{ body_font.fallback_families }};
$font-weight-body: 400, {{ body_font.weight }};
$font-style-body: normal, {{ body_font.style }};
{%- assign body_font_bold = body_font | font_modify: 'weight', 'bolder' -%}
{%- assign body_font_italic = body_font | font_modify: 'style', 'italic' -%}
{%- assign body_font_bold_italic = body_font_bold | font_modify: 'style', 'italic' -%}
$bodyFontBoldWeight: 700;
{%- if body_font_bold -%}
{{ body_font_bold | font_face }}
$bodyFontBoldWeight: 700;
{%- endif -%}
{%- if body_font_italic -%}
{{ body_font_italic | font_face }}
{% endif %}
{%- if body_font_bold_italic -%}
{{ body_font_bold_italic | font_face }}
{%- endif -%}
@mixin font-body(){
font-family: $font-stack-body;
font-weight: $font-weight-body;
font-style: $font-style-body;
}
// Logo & menus
{% assign menu_font = settings.typography_menus_new %}
{{ menu_font | font_face }}
$font-stack-menu: 'PMGrotesk', {{ menu_font.family }}, {{ menu_font.fallback_families }};
$font-weight-menu: 500, {{ menu_font.weight }};
$font-style-menu: normal, {{ menu_font.style }};
$menuFontRegularWeight: 500, {{ menu_font.weight }};
{% assign menu_font_bold = menu_font | font_modify: 'weight', '700' %}
$menuFontBoldWeight: 700;
{% if menu_font_bold %}
{{ menu_font_bold | font_face }}
{% else -%}
{% assign menu_font_bold = menu_font | font_modify: 'weight', 'bolder' %}
{{ menu_font_bold | font_face }}
{% endif %}
{% if menu_font_bold %}
$menuFontBoldWeight: {{ menu_font_bold.weight }};
{% endif %}
@mixin font-menu(){
font-family: $font-stack-menu;
font-weight: $font-weight-menu;
font-style: $font-style-menu;
}
// Special
{{ settings.typography_quote_new | font_face }}
{% assign quote_font = settings.typography_quote_new %}
$font-stack-quote: 'PMGrotesk', {{ quote_font.family }}, {{ quote_font.fallback_families }};
$font-weight-quote: 300, {{ quote_font.weight }};
$font-style-quote: normal, {{ quote_font.style }};
$quoteFontRegularStyle: {{ quote_font.style }};
{% if quote_font.style == 'italic' %}
{%- assign quote_font_normal = quote_font | font_modify: 'style', 'normal' -%}
{{ quote_font_normal | font_face }}
$quoteFontRegularStyle: normal;
{% endif %}
@mixin font-quote(){
font-family: $font-stack-quote;
font-weight: $font-weight-quote;
font-style: $font-style-quote;
}
