UNPKG

1.42 kBSCSSView Raw
1$material-symbols-font-path: './' !default;
2
3// @see https://github.com/twbs/bootstrap/blob/main/scss/_functions.scss
4@function material-symbols-str-replace($string, $search, $replace: '') {
5 $index: str-index($string, $search);
6 @if $index {
7 @return str-slice($string, 1, $index - 1) + $replace +
8 material-symbols-str-replace(
9 str-slice($string, $index + str-length($search)),
10 $search,
11 $replace
12 );
13 }
14 @return $string;
15}
16
17@mixin material-symbols-font($font-family) {
18 $class-name: to-lower-case($font-family);
19 $class-name: material-symbols-str-replace($class-name, ' ', '-');
20 $font-file: $material-symbols-font-path + $class-name;
21
22 @font-face {
23 font-family: $font-family;
24 font-style: normal;
25 font-weight: 600;
26 font-display: block;
27 src: url('#{$font-file}.woff2') format('woff2');
28 }
29
30 .#{$class-name} {
31 font-family: $font-family;
32 font-weight: normal;
33 font-style: normal;
34 font-size: 24px;
35 line-height: 1;
36 letter-spacing: normal;
37 text-transform: none;
38 display: inline-block;
39 white-space: nowrap;
40 word-wrap: normal;
41 direction: ltr;
42 -webkit-font-smoothing: antialiased; // Support for all WebKit browsers
43 -moz-osx-font-smoothing: grayscale; // Support for Firefox
44 text-rendering: optimizeLegibility; // Support for Safari and Chrome
45 font-feature-settings: 'liga'; // Support for IE
46 }
47}