2016-12-03 21:57:11 +02:00
|
|
|
#!/bin/bash
|
|
|
|
# ------------------------------------------------------------------
|
|
|
|
#
|
|
|
|
# autohint.sh
|
|
|
|
# Copyright 2016 Christopher Simpkins
|
|
|
|
# MIT license
|
|
|
|
# Modified by Ryan L McIntyre
|
|
|
|
# for Nerd Fonts (https://github.com/ryanoasis/nerd-fonts)
|
|
|
|
#
|
|
|
|
# ------------------------------------------------------------------
|
|
|
|
|
|
|
|
# DESCRIPTION
|
|
|
|
# Applies hints to the Hack ttf font builds with ttfautohint
|
|
|
|
# Executable: ttfautohint (http://www.freetype.org/ttfautohint/doc/ttfautohint.html)
|
|
|
|
|
|
|
|
fontfile=$1
|
|
|
|
|
|
|
|
echo "[Nerd Fonts] Autohinting Hack '$fontfile'"
|
|
|
|
|
|
|
|
command -v ttfautohint >/dev/null 2>&1 || {
|
|
|
|
echo "[Nerd Fonts] 'ttfautohint' is required (not installed). Aborting." >&2; exit 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
# ttfautohint - Input and output file names must not be identical
|
|
|
|
cp "$fontfile" "${fontfile}.tmp"
|
|
|
|
|
2016-12-15 04:50:36 +02:00
|
|
|
if [[ "$fontfile" == *" Regular"* ]]
|
2016-12-03 21:57:11 +02:00
|
|
|
then
|
2016-12-15 04:50:36 +02:00
|
|
|
echo "[Nerd Fonts] Hinting Knack (Hack) Regular"
|
2016-12-03 21:57:11 +02:00
|
|
|
ttfautohint -l 4 -r 80 -G 350 -x 0 -H 181 -D latn -f latn -w G -W -t -X "" -I -m "bin/scripts/Hack/Hack-Regular-TA.txt" "${fontfile}.tmp" "$fontfile"
|
2016-12-15 04:50:36 +02:00
|
|
|
elif [[ "$fontfile" == *" Bold"* ]]
|
|
|
|
then
|
|
|
|
echo "[Nerd Fonts] Hinting Knack (Hack) Bold"
|
2016-12-15 03:10:42 +02:00
|
|
|
ttfautohint -l 4 -r 80 -G 350 -x 0 -H 260 -D latn -f latn -w G -W -t -X "" -I -m "bin/scripts/Hack/Hack-Bold-TA.txt" "${fontfile}.tmp" "$fontfile"
|
2016-12-15 04:50:36 +02:00
|
|
|
elif [[ "$fontfile" == *" Italic"* ]]
|
|
|
|
then
|
|
|
|
echo "[Nerd Fonts] Hinting Knack (Hack) Italic"
|
2016-12-15 03:10:42 +02:00
|
|
|
ttfautohint -l 4 -r 80 -G 350 -x 0 -H 145 -D latn -f latn -w G -W -t -X "" -I -m "bin/scripts/Hack/Hack-Bold-TA.txt" "${fontfile}.tmp" "$fontfile"
|
2016-12-15 04:50:36 +02:00
|
|
|
elif [[ "$fontfile" == *" BoldItalic"* ]]
|
|
|
|
then
|
|
|
|
echo "[Nerd Fonts] Hinting Knack (Hack) Bold Italic"
|
2016-12-15 03:10:42 +02:00
|
|
|
ttfautohint -l 4 -r 80 -G 350 -x 0 -H 265 -D latn -f latn -w G -W -t -X "" -I -m "bin/scripts/Hack/Hack-Bold-TA.txt" "${fontfile}.tmp" "$fontfile"
|
2016-12-15 04:50:36 +02:00
|
|
|
else
|
|
|
|
echo "[Nerd Fonts] Could not find any Knack (Hack) fonts to hint..."
|
2016-12-03 21:57:11 +02:00
|
|
|
fi
|
|
|
|
|
|
|
|
# clean-up
|
2016-12-15 03:10:42 +02:00
|
|
|
rm "${fontfile}.tmp"
|
2016-12-03 21:57:11 +02:00
|
|
|
|
|
|
|
echo "[Nerd Fonts] Completed Autohinting Hack '$fontfile'"
|
|
|
|
|
|
|
|
exit 0
|
|
|
|
|
|
|
|
|