1
0
Fork 0
mirror of synced 2024-06-26 10:10:35 +12:00
FiraCode/script/build

91 lines
2.5 KiB
Plaintext
Raw Normal View History

#!/bin/bash -e
2020-06-18 08:06:57 +12:00
[ -d venv ] && source venv/bin/activate
2019-04-05 09:05:55 +13:00
# ============================================================================
# VARIABLE FONT ==============================================================
2019-04-05 09:05:55 +13:00
# variable font
firaCodeVF=distr/variable_ttf/FiraCode-VF.ttf
rm -rf $firaCodeVF
fontmake -g FiraCode.glyphs -o variable --output-dir distr/variable_ttf
# fix variable font metadata very important
gftools fix-vf-meta $firaCodeVF
mv $firaCodeVF.fix $firaCodeVF
# other fixes for metadata and hinting
gftools fix-nonhinting $firaCodeVF $firaCodeVF
gftools fix-gasp --autofix $firaCodeVF
mv $firaCodeVF.fix $firaCodeVF
gftools fix-dsig --autofix $firaCodeVF
# cleanup of temp files
rm -rf distr/variable_ttf/*-gasp*
# TODO (late 2019?): use TTFautohint-VF for variable font (current support is minimal)
# ============================================================================
# STATIC FONTS ===============================================================
rm -rf distr/ttf
fontmake -g FiraCode.glyphs -o ttf --output-dir distr/ttf -i
rm -rf distr/otf
fontmake -g FiraCode.glyphs -o otf --output-dir distr/otf -i
2019-04-05 09:05:55 +13:00
# -------------------------------------------------------------
# Autohinting -------------------------------------------------
2019-04-05 09:05:55 +13: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"}
ttfautohint -I ${file} ${hintedFile} --stem-width-mode nnn --composites --windows-compatibility
2019-04-05 09:05:55 +13:00
cp ${hintedFile} ${file}
rm -rf ${hintedFile}
done
# ============================================================================
# Build woff2 fonts ==========================================================
# requires woff2_compress (get from https://github.com/bramstein/homebrew-webfonttools)
2019-04-05 09:05:55 +13: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-06 07:02:38 +13:00
done
# ============================================================================
# Build woff fonts ===========================================================
# requires sfnt2woff-zopfli (get from https://github.com/bramstein/homebrew-webfonttools)
2019-04-06 07:02:38 +13: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-18 08:06:57 +12:00
done