Skip to content

Commit

Permalink
feat: ✨ add fallback font
Browse files Browse the repository at this point in the history
  • Loading branch information
DerZade committed May 2, 2024
1 parent b478f66 commit adeccea
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,8 @@ This package also includes a SCSS file which allows some configuration and can b
$base-path: '@arma-events/icon-font/dist',
// set $class to '' to disable a generation of the css class selector
$class: 'arma-eventicons',
$font-family: 'arma.events Icon Font'
$font-family: 'arma.events Icon Font',
$font-family-fallback: 'arma.events Icon Font Fallback' !default
);

// use the styles-mixin to include the relevant
Expand Down
14 changes: 13 additions & 1 deletion index.scss
Original file line number Diff line number Diff line change
@@ -1,17 +1,29 @@
$base-path: '@arma-events/icon-font/dist' !default;
$class: 'arma-eventicons' !default;
$font-family: 'arma.events Icon Font' !default;
$font-family-fallback: 'arma.events Icon Font Fallback' !default;

// this fallback font is to make sure icons are invisible (size = 0%)
// while the webfont is still loading, to make sure the text is not visible
@font-face {
font-family: $font-family-fallback;
src: local('Arial');
size-adjust: 0%;
font-weight: normal;
font-style: normal;
}

@font-face {
font-family: $font-family;
src: url('#{$base-path}/icon-font.woff2') format('woff2'), url('#{$base-path}/icon-font.woff') format('woff');
font-weight: normal;
font-style: normal;
font-display: swap;
}

@mixin styles() {
/* use !important to prevent issues with browser extensions that change fonts */
font-family: $font-family !important;
font-family: $font-family, $font-family-fallback !important;
speak: none;
font-style: normal;
font-weight: normal;
Expand Down

0 comments on commit adeccea

Please sign in to comment.