2019-08-01 19:30:48 +03:00
|
|
|
|
#!/bin/bash -e
|
2019-05-21 17:21:07 +03:00
|
|
|
|
|
2020-06-17 23:06:57 +03:00
|
|
|
|
[ -d venv ] && source venv/bin/activate
|
2019-04-04 23:05:55 +03:00
|
|
|
|
|
2019-04-06 00:37:59 +03:00
|
|
|
|
# ============================================================================
|
|
|
|
|
# VARIABLE FONT ==============================================================
|
|
|
|
|
|
2019-04-04 23:05:55 +03:00
|
|
|
|
# variable font
|
2019-04-06 00:37:59 +03:00
|
|
|
|
firaCodeVF=distr/variable_ttf/FiraCode-VF.ttf
|
|
|
|
|
|
2020-06-08 02:04:36 +03:00
|
|
|
|
rm -rf $firaCodeVF
|
|
|
|
|
fontmake -g FiraCode.glyphs -o variable --output-dir distr/variable_ttf
|
|
|
|
|
|
2019-04-06 00:37:59 +03:00
|
|
|
|
# fix variable font metadata – very important
|
|
|
|
|
gftools fix-vf-meta $firaCodeVF
|
2020-06-08 02:04:36 +03:00
|
|
|
|
mv $firaCodeVF.fix $firaCodeVF
|
2019-04-06 00:37:59 +03:00
|
|
|
|
|
|
|
|
|
# other fixes for metadata and hinting
|
|
|
|
|
gftools fix-nonhinting $firaCodeVF $firaCodeVF
|
|
|
|
|
gftools fix-gasp --autofix $firaCodeVF
|
2020-06-08 02:04:36 +03:00
|
|
|
|
mv $firaCodeVF.fix $firaCodeVF
|
|
|
|
|
|
2019-04-06 00:37:59 +03:00
|
|
|
|
gftools fix-dsig --autofix $firaCodeVF
|
|
|
|
|
|
|
|
|
|
# cleanup of temp files
|
2020-06-08 02:04:36 +03:00
|
|
|
|
rm -rf distr/variable_ttf/*-gasp*
|
2019-04-06 00:37:59 +03:00
|
|
|
|
|
|
|
|
|
# TODO (late 2019?): use TTFautohint-VF for variable font (current support is minimal)
|
|
|
|
|
|
|
|
|
|
# ============================================================================
|
|
|
|
|
# STATIC FONTS ===============================================================
|
|
|
|
|
|
2019-04-05 21:39:17 +03:00
|
|
|
|
rm -rf distr/ttf
|
|
|
|
|
fontmake -g FiraCode.glyphs -o ttf --output-dir distr/ttf -i
|
2019-04-06 00:37:59 +03:00
|
|
|
|
|
2019-04-05 21:39:17 +03:00
|
|
|
|
rm -rf distr/otf
|
|
|
|
|
fontmake -g FiraCode.glyphs -o otf --output-dir distr/otf -i
|
2019-04-04 23:05:55 +03:00
|
|
|
|
|
2019-04-06 00:37:59 +03:00
|
|
|
|
# -------------------------------------------------------------
|
|
|
|
|
# Autohinting -------------------------------------------------
|
2019-04-04 23:05:55 +03:00
|
|
|
|
|
|
|
|
|
statics=$(ls distr/ttf/*.ttf)
|
|
|
|
|
for file in $statics; do
|
|
|
|
|
echo "fix DSIG in " ${file}
|
|
|
|
|
gftools fix-dsig --autofix ${file}
|
|
|
|
|
|
|
|
|
|
echo "TTFautohint " ${file}
|
|
|
|
|
# autohint with detailed info
|
|
|
|
|
hintedFile=${file/".ttf"/"-hinted.ttf"}
|
2019-08-01 16:53:45 +03:00
|
|
|
|
ttfautohint -I ${file} ${hintedFile} --stem-width-mode nnn --composites --windows-compatibility
|
2019-04-04 23:05:55 +03:00
|
|
|
|
cp ${hintedFile} ${file}
|
|
|
|
|
rm -rf ${hintedFile}
|
|
|
|
|
done
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# ============================================================================
|
|
|
|
|
# Build woff2 fonts ==========================================================
|
|
|
|
|
|
2019-04-06 00:37:59 +03:00
|
|
|
|
# requires woff2_compress (get from https://github.com/bramstein/homebrew-webfonttools)
|
2019-04-04 23:05:55 +03:00
|
|
|
|
|
|
|
|
|
rm -rf distr/woff2
|
|
|
|
|
|
|
|
|
|
ttfs=$(ls distr/*/*.ttf)
|
|
|
|
|
for ttf in $ttfs; do
|
|
|
|
|
woff2_compress $ttf
|
|
|
|
|
done
|
|
|
|
|
|
|
|
|
|
mkdir -p distr/woff2
|
|
|
|
|
woff2s=$(ls distr/*/*.woff2)
|
|
|
|
|
for woff2 in $woff2s; do
|
|
|
|
|
mv $woff2 distr/woff2/$(basename $woff2)
|
2019-04-05 21:02:38 +03:00
|
|
|
|
done
|
|
|
|
|
|
|
|
|
|
# ============================================================================
|
|
|
|
|
# Build woff fonts ===========================================================
|
|
|
|
|
|
2019-04-06 00:37:59 +03:00
|
|
|
|
# requires sfnt2woff-zopfli (get from https://github.com/bramstein/homebrew-webfonttools)
|
2019-04-05 21:02:38 +03:00
|
|
|
|
|
|
|
|
|
rm -rf distr/woff
|
|
|
|
|
|
|
|
|
|
ttfs=$(ls distr/*/*.ttf)
|
|
|
|
|
for ttf in $ttfs; do
|
|
|
|
|
sfnt2woff-zopfli $ttf
|
|
|
|
|
done
|
|
|
|
|
|
|
|
|
|
mkdir -p distr/woff
|
|
|
|
|
woffs=$(ls distr/*/*.woff)
|
|
|
|
|
for woff in $woffs; do
|
|
|
|
|
mv $woff distr/woff/$(basename $woff)
|
2020-06-17 23:06:57 +03:00
|
|
|
|
done
|