Add check for weight name in local font name
This commit is contained in:
parent
f6d08fb0dc
commit
0ab9292558
1 changed files with 6 additions and 1 deletions
|
@ -1,3 +1,8 @@
|
||||||
|
@use "sass:map";
|
||||||
|
|
||||||
|
// Map font weight numbers to names
|
||||||
|
$weight-names: (100: "Thin", 200: "ExtraLight", 300: "Light", 400: "Regular", 500: "Medium", 600: "SemiBold", 700: "Bold", 800: "ExtraBold", 900: "Black");
|
||||||
|
|
||||||
// Mixin to help create the Noto Sans font-faces
|
// Mixin to help create the Noto Sans font-faces
|
||||||
@mixin fontFace($family: "Noto Sans", $style: normal, $weight: 400, $url: null, $range: null) {
|
@mixin fontFace($family: "Noto Sans", $style: normal, $weight: 400, $url: null, $range: null) {
|
||||||
@font-face {
|
@font-face {
|
||||||
|
@ -5,7 +10,7 @@
|
||||||
font-style: $style;
|
font-style: $style;
|
||||||
font-display: swap;
|
font-display: swap;
|
||||||
font-weight: $weight;
|
font-weight: $weight;
|
||||||
src: local($family), url($url) format("woff2");
|
src: local($family), local("#{$family} #{map.get($weight-names, $weight)}"), url($url) format("woff2");
|
||||||
unicode-range: $range;
|
unicode-range: $range;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue