2021-08-09 03:26:47 +03:00
|
|
|
|
#!/bin/bash
|
|
|
|
|
set -o errexit -o nounset -o pipefail
|
2022-03-08 14:33:10 +03:00
|
|
|
|
cd "$(dirname "$0")/.."
|
2020-06-17 23:06:57 +03:00
|
|
|
|
[ -d venv ] && source venv/bin/activate
|
2020-06-08 17:10:00 +03:00
|
|
|
|
|
2022-03-08 14:33:10 +03:00
|
|
|
|
family_name=${FIRACODE_FAMILY_NAME:-"Fira Code"}
|
|
|
|
|
glyphs_file=${FIRACODE_GLYPHS_FILE:-"FiraCode.glyphs"}
|
2020-04-09 19:56:19 +03:00
|
|
|
|
|
2022-03-08 14:33:10 +03:00
|
|
|
|
dir="distr/variable_ttf/${family_name}"
|
|
|
|
|
file="${dir}/FiraCode-VF.ttf"
|
2020-06-08 02:04:36 +03:00
|
|
|
|
|
2022-03-08 14:33:10 +03:00
|
|
|
|
echo "=============="
|
|
|
|
|
echo
|
|
|
|
|
echo " [i] Creating variable font file!"
|
|
|
|
|
echo
|
|
|
|
|
|
|
|
|
|
mkdir -p "${dir}"
|
|
|
|
|
rm -rf "${dir:?}/"*
|
|
|
|
|
|
|
|
|
|
# make a temporary file here to avoid parallel runs from stepping on each other's toes
|
|
|
|
|
vf_glyphs=$(mktemp --suffix=".glyphs")
|
|
|
|
|
|
|
|
|
|
awk '/name = Retina;/ { print; print "exports = 0;"; next }1' \
|
|
|
|
|
"${glyphs_file}" > "${vf_glyphs}"
|
|
|
|
|
|
|
|
|
|
fontmake -g "${vf_glyphs}" -o variable --output-path "${file}"
|
|
|
|
|
rm -f "${vf_glyphs}"
|
2020-04-09 19:56:19 +03:00
|
|
|
|
|
|
|
|
|
# fix variable font metadata – very important
|
2022-03-08 14:33:10 +03:00
|
|
|
|
gftools fix-vf-meta "${file}"
|
|
|
|
|
mv "${file}.fix" "${file}"
|
2020-04-09 19:56:19 +03:00
|
|
|
|
|
|
|
|
|
# other fixes for metadata and hinting
|
2022-03-08 14:33:10 +03:00
|
|
|
|
gftools fix-nonhinting "${file}" "${file}.fix"
|
|
|
|
|
mv "${file}.fix" "${file}"
|
2020-06-08 02:04:36 +03:00
|
|
|
|
|
2022-03-08 14:33:10 +03:00
|
|
|
|
gftools fix-gasp --autofix "${file}"
|
|
|
|
|
mv "${file}.fix" "${file}"
|
2020-06-08 02:04:36 +03:00
|
|
|
|
|
2022-03-08 14:33:10 +03:00
|
|
|
|
gftools fix-dsig --autofix "${file}"
|
2020-04-09 19:56:19 +03:00
|
|
|
|
|
|
|
|
|
# cleanup of temp files
|
2022-03-08 14:33:10 +03:00
|
|
|
|
rm -rf "${dir}/"*-gasp.ttf
|
2020-04-09 19:56:19 +03:00
|
|
|
|
|
|
|
|
|
# TODO (late 2019?): use TTFautohint-VF for variable font (current support is minimal)
|