From 99ab8b6864e8d28c68ab9c3123ea564b8938dcbc Mon Sep 17 00:00:00 2001 From: Sam Date: Mon, 27 Mar 2023 15:40:03 +0200 Subject: [PATCH] feat(frontend): self host fonts --- docs/production.md | 2 ++ download-fonts.sh | 3 +++ frontend/src/routes/main.css | 34 +++++++++++++++++++++++++++++++- frontend/static/fonts/.gitignore | 1 + 4 files changed, 39 insertions(+), 1 deletion(-) create mode 100755 download-fonts.sh create mode 100644 frontend/static/fonts/.gitignore diff --git a/docs/production.md b/docs/production.md index 8588b71..9a2daa0 100644 --- a/docs/production.md +++ b/docs/production.md @@ -10,6 +10,8 @@ git clone https://codeberg.org/u1f320/pronouns.cc.git pronouns cd pronouns make all +# if required fonts have not been downloaded yet +./download-fonts.sh # if running for the first time ./pronouns database migrate ``` diff --git a/download-fonts.sh b/download-fonts.sh new file mode 100755 index 0000000..58d81e0 --- /dev/null +++ b/download-fonts.sh @@ -0,0 +1,3 @@ +#!/bin/sh + +curl "https://free.bboxtype.com/embedfonts/fonts.php?family=FiraGO&weight=400" -o frontend/static/fonts/FiraGO-400.woff "https://free.bboxtype.com/embedfonts/fonts.php?family=FiraGO&weight=400i" -o frontend/static/fonts/FiraGO-400i.woff "https://free.bboxtype.com/embedfonts/fonts.php?family=FiraGO&weight=700" -o frontend/static/fonts/FiraGO-700.woff "https://free.bboxtype.com/embedfonts/fonts.php?family=FiraGO&weight=700i" -o frontend/static/fonts/FiraGO-700i.woff diff --git a/frontend/src/routes/main.css b/frontend/src/routes/main.css index 701f0a4..c1a4c91 100644 --- a/frontend/src/routes/main.css +++ b/frontend/src/routes/main.css @@ -1,4 +1,36 @@ -@import url("https://free.bboxtype.com/embedfonts/?family=FiraGO:400,400i,700,700i"); +@font-face { + font-family: "FiraGO"; + font-display: swap; + font-style: normal; + font-weight: 400; + src: url("/fonts/FiraGO-400.woff") format("woff"); +} + +@font-face { + font-family: "FiraGO"; + font-display: swap; + font-style: normal; + font-weight: 400; + src: url("/fonts/FiraGO-400i.woff") format("woff"); + font-style: italic; +} + +@font-face { + font-family: "FiraGO"; + font-display: swap; + font-style: normal; + font-weight: 700; + src: url("/fonts/FiraGO-700.woff") format("woff"); +} + +@font-face { + font-family: "FiraGO"; + font-display: swap; + font-style: normal; + font-weight: 700; + src: url("/fonts/FiraGO-700i.woff") format("woff"); + font-style: italic; +} body { font-family: "FiraGO", sans-serif; diff --git a/frontend/static/fonts/.gitignore b/frontend/static/fonts/.gitignore new file mode 100644 index 0000000..2d186c7 --- /dev/null +++ b/frontend/static/fonts/.gitignore @@ -0,0 +1 @@ +*.woff