From 28dade195e709e4a9eb82548bd41907f4f8253b1 Mon Sep 17 00:00:00 2001 From: Peter Kaminski Date: Sun, 28 Feb 2021 08:49:15 -0800 Subject: [PATCH] fix for #1443: replace 'google-font-download' with direct downloads of the fonts (#1444) --- check-vendor-resources.sh | 1 - fetch-vendor-resources.sh | 49 ++++++++++++++++++----------- siteapp/static/css/google-fonts.css | 30 ++++++++++++++++++ templates/base-conditional.html | 2 +- templates/base.html | 2 +- 5 files changed, 63 insertions(+), 21 deletions(-) create mode 100644 siteapp/static/css/google-fonts.css diff --git a/check-vendor-resources.sh b/check-vendor-resources.sh index c1c7d494d..e0cc37ed1 100755 --- a/check-vendor-resources.sh +++ b/check-vendor-resources.sh @@ -64,7 +64,6 @@ e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855 siteapp/static e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855 siteapp/static/vendor/emojione/emojione-sprite-24-travel@2x.png 9643c4f2b950f462f71ea15ffab848c949f3fe72a8a4a01e0a082f4d580ac754 siteapp/static/vendor/emojione/emojione-sprite-24.min.css 4f59f47836471cf3f02edfb217afdf107bf29cfe25c424c8c514a32712fc2ee8 siteapp/static/vendor/fontawesome.js -990e7373d100faee6fa7d92c1277695520e3c502f726bb28ce03d2b6d2cd3e6c siteapp/static/vendor/google-fonts.css 6375a7ecbb77ba42e2de22c99aab9fea1fea125d6d857512360a3a555ff74161 siteapp/static/vendor/Hind_400.woff d7a3280717b1f82f46bee459863720a03de43b16dc8097ba1b133440e5fe0edc siteapp/static/vendor/Hind_400.woff2 a3ef4f13a191d01ecca06b8b997a666b28d4c614d6de256753fa9f4fbe15b726 siteapp/static/vendor/Hind_700.woff diff --git a/fetch-vendor-resources.sh b/fetch-vendor-resources.sh index 27cc0b0a3..69b7ee227 100755 --- a/fetch-vendor-resources.sh +++ b/fetch-vendor-resources.sh @@ -203,21 +203,34 @@ download \ # google fonts # Hind: SIL Open Font License 1.1 -# first download a helper (note: we're about to run a foreign script locally) -# TODO: Requires bash v4 not available on macOS. -download \ - https://raw.githubusercontent.com/neverpanic/google-font-download/d7bb34e0c5fa01d9411213fd1a1363317d3ceb11/google-font-download \ - /tmp/google-font-download \ - '95195992a6bb551755e8871e7570a544b047f46bcc253f0f3691f0d657a5a620' -(cd $VENDOR; bash /tmp/google-font-download -f woff,woff2 -o google-fonts.css Hind:400 Hind:700 Lato:900) -rm -f /tmp/google-font-download -# generated with: $SHACMD $VENDOR/{google-fonts.css,Hind*,Lato*} -$SHACMD_CHECK << EOF -faf874b09bc8220042ee61d072a5a5de49eac3275b5fe4917ed336461e35080a siteapp/static/vendor/google-fonts.css -6375a7ecbb77ba42e2de22c99aab9fea1fea125d6d857512360a3a555ff74161 siteapp/static/vendor/Hind_400.woff -d7a3280717b1f82f46bee459863720a03de43b16dc8097ba1b133440e5fe0edc siteapp/static/vendor/Hind_400.woff2 -a3ef4f13a191d01ecca06b8b997a666b28d4c614d6de256753fa9f4fbe15b726 siteapp/static/vendor/Hind_700.woff -e2f1a473a1649fe316dbddc5cf8f45c525d62b8373d1be395272864c0cf1e60f siteapp/static/vendor/Hind_700.woff2 -7831e273f41fef8485564286f3578d2847754db375befdb48b8ce37e1e1f3a57 siteapp/static/vendor/Lato_900.woff -7d4243c8e973ec0cfc707904891ae4e3efc03dbc8923acb9755f9a35c92269a6 siteapp/static/vendor/Lato_900.woff2 -EOF +# Lato: SIL Open Font License 1.1 +# to get static download locations, use https://github.com/neverpanic/google-font-download +download \ + https://fonts.gstatic.com/s/hind/v11/5aU69_a8oxmIdGl4Ag.woff \ + $VENDOR/Hind_400.woff \ + '6375a7ecbb77ba42e2de22c99aab9fea1fea125d6d857512360a3a555ff74161' + +download \ + https://fonts.gstatic.com/s/hind/v11/5aU69_a8oxmIdGl4BA.woff2 \ + $VENDOR/Hind_400.woff2 \ + 'd7a3280717b1f82f46bee459863720a03de43b16dc8097ba1b133440e5fe0edc' + +download \ + https://fonts.gstatic.com/s/hind/v11/5aU19_a8oxmIfNJdERySiw.woff \ + $VENDOR/Hind_700.woff \ + 'a3ef4f13a191d01ecca06b8b997a666b28d4c614d6de256753fa9f4fbe15b726' + +download \ + https://fonts.gstatic.com/s/hind/v11/5aU19_a8oxmIfNJdERySjQ.woff2 \ + $VENDOR/Hind_700.woff2 \ + 'e2f1a473a1649fe316dbddc5cf8f45c525d62b8373d1be395272864c0cf1e60f' + +download \ + https://fonts.gstatic.com/s/lato/v17/S6u9w4BMUTPHh50XSwiPHw.woff \ + $VENDOR/Lato_900.woff \ + '7831e273f41fef8485564286f3578d2847754db375befdb48b8ce37e1e1f3a57' + +download \ + https://fonts.gstatic.com/s/lato/v17/S6u9w4BMUTPHh50XSwiPGQ.woff2 \ + $VENDOR/Lato_900.woff2 \ + '7d4243c8e973ec0cfc707904891ae4e3efc03dbc8923acb9755f9a35c92269a6' diff --git a/siteapp/static/css/google-fonts.css b/siteapp/static/css/google-fonts.css new file mode 100644 index 000000000..1136f3ac3 --- /dev/null +++ b/siteapp/static/css/google-fonts.css @@ -0,0 +1,30 @@ +@font-face { + font-family: 'Hind'; + font-style: normal; + font-weight: 400; + src: + /* from https://fonts.gstatic.com/s/hind/v11/5aU69_a8oxmIdGl4Ag.woff */ + url('../vendor/Hind_400.woff') format('woff'), + /* from https://fonts.gstatic.com/s/hind/v11/5aU69_a8oxmIdGl4BA.woff2 */ + url('../vendor/Hind_400.woff2') format('woff2'); +} +@font-face { + font-family: 'Hind'; + font-style: normal; + font-weight: 700; + src: + /* from https://fonts.gstatic.com/s/hind/v11/5aU19_a8oxmIfNJdERySiw.woff */ + url('../vendor/Hind_700.woff') format('woff'), + /* from https://fonts.gstatic.com/s/hind/v11/5aU19_a8oxmIfNJdERySjQ.woff2 */ + url('../vendor/Hind_700.woff2') format('woff2'); +} +@font-face { + font-family: 'Lato'; + font-style: normal; + font-weight: 900; + src: + /* from https://fonts.gstatic.com/s/lato/v17/S6u9w4BMUTPHh50XSwiPHw.woff */ + url('../vendor/Lato_900.woff') format('woff'), + /* from https://fonts.gstatic.com/s/lato/v17/S6u9w4BMUTPHh50XSwiPGQ.woff2 */ + url('../vendor/Lato_900.woff2') format('woff2'); +} diff --git a/templates/base-conditional.html b/templates/base-conditional.html index 3a8256aa7..b3b8cf0ed 100644 --- a/templates/base-conditional.html +++ b/templates/base-conditional.html @@ -19,7 +19,7 @@ {% endif %} {% if 'google-fonts.css' in args %} - + {% endif %} {% if 'govready-q.css' in args %} diff --git a/templates/base.html b/templates/base.html index ddcfe3513..6fb51ed9c 100644 --- a/templates/base.html +++ b/templates/base.html @@ -16,7 +16,7 @@ - +