From 4d9b2178548cf746355cb5e6a89c39b510df05b8 Mon Sep 17 00:00:00 2001 From: Jany Belluz Date: Sun, 10 Jan 2016 19:55:41 +0100 Subject: [PATCH] Generate WOFF2 files, fix #62, new build dep: woff2_compress --- Makefile | 11 +++++++---- README.md | 13 +++++++++---- validate-generate | 1 + 3 files changed, 17 insertions(+), 8 deletions(-) diff --git a/Makefile b/Makefile index 317b802..91c46dd 100644 --- a/Makefile +++ b/Makefile @@ -5,6 +5,7 @@ TTF_FILES=$(patsubst %,%.ttf,$(BASENAMES)) OTF_FILES=$(patsubst %,OTF/%.otf,$(BASENAMES)) SVG_FILES=$(patsubst %,Webfonts/%.svg,$(BASENAMES)) WOFF_FILES=$(patsubst %,Webfonts/%.woff,$(BASENAMES)) +WOFF2_FILES=$(patsubst %,Webfonts/%.woff2,$(BASENAMES)) EOT_FILES=$(patsubst %,Webfonts/%.eot,$(BASENAMES)) CSS_FRAGMENTS=$(patsubst %,Webfonts/%-decl.css,$(BASENAMES)) CSS_FILE=Webfonts/stylesheet.css @@ -13,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 +OTF/%.otf %.ttf Webfonts/%.svg Webfonts/%.eot Webfonts/%.woff Webfonts/%.woff2 Webfonts/%-decl.css: Sources/%.sfd mkdir -p OTF Webfonts ./validate-generate "$*" # TODO determine perfect parameters @@ -21,6 +22,8 @@ OTF/%.otf %.ttf Webfonts/%.svg Webfonts/%.eot Webfonts/%.woff Webfonts/%-decl.cs mv "$*.hinted.ttf" "$*.ttf" sfnt2woff "OTF/$*.otf" mv "OTF/$*.woff" Webfonts + woff2_compress "$*.ttf" + mv "$*.woff2" Webfonts ttf2eot "$*.ttf" > "Webfonts/$*.eot" $(CSS_FILE): $(CSS_FRAGMENTS) @@ -36,17 +39,17 @@ $(INSTALLED_TTF_FILES): $(TTF_FILES) zips: zip-mono zip-prop -zip-mono: $(TTF_FILES) $(OTF_FILES) $(SVG_FILES) $(EOT_FILES) $(WOFF_FILES) $(SOURCES) $(CSS_FILE) +zip-mono: $(TTF_FILES) $(OTF_FILES) $(SVG_FILES) $(EOT_FILES) $(WOFF_FILES) $(WOFF2_FILES) $(SOURCES) $(CSS_FILE) zip FantasqueSansMono.zip OFL.txt README.md Webfonts/README.md $(CSS_FILE) $(foreach v,$^,$(if $(findstring Mono,$v),$v)) tar czvf FantasqueSansMono.tar.gz OFL.txt README.md Webfonts/README.md $(CSS_FILE) $(foreach v,$^,$(if $(findstring Mono,$v),$v)) -zip-prop: $(TTF_FILES) $(OTF_FILES) $(SVG_FILES) $(EOT_FILES) $(WOFF_FILES) $(SOURCES) +zip-prop: $(TTF_FILES) $(OTF_FILES) $(SVG_FILES) $(EOT_FILES) $(WOFF_FILES) $(WOFF2_FILES) $(SOURCES) zip FantasqueSans.zip OFL.txt README.md Webfonts/README.md $(foreach v,$^,$(if $(findstring Mono,$v),,$v)) tar czvf FantasqueSans.tar.gz OFL.txt README.md Webfonts/README.md $(foreach v,$^,$(if $(findstring Mono,$v),,$v)) clean: - rm -f *.ttf *.zip OTF/* Webfonts/*.eot Webfonts/*.woff Webfonts/*.svg Webfonts/*.css + rm -f *.ttf *.zip OTF/* Webfonts/*.eot Webfonts/*.woff Webfonts/*.woff2 Webfonts/*.svg Webfonts/*.css test: $(INSTALLED_TTF_FILES) gvim -f ~/Developpement/Système/kernel-base/shared/printf.c diff --git a/README.md b/README.md index e3d0f04..909e813 100644 --- a/README.md +++ b/README.md @@ -59,11 +59,16 @@ accept Building installable font files ------------------------------- +The build process requires: +* FontForge with python scripting support, +* `ttfautohint` +* `sfnt2woff` (from the `woff-tools` package on Ubuntu) +* `ttf2eot`, for example from [this + repository](https://github.com/harrastia/ttf2eot). +* `woff2_compress` from [the Google WOFF2 + tools](https://github.com/google/woff2) + Run `make`. You should see green stuff and some "OK" messages. -The build process requires FontForge with python scripting support, -`ttfautohint`, `sfnt2woff` (from the `woff-tools` package on Ubuntu) and -`ttf2eot`, for example from [this -repository](https://github.com/harrastia/ttf2eot). If you are using Ubuntu, please note that the FontForge version in the default Ubuntu repositories is much outdated at the time of this writing, diff --git a/validate-generate b/validate-generate index b49ff97..a9c5b83 100755 --- a/validate-generate +++ b/validate-generate @@ -56,6 +56,7 @@ cat > Webfonts/${basename}-decl.css <= 3.6, any other modern browser */ url('${basename}.ttf') format('truetype'), /* Safari, Android, iOS */ url('${basename}.svg#${fontname}') format('svg'); /* Chrome < 4, Legacy iOS */