@lansforsakringar/fonts
v1.1.1
Published
Länsförsäkringar web font files
Downloads
393
Readme
Länsförsäkringar Fonts
The Länsförsäkringar web font files and best practices we rely on.
Loading fonts
Please check the latest community guidelines before implementing the font files.
As of 2022, our method for limiting Flash of invisible text (FOIT) and Flash of
Unstyled Text (FOUT) relies on combining preloading and the
font-display: swap
CSS property.
Preloading
<head>
<!-- ... -->
<link rel="preload" href="/lf-rubrik.woff2" as="font" type="font/woff2" crossorigin>
<link rel="preload" href="/lf-rubrik.woff" as="font" type="font/woff" crossorigin>
<link rel="preload" href="/lf-rubrik.ttf" as="font" type="font/ttf" crossorigin>
<link rel="preload" href="/intro-cond-bold.woff2" as="font" type="font/woff2" crossorigin>
<link rel="preload" href="/intro-cond-regular.woff2" as="font" type="font/woff2" crossorigin>
</head>
Font display
@font-face {
font-family: 'LF Rubrik';
src:
url('./lf-rubrik.woff') format('woff')
url('./lf-rubrik.woff2') format('woff2')
url('./lf-rubrik.ttf') format('ttf');
font-display: swap;
/* ... */
}
CSS
This package includes a complete CSS implementation of the font stacks ready to be imported.
The file declares the two custom properties
--lf-font-family-sans-serif
and --lf-font-family-serif
which can be used to
apply the appropriate font family.
@import '@lansforsakringar/fonts';
body {
font-family: var(--lf-font-family-sans-serif);
}
h1 {
font-family: var(--lf-font-family-serif);
}
The font files are referenced relative to the CSS and can be loaded using a tool like postcss-url. If such a tool is not available in your environment, you will have to copy the source files and do the CSS implementation manually.
See the full CSS implemetation.
Fallbacks
LF Rubrik (serif) falls back to Georgia. Intro Cond (sans serif) falls back to Arial.
See the complete font stacks in the implemetation example.