From f6d08fb0dca9fbcf209472c484acf58158e96948 Mon Sep 17 00:00:00 2001 From: jarnedemeulemeester Date: Tue, 5 Jan 2021 17:15:50 +0100 Subject: [PATCH 1/3] Use local version of Noto Sans if available --- src/styles/noto-sans/index.scss | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/styles/noto-sans/index.scss b/src/styles/noto-sans/index.scss index 8227dd1166..16b150cbe0 100644 --- a/src/styles/noto-sans/index.scss +++ b/src/styles/noto-sans/index.scss @@ -5,7 +5,7 @@ font-style: $style; font-display: swap; font-weight: $weight; - src: url($url) format("woff2"); + src: local($family), url($url) format("woff2"); unicode-range: $range; } } From 0ab9292558aa6ba6c7c0b1a2c235bfca121dc4be Mon Sep 17 00:00:00 2001 From: jarnedemeulemeester Date: Wed, 6 Jan 2021 11:11:12 +0100 Subject: [PATCH 2/3] Add check for weight name in local font name --- src/styles/noto-sans/index.scss | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/styles/noto-sans/index.scss b/src/styles/noto-sans/index.scss index 16b150cbe0..dfce426690 100644 --- a/src/styles/noto-sans/index.scss +++ b/src/styles/noto-sans/index.scss @@ -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 fontFace($family: "Noto Sans", $style: normal, $weight: 400, $url: null, $range: null) { @font-face { @@ -5,7 +10,7 @@ font-style: $style; font-display: swap; 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; } } From d1d3e25d20fb90dd79f75e9611b1d2d934cf5a24 Mon Sep 17 00:00:00 2001 From: jarnedemeulemeester Date: Wed, 6 Jan 2021 11:37:20 +0100 Subject: [PATCH 3/3] Use old map-get function --- src/styles/noto-sans/index.scss | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/styles/noto-sans/index.scss b/src/styles/noto-sans/index.scss index dfce426690..3611eaf02f 100644 --- a/src/styles/noto-sans/index.scss +++ b/src/styles/noto-sans/index.scss @@ -1,5 +1,3 @@ -@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"); @@ -10,7 +8,7 @@ $weight-names: (100: "Thin", 200: "ExtraLight", 300: "Light", 400: "Regular", 50 font-style: $style; font-display: swap; font-weight: $weight; - src: local($family), local("#{$family} #{map.get($weight-names, $weight)}"), url($url) format("woff2"); + src: local($family), local("#{$family} #{map-get($weight-names, $weight)}"), url($url) format("woff2"); unicode-range: $range; } }