Generate WOFF2 files, fix #62, new build dep: woff2_compress

pull/83/head
Jany Belluz 2016-01-10 19:55:41 +01:00
parent f2eca867f1
commit 4d9b217854
3 changed files with 17 additions and 8 deletions

View File

@ -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

View File

@ -59,11 +59,16 @@ accept
Building installable font files
-------------------------------
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
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.
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,

View File

@ -56,6 +56,7 @@ cat > Webfonts/${basename}-decl.css <<EOF
font-family: '${familyname}';
src: url('${basename}.eot'); /* IE 9 Compatibility Mode */
src: url('${basename}.eot?#iefix') format('embedded-opentype'), /* IE < 9 */
url('${basename}.woff2') format('woff2'),
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 */