File: build_variable.sh

package info (click to toggle)
fonts-firacode 6.2-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 11,796 kB
  • sloc: sh: 287; python: 146; makefile: 19
file content (42 lines) | stat: -rwxr-xr-x 1,085 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#!/bin/bash
set -o errexit -o nounset -o pipefail
cd "$(dirname "$0")/.."
[ -d venv ] && source venv/bin/activate

family_name=${FIRACODE_FAMILY_NAME:-"Fira Code"}
glyphs_file=${FIRACODE_GLYPHS_FILE:-"FiraCode.glyphs"}

dir="distr/variable_ttf/${family_name}"
file="${dir}/FiraCode-VF.ttf"

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}"

# fix variable font metadata – very important

# other fixes for metadata and hinting
gftools fix-nonhinting "${file}" "${file}.fix"
mv "${file}.fix" "${file}"

gftools fix-gasp --autofix "${file}"
mv "${file}.fix" "${file}"


# cleanup of temp files
rm -rf "${dir}/"*-gasp.ttf

# TODO (late 2019?): use TTFautohint-VF for variable font (current support is minimal)