From 0801e85839d5bea6ab5ca024c93dee822d74265d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tristan=20Dani=C3=ABl=20Maat?= Date: Tue, 21 Jun 2022 21:57:42 +0100 Subject: [PATCH] Add hack font --- package-lock.json | 5 +++++ package.json | 1 + src/lib/scss/_custom-bulma.scss | 1 + src/lib/scss/_fonts.scss | 23 ++++++++++++++++++++++- 4 files changed, 29 insertions(+), 1 deletion(-) diff --git a/package-lock.json b/package-lock.json index 9eac038..20c4c39 100644 --- a/package-lock.json +++ b/package-lock.json @@ -3884,6 +3884,11 @@ "slash": "^3.0.0" } }, + "hack-font": { + "version": "3.3.0", + "resolved": "https://registry.npmjs.org/hack-font/-/hack-font-3.3.0.tgz", + "integrity": "sha512-RohrcAr3UaKiIoxDlOytCjObcUAucfFc6V5fKu6gBrvmvTfIXeBqZwR0Q5kb9qpbluThJWt326LClLKIGiFyug==" + }, "har-schema": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/har-schema/-/har-schema-2.0.0.tgz", diff --git a/package.json b/package.json index 6521748..8b1943a 100644 --- a/package.json +++ b/package.json @@ -10,6 +10,7 @@ "@fontsource/nunito": "^4.5.9", "@fortawesome/fontawesome-free": "^6.1.1", "bulma": "^0.9.4", + "hack-font": "^3.3.0", "three": "^0.141.0" }, "devDependencies": { diff --git a/src/lib/scss/_custom-bulma.scss b/src/lib/scss/_custom-bulma.scss index c57b35e..1d5b590 100644 --- a/src/lib/scss/_custom-bulma.scss +++ b/src/lib/scss/_custom-bulma.scss @@ -27,6 +27,7 @@ $weight-normal: 400; $body-background-color: $black; $family-sans-serif: Nunito, $family-sans-serif; +$family-monospace: Hack, $family-monospace; $text: $grey-light; $text-strong: $primary; diff --git a/src/lib/scss/_fonts.scss b/src/lib/scss/_fonts.scss index 1b5b150..9cd6414 100644 --- a/src/lib/scss/_fonts.scss +++ b/src/lib/scss/_fonts.scss @@ -24,4 +24,25 @@ $weights: 300, 400, 500, 600, 700; $display: auto, $style: normal, $fontDir: "~/node_modules/@fontsource/arimo/files" -) +); + +// Hack *does* come with its own CSS, but it's broken and hasn't seen +// a release since https://github.com/source-foundry/Hack/issues/467 +// was resolved. + +$variants: + regular 400 normal, + bold 700 normal, + italic 400 italic, + bolditalic 700 italic; + +@each $name, $weight, $style in $variants { + @font-face { + font-family: "Hack"; + src: + url("~/node_modules/hack-font/build/web/fonts/hack-#{$name}-subset.woff2?sha=3114f1256") format("woff2"), + url("~/node_modules/hack-font/build/web/fonts/hack-#{$name}-subset.woff?sha=3114f1256") format("woff"); + font-weight: $weight; + font-style: $style; + } +}