M .hgignore +1 -0
@@ 11,3 11,4 @@ vendor/*
scratchpad
.*\.swp
style.css
+fonts.css
M Makefile +14 -5
@@ 1,6 1,6 @@
DOMAIN=henry.precheur.org
-all: style.css scratchpad log
+all: style.css fonts.css log
./scratchpad < log
install: glide
@@ 18,8 18,17 @@ log:
style.css: style.css.in normalize.css
cat normalize.css style.css.in > style.css
-fonts.css: font/charter/regular.woff2
- (cd font; ../base64_css_fonts.sh charter/regular.woff2) > fonts.css
+fonts.css: \
+ font/Charter/regular.woff2 \
+ font/Charter/italic.woff2 \
+ font/Charter/bold-italic.woff2 \
+ font/AnonymousPro/regular.woff2
+ (cd font; ../base64_css_fonts.sh \
+ Charter/regular.woff2 \
+ Charter/italic.woff2 \
+ Charter/bold-italic.woff2 \
+ AnonymousPro/regular.woff2 \
+ ) > fonts.css
serve: all
# create links to deps
@@ 32,7 41,7 @@ serve: all
clean:
-rm -rf 20[1-9]*.html index.html feed.atom 20[1-9]*/
-release: scratchpad style.css
- scp -C scratchpad style.css henry.precheur.org:/var/www/${DOMAIN}/
+release: scratchpad style.css fonts.css
+ scp -C scratchpad style.css fonts.css henry@henry.precheur.org:/var/www/${DOMAIN}/scratchpad/
.PHONY: clean relog all
A => base64_css_fonts.sh +28 -0
@@ 0,0 1,28 @@
+#!/bin/sh
+
+for path
+do
+ filename=$(basename "$path")
+ family=$(dirname "$path")
+ if test "${filename#*bold}" != "$filename"
+ then
+ weight=bold
+ else
+ weight=normal
+ fi
+ if test "${filename#*italic}" != "$filename"
+ then
+ style=italic
+ else
+ style=normal
+ fi
+
+ printf '@font-face {
+font-family: %s;
+font-style: %s;
+font-weight: %s;
+font-display: swap;
+src: url("data:application/font-woff2;charset=utf-8;base64,%s") format("woff2");
+}
+' "$family" "$style" "$weight" $(base64 -w0 < "$path")
+done
M template.go +1 -31
@@ 10,8 10,8 @@ const (
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<title>{{block "title" .}}Scratch pad{{end}}</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
+ <link rel="stylesheet" type='text/css' href="{{block "stylePrefix" .}}{{end}}fonts.css">
<link rel="stylesheet" type='text/css' href="{{block "stylePrefix" .}}{{end}}style.css">
- <link rel="stylesheet" type='text/css' href="{{block "stylePrefix" .}}{{end}}fonts.css">
</head>
<body>
{{block "body" .}}{{end}}
@@ 27,36 27,6 @@ My Email is <a href='mailto:henry@preche
Henry Prêcheur <henry@precheur.org></a>
</p>
</footer>
-<style>
-@import url('https://fonts.googleapis.com/css?family=Anonymous+Pro');
-@font-face {
- font-family: 'Charter';
- src: url('http://henry.precheur.org/scratchpad/charter/regular.eot');
- src: url('http://henry.precheur.org/scratchpad/charter/regular.eot?#iefix') format('embedded-opentype'),
- url('{{template "stylePrefix"}}charter/regular.woff') format('woff');
- font-weight: normal;
- font-style: normal;
- font-display: fallback;
-}
-@font-face {
- font-family: 'Charter';
- src: url('http://henry.precheur.org/scratchpad/charter/italic.eot');
- src: url('http://henry.precheur.org/scratchpad/charter/italic.eot?#iefix') format('embedded-opentype'),
- url('{{template "stylePrefix"}}charter/italic.woff') format('woff');
- font-weight: normal;
- font-style: italic;
- font-display: fallback;
-}
-@font-face {
- font-family: 'Charter';
- src: url('http://henry.precheur.org/scratchpad/charter/bold-italic.eot');
- src: url('http://henry.precheur.org/scratchpad/charter/bold-italic.eot?#iefix') format('embedded-opentype'),
- url('{{template "stylePrefix"}}charter/bold-italic.woff') format('woff');
- font-weight: bold;
- font-style: italic;
- font-display: fallback;
-}
-</style>
<script type="text/javascript">
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-20945988-4']);