From e22edd86a196ae58a92c83cd82246a6fe922425c Mon Sep 17 00:00:00 2001 From: Jany Belluz Date: Sun, 9 Mar 2014 21:48:13 +0100 Subject: [PATCH] Generate better CSS (fix #26) + drop TeX fonts --- Makefile | 4 ++-- validate-generate.sh | 52 +++++++++++++++++++++++++++++--------------- 2 files changed, 36 insertions(+), 20 deletions(-) diff --git a/Makefile b/Makefile index 68718ef..ff5ab08 100644 --- a/Makefile +++ b/Makefile @@ -14,7 +14,7 @@ INSTALLED_TTF_FILES=$(patsubst %,~/.fonts/%.ttf,$(BASENAMES)) all: $(TTF_FILES) OTF/%.otf %.ttf Webfonts/%.svg Webfonts/%.eot Webfonts/%.woff Webfonts/%-decl.css: Sources/%.sfd - mkdir -p OTF TeX Webfonts + mkdir -p OTF Webfonts ./validate-generate.sh "$*" # TODO determine perfect parameters ttfautohint "$*.ttf" "$*.hinted.ttf" @@ -42,7 +42,7 @@ zip-prop: $(TTF_FILES) $(OTF_FILES) $(SVG_FILES) $(EOT_FILES) $(WOFF_FILES) $(SO zip FantasqueSans.zip OFL.txt README.md Webfonts/README.md $(foreach v,$^,$(if $(findstring Mono,$v),,$v)) clean: - rm -f *.ttf *.zip OTF/* TeX/* Webfonts/*.eot Webfonts/*.woff Webfonts/*.svg Webfonts/*.css + rm -f *.ttf *.zip OTF/* Webfonts/*.eot Webfonts/*.woff Webfonts/*.svg Webfonts/*.css test: $(INSTALLED_TTF_FILES) gvim -f ~/Developpement/Système/kernel-base/shared/printf.c diff --git a/validate-generate.sh b/validate-generate.sh index 3aecd2f..6507fbb 100755 --- a/validate-generate.sh +++ b/validate-generate.sh @@ -5,20 +5,21 @@ basename=$1 ttf="${basename}.ttf" otf="OTF/${basename}.otf" -texFamily="cm" # arbitrary two letters out of the font's name - -texCut="r" # Regular -if [[ "${basename,,}" == *bold* ]]; then - texCut="b" # Bold -fi echo -e "\e[1;37mGenerating ${basename}... \e[0m" -fontforge -lang=py -script - < Webfonts/${basename}-decl.css <= 3.6, any other modern browser */ - url('${basename}.ttf') format('truetype'), /* Safari, Android, iOS */ - url('${basename}.svg#${basename}') format('svg'); /* Chrome < 4, Legacy iOS */ + font-family: '${familyname}'; + src: url('${basename}.eot'); /* IE 9 Compatibility Mode */ + src: url('${basename}.eot?#iefix') format('embedded-opentype'), /* IE < 9 */ + url('${basename}.woff') format('woff'), /* Firefox >= 3.6, any other modern browser */ + url('${basename}.ttf') format('truetype'), /* Safari, Android, iOS */ + url('${basename}.svg#${fontname}') format('svg'); /* Chrome < 4, Legacy iOS */ + font-weight: ${fontweight}; + font-style: ${fontstyle}; } - EOF if [ "x$error" != "x0" ]; then