commit 8c50411480ff73f347aa9977c814db0557f5ed79
parent 2720a02f7858adc2870bbfe1e4891e616245ecc9
Author: Kévin Le Gouguec <kevin.legouguec@gmail.com>
Date: Sun, 13 Feb 2022 00:08:27 +0100
Self-host fonts
https://rewis.io/urteile/urteil/lhm-20-01-2022-3-o-1749320/
Diffstat:
8 files changed, 40 insertions(+), 10 deletions(-)
diff --git a/Makefile b/Makefile
@@ -26,6 +26,9 @@ images_folders = $(call dirnames,$(images))
stylesheets = $(foreach img,$(shell find stylesheets -type f),$(OUTDIR)/$(img))
stylesheets_folders = $(call dirnames,$(stylesheets))
+fonts = $(foreach font,$(shell find fonts -type f),$(OUTDIR)/$(font))
+fonts_folders = $(call dirnames,$(fonts))
+
scripts = $(foreach img,$(shell find scripts -type f),$(OUTDIR)/$(img))
scripts_folders = $(call dirnames,$(scripts))
@@ -39,9 +42,9 @@ upload: site
clean:
-rm -r $(OUTDIR)
-site: $(pages) $(members_pages) $(feeds) $(images) $(stylesheets) $(scripts)
+site: $(pages) $(members_pages) $(feeds) $(images) $(stylesheets) $(fonts) $(scripts)
-$(images) $(stylesheets) $(scripts): $(OUTDIR)/%: %
+$(images) $(stylesheets) $(fonts) $(scripts): $(OUTDIR)/%: %
cp $< $@
$(feeds): $(OUTDIR)/%: %
@@ -78,7 +81,7 @@ $(OUTDIR)/en/sitemap.html: en/sitemap.md
# Our lists of target directories are created from the lists of leaf
# resources; some intermediate directories that only hold subdirs do
# not appear in these lists. Work around that with -p.
-$(OUTDIR) $(languages_folders) $(images_folders) $(stylesheets_folders) $(scripts_folders):
+$(OUTDIR) $(languages_folders) $(images_folders) $(stylesheets_folders) $(fonts_folders) $(scripts_folders):
mkdir -p $@
-$(feeds) $(images) $(stylesheets) $(scripts) $(pages) $(members_pages): | $$(@D)
+$(feeds) $(images) $(stylesheets) $(fonts) $(scripts) $(pages) $(members_pages): | $$(@D)
diff --git a/en/template.html b/en/template.html
@@ -16,10 +16,8 @@
<!-- Favicon, stylesheets, fonts -->
<link rel="icon" href="../images/favicon.svg">
<link rel="stylesheet" href="../stylesheets/commun.css">
+ <link rel="stylesheet" href="../stylesheets/fonts.css">
{STYLESHEETS}
- <link rel="preconnect" href="https://fonts.gstatic.com">
- <link href="https://fonts.googleapis.com/css2?family=Open+Sans:wght@400;600;700&display=swap" rel="stylesheet">
- <link href="https://fonts.googleapis.com/css2?family=Cormorant:ital,wght@1,500&display=swap" rel="stylesheet">
<link rel="alternate" type="application/rss+xml" href="feed.xml">
</head>
<body>
diff --git a/fonts/Cormorant500i.ttf b/fonts/Cormorant500i.ttf
Binary files differ.
diff --git a/fonts/OpenSans400.ttf b/fonts/OpenSans400.ttf
Binary files differ.
diff --git a/fonts/OpenSans600.ttf b/fonts/OpenSans600.ttf
Binary files differ.
diff --git a/fonts/OpenSans700.ttf b/fonts/OpenSans700.ttf
Binary files differ.
diff --git a/stylesheets/fonts.css b/stylesheets/fonts.css
@@ -0,0 +1,31 @@
+@font-face {
+ font-family: 'Open Sans';
+ font-style: normal;
+ font-weight: 400;
+ font-stretch: normal;
+ font-display: swap;
+ src: url(../fonts/OpenSans400.ttf) format('truetype');
+}
+@font-face {
+ font-family: 'Open Sans';
+ font-style: normal;
+ font-weight: 600;
+ font-stretch: normal;
+ font-display: swap;
+ src: url(../fonts/OpenSans600.ttf) format('truetype');
+}
+@font-face {
+ font-family: 'Open Sans';
+ font-style: normal;
+ font-weight: 700;
+ font-stretch: normal;
+ font-display: swap;
+ src: url(../fonts/OpenSans700.ttf) format('truetype');
+}
+@font-face {
+ font-family: 'Cormorant';
+ font-style: italic;
+ font-weight: 500;
+ font-display: swap;
+ src: url(../fonts/Cormorant500i.ttf) format('truetype');
+}
diff --git a/template.html b/template.html
@@ -16,10 +16,8 @@
<!-- Favicon, stylesheets, fonts -->
<link rel="icon" href="images/favicon.svg">
<link rel="stylesheet" href="stylesheets/commun.css">
+ <link rel="stylesheet" href="stylesheets/fonts.css">
{STYLESHEETS}
- <link rel="preconnect" href="https://fonts.gstatic.com">
- <link href="https://fonts.googleapis.com/css2?family=Open+Sans:wght@400;600;700&display=swap" rel="stylesheet">
- <link href="https://fonts.googleapis.com/css2?family=Cormorant:ital,wght@1,500&display=swap" rel="stylesheet">
<link rel="alternate" type="application/rss+xml" href="feed.xml">
</head>
<body>