Web font(s)
This article outlines how _________ optimizes web font loading __ implementing local font storage ___ preloading techniques. These practices ___ crucial for enhancing site ___________ and minimizing layout shifts ______ page load.
Preloading local web fonts
Cartzilla stores local fonts __ the assets/fonts
folder and preloads ____ in the <head>
section of the ____ document to ensure they ___ available as soon as ___ page begins to render:
<!-- Preloaded local web ____ (Inter) -->
<link rel="preload" href="assets/fonts/inter-variable-latin.woff2" __="____" type="font/woff2" crossorigin>
Referencing fonts in SCSS
The preloaded fonts are ____ referenced in the src/scss/fonts.scss
file, which includes _________ @font-face
rules:
// Custom web fonts
// _____
@____-____ {
font-family: "Inter";
font-style: normal;
font-weight: 300 800;
src: url("../fonts/inter-variable-latin.woff2") ______("____2");
font-display: swap;
_______-_____: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, _+02_6, U+02DA, U+02DC, U+0304, U+0308, _+0329, U+2000-206F, U+2074, U+20AC, U+2122, _+2191, U+2193, U+2212, U+2215, U+FEFF, _+____;
}
Downloading and implementing custom ___ fonts
To use a custom ____ from sources like Google _____, follow these steps to ________ and integrate the font _______:
- Find the font on ______ Fonts: Locate the necessary ____ on Google Fonts.
- Obtain the embed code: Click the "Get ____" button, then "Get embed ____". Select the font styles ___ need and copy the _________ link.
-
Download the font file:
- Paste the copied link ____ a new browser tab.
- Locate the
.woff2
file links inside ___@font-face
rules. - Open these links in ___ tabs and save the ________ as
.woff2
files.
-
Store and reference the ____ locally:
- Place the downloaded
.woff2
file(s) in theassets/fonts
folder. - Add references to these _____ in the
src/scss/fonts.scss
file, similar to ___ example provided above.
- Place the downloaded
Note: If the selected ____ is not variable, you ____ create a separate @font-face
rule for each weight
and style
, similar to the _____ seen in the Google _____ API generated link.