|
@@ -0,0 +1,428 @@
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+TTFAH="$HOME/ttfautohint-build/local/bin/ttfautohint"
|
|
|
+
|
|
|
+
|
|
|
+SFNTWOFF_BUILD="$HOME/sfnt2woff-zopfli-build"
|
|
|
+
|
|
|
+
|
|
|
+SFNTWOFF_VERSION="1.1.0"
|
|
|
+SFNTWOFF="sfnt2woff-zopfli-$SFNTWOFF_VERSION"
|
|
|
+
|
|
|
+
|
|
|
+SFNTWOFF_BIN="$SFNTWOFF_BUILD/$SFNTWOFF/sfnt2woff-zopfli"
|
|
|
+ZOPFLI_ITERATIONS="3"
|
|
|
+
|
|
|
+
|
|
|
+WOFF2_BUILD="$HOME"
|
|
|
+
|
|
|
+WOFF2_BIN="$WOFF2_BUILD/woff2/woff2_compress"
|
|
|
+
|
|
|
+
|
|
|
+TTF_BUILD="master_ttf"
|
|
|
+
|
|
|
+REGULAR_TTF="Hack-Regular.ttf"
|
|
|
+REGULAR_WOFF_PRE="Hack-Regular.woff"
|
|
|
+REGULAR_WOFF="hack-regular-subset.woff"
|
|
|
+REGULAR_WOFF2_PRE="Hack-Regular.woff2"
|
|
|
+REGULAR_WOFF2="hack-regular-subset.woff2"
|
|
|
+
|
|
|
+BOLD_TTF="Hack-Bold.ttf"
|
|
|
+BOLD_WOFF_PRE="Hack-Bold.woff"
|
|
|
+BOLD_WOFF="hack-bold-subset.woff"
|
|
|
+BOLD_WOFF2_PRE="Hack-Bold.woff2"
|
|
|
+BOLD_WOFF2="hack-bold-subset.woff2"
|
|
|
+
|
|
|
+ITALIC_TTF="Hack-Italic.ttf"
|
|
|
+ITALIC_WOFF_PRE="Hack-Italic.woff"
|
|
|
+ITALIC_WOFF="hack-italic-subset.woff"
|
|
|
+ITALIC_WOFF2_PRE="Hack-Italic.woff2"
|
|
|
+ITALIC_WOFF2="hack-italic-subset.woff2"
|
|
|
+
|
|
|
+BOLDITALIC_TTF="Hack-BoldItalic.ttf"
|
|
|
+BOLDITALIC_WOFF_PRE="Hack-BoldItalic.woff"
|
|
|
+BOLDITALIC_WOFF="hack-bolditalic-subset.woff"
|
|
|
+BOLDITALIC_WOFF2_PRE="Hack-BoldItalic.woff2"
|
|
|
+BOLDITALIC_WOFF2="hack-bolditalic-subset.woff2"
|
|
|
+
|
|
|
+
|
|
|
+WEB_BUILD="build/web"
|
|
|
+
|
|
|
+
|
|
|
+if [ $# -gt 0 ]
|
|
|
+ then
|
|
|
+ echo "Inappropriate arguments included in your command." 1>&2
|
|
|
+ echo "Usage: ./build-subsets.sh" 1>&2
|
|
|
+ exit 1
|
|
|
+fi
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+INSTALLFLAG=0
|
|
|
+
|
|
|
+echo "Confirming that build dependencies are installed..."
|
|
|
+echo " "
|
|
|
+
|
|
|
+
|
|
|
+if ! which fontmake
|
|
|
+ then
|
|
|
+ echo "fontmake was not found. Please attempt to install this with ./build-ttf.sh --install-dependencies, then execute this script again" 1>&2
|
|
|
+ INSTALLFLAG=1
|
|
|
+fi
|
|
|
+
|
|
|
+
|
|
|
+if ! python -c "import fontTools"
|
|
|
+ then
|
|
|
+ echo "The fontTools library was not found. Please attempt to install this with ./build-ttf.sh --install-dependencies, then execute this script again" 1>&2
|
|
|
+ INSTALLFLAG=1
|
|
|
+else
|
|
|
+ echo "fontTools Python library identified"
|
|
|
+fi
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+if ! [ -f "$TTFAH" ]
|
|
|
+ then
|
|
|
+ if ! which ttfautohint
|
|
|
+ then
|
|
|
+ echo "ttfautohint was not found. Please attempt to install this with ./build-ttf.sh --install-dependencies, then execute this script again." 1>&2
|
|
|
+ INSTALLFLAG=1
|
|
|
+ else
|
|
|
+ TTFAH="ttfautohint"
|
|
|
+ echo "ttfautohint executable identified"
|
|
|
+ fi
|
|
|
+ else
|
|
|
+ echo "ttfautohint executable identified"
|
|
|
+fi
|
|
|
+
|
|
|
+
|
|
|
+if ! [ -f "$SFNTWOFF_BIN" ]
|
|
|
+ then
|
|
|
+ echo "sfnt2woff-zopfli was not found. Please attempt to install this with ./build-woff.sh --install-dependencies, then execute this script again" 1>&2
|
|
|
+ INSTALLFLAG=1
|
|
|
+else
|
|
|
+ echo "sfnt2woff-zopfli executable identified"
|
|
|
+fi
|
|
|
+
|
|
|
+
|
|
|
+if ! [ -f "$WOFF2_BIN" ]
|
|
|
+ then
|
|
|
+ echo "woff2 was not found. Please attempt to install this with ./build-woff2.sh --install-dependencies, then execute this script again" 1>&2
|
|
|
+ INSTALLFLAG=1
|
|
|
+else
|
|
|
+ echo "woff2_compress executable identified"
|
|
|
+fi
|
|
|
+
|
|
|
+
|
|
|
+if [ $INSTALLFLAG -eq 1 ]
|
|
|
+ then
|
|
|
+ echo "Build canceled." 1>&2
|
|
|
+ exit 1
|
|
|
+fi
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+echo "Starting web font subset build..."
|
|
|
+echo " "
|
|
|
+
|
|
|
+
|
|
|
+if [ -d "master_ttf" ]; then
|
|
|
+ rm -rf master_ttf
|
|
|
+fi
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+if ! fontmake --subset -u "source/Hack-Regular.ufo" -o ttf
|
|
|
+ then
|
|
|
+ echo "Unable to build the Hack-Regular variant subset. Build canceled." 1>&2
|
|
|
+ exit 1
|
|
|
+fi
|
|
|
+
|
|
|
+
|
|
|
+if ! fontmake --subset -u "source/Hack-Bold.ufo" -o ttf
|
|
|
+ then
|
|
|
+ echo "Unable to build the Hack-Bold variant subset. Build canceled." 1>&2
|
|
|
+ exit 1
|
|
|
+fi
|
|
|
+
|
|
|
+
|
|
|
+if ! fontmake --subset -u "source/Hack-Italic.ufo" -o ttf
|
|
|
+ then
|
|
|
+ echo "Unable to build the Hack-Italic variant subset. Build canceled." 1>&2
|
|
|
+ exit 1
|
|
|
+fi
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+if ! fontmake --subset -u "source/Hack-BoldItalic.ufo" -o ttf
|
|
|
+ then
|
|
|
+ echo "Unable to build the Hack-BoldItalic variant subset. Build canceled." 1>&2
|
|
|
+ exit 1
|
|
|
+fi
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+echo " "
|
|
|
+echo "Attempting DSIG table fixes with fontbakery..."
|
|
|
+echo " "
|
|
|
+if ! python postbuild_processing/fixes/fix-dsig.py master_ttf/*.ttf
|
|
|
+ then
|
|
|
+ echo "Unable to complete DSIG table fixes on the release files"
|
|
|
+ exit 1
|
|
|
+fi
|
|
|
+
|
|
|
+
|
|
|
+echo " "
|
|
|
+echo "Attempting fstype fixes with fontbakery..."
|
|
|
+echo " "
|
|
|
+if ! python postbuild_processing/fixes/fix-fstype.py master_ttf/*.ttf
|
|
|
+ then
|
|
|
+ echo "Unable to complete fstype fixes on the release files"
|
|
|
+ exit 1
|
|
|
+fi
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+echo " "
|
|
|
+echo "Attempting ttfautohint hinting..."
|
|
|
+echo " "
|
|
|
+
|
|
|
+mkdir master_ttf/hinted
|
|
|
+
|
|
|
+
|
|
|
+if ! "$TTFAH" -l 6 -r 50 -x 10 -H 181 -D latn -f latn -w G -W -t -X "" -I -R "master_ttf/Hack-Regular.ttf" -m "postbuild_processing/tt-hinting/Hack-Regular-TA.txt" "master_ttf/Hack-Regular.ttf" "master_ttf/hinted/Hack-Regular.ttf"
|
|
|
+ then
|
|
|
+ echo "Unable to execute ttfautohint on the Hack-Regular variant subset. Build canceled." 1>&2
|
|
|
+ exit 1
|
|
|
+fi
|
|
|
+echo "master_ttf/Hack-Regular.ttf subset - successful hinting with ttfautohint"
|
|
|
+
|
|
|
+
|
|
|
+if ! "$TTFAH" -l 6 -r 50 -x 10 -H 260 -D latn -f latn -w G -W -t -X "" -I -R "master_ttf/Hack-Regular.ttf" -m "postbuild_processing/tt-hinting/Hack-Bold-TA.txt" "master_ttf/Hack-Bold.ttf" "master_ttf/hinted/Hack-Bold.ttf"
|
|
|
+ then
|
|
|
+ echo "Unable to execute ttfautohint on the Hack-Bold variant subset. Build canceled." 1>&2
|
|
|
+ exit 1
|
|
|
+fi
|
|
|
+echo "master_ttf/Hack-Bold.ttf subset - successful hinting with ttfautohint"
|
|
|
+
|
|
|
+
|
|
|
+if ! "$TTFAH" -l 6 -r 50 -x 10 -H 145 -D latn -f latn -w G -W -t -X "" -I -R "master_ttf/Hack-Regular.ttf" -m "postbuild_processing/tt-hinting/Hack-Italic-TA.txt" "master_ttf/Hack-Italic.ttf" "master_ttf/hinted/Hack-Italic.ttf"
|
|
|
+ then
|
|
|
+ echo "Unable to execute ttfautohint on the Hack-Italic variant subset. Build canceled." 1>&2
|
|
|
+ exit 1
|
|
|
+fi
|
|
|
+echo "master_ttf/Hack-Italic.ttf subset - successful hinting with ttfautohint"
|
|
|
+
|
|
|
+
|
|
|
+if ! "$TTFAH" -l 6 -r 50 -x 10 -H 265 -D latn -f latn -w G -W -t -X "" -I -R "master_ttf/Hack-Regular.ttf" -m "postbuild_processing/tt-hinting/Hack-BoldItalic-TA.txt" "master_ttf/Hack-BoldItalic.ttf" "master_ttf/hinted/Hack-BoldItalic.ttf"
|
|
|
+ then
|
|
|
+ echo "Unable to execute ttfautohint on the Hack-BoldItalic variant subset. Build canceled." 1>&2
|
|
|
+ exit 1
|
|
|
+fi
|
|
|
+echo "master_ttf/Hack-BoldItalic.ttf subset - successful hinting with ttfautohint"
|
|
|
+echo " "
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+if ! "$SFNTWOFF_BIN" -n $ZOPFLI_ITERATIONS "$TTF_BUILD/$REGULAR_TTF"; then
|
|
|
+ echo "Failed to build $REGULAR_WOFF from $REGULAR_TTF." 1>&2
|
|
|
+ exit 1
|
|
|
+else
|
|
|
+ echo "Regular woff subset successfully built from $REGULAR_TTF"
|
|
|
+fi
|
|
|
+
|
|
|
+
|
|
|
+if ! "$SFNTWOFF_BIN" -n $ZOPFLI_ITERATIONS "$TTF_BUILD/$BOLD_TTF"; then
|
|
|
+ echo "Failed to build $BOLD_WOFF from $BOLD_TTF" 1>&2
|
|
|
+ exit 1
|
|
|
+else
|
|
|
+ echo "Bold woff subset successfully built from $BOLD_TTF"
|
|
|
+fi
|
|
|
+
|
|
|
+
|
|
|
+if ! "$SFNTWOFF_BIN" -n $ZOPFLI_ITERATIONS "$TTF_BUILD/$ITALIC_TTF"; then
|
|
|
+ echo "Failed to build $BOLD_WOFF from $ITALIC_TTF" 1>&2
|
|
|
+ exit 1
|
|
|
+else
|
|
|
+ echo "Italic woff subset successfully built from $ITALIC_TTF"
|
|
|
+fi
|
|
|
+
|
|
|
+
|
|
|
+if ! "$SFNTWOFF_BIN" -n $ZOPFLI_ITERATIONS "$TTF_BUILD/$BOLDITALIC_TTF"; then
|
|
|
+ echo "Failed to build $BOLDITALIC_WOFF from $BOLDITALIC_TTF" 1>&2
|
|
|
+ exit 1
|
|
|
+else
|
|
|
+ echo "Bold Italic woff subset successfully built from $BOLDITALIC_TTF"
|
|
|
+fi
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+echo " "
|
|
|
+
|
|
|
+
|
|
|
+if ! "$WOFF2_BIN" "$TTF_BUILD/$REGULAR_TTF"; then
|
|
|
+ echo "Failed to build woff2 subset from $REGULAR_TTF." 1>&2
|
|
|
+ exit 1
|
|
|
+else
|
|
|
+ echo "Regular woff2 font subset successfully built from $REGULAR_TTF"
|
|
|
+fi
|
|
|
+
|
|
|
+
|
|
|
+if ! "$WOFF2_BIN" "$TTF_BUILD/$BOLD_TTF"; then
|
|
|
+ echo "Failed to build woff2 subset from $BOLD_TTF" 1>&2
|
|
|
+ exit 1
|
|
|
+else
|
|
|
+ echo "Bold woff2 subset successfully built from $BOLD_TTF"
|
|
|
+fi
|
|
|
+
|
|
|
+
|
|
|
+if ! "$WOFF2_BIN" "$TTF_BUILD/$ITALIC_TTF"; then
|
|
|
+ echo "Failed to build woff2 subset from $ITALIC_TTF" 1>&2
|
|
|
+ exit 1
|
|
|
+else
|
|
|
+ echo "Italic woff2 subset successfully built from $ITALIC_TTF"
|
|
|
+fi
|
|
|
+
|
|
|
+
|
|
|
+if ! "$WOFF2_BIN" "$TTF_BUILD/$BOLDITALIC_TTF"; then
|
|
|
+ echo "Failed to build woff2 subset from $BOLDITALIC_TTF" 1>&2
|
|
|
+ exit 1
|
|
|
+else
|
|
|
+ echo "Bold Italic woff2 subset successfully built from $BOLDITALIC_TTF"
|
|
|
+fi
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+echo " "
|
|
|
+echo "Moving woff files to build directory..."
|
|
|
+
|
|
|
+
|
|
|
+mv "$TTF_BUILD/$REGULAR_WOFF_PRE" "$WEB_BUILD/$REGULAR_WOFF"
|
|
|
+mv "$TTF_BUILD/$BOLD_WOFF_PRE" "$WEB_BUILD/$BOLD_WOFF"
|
|
|
+mv "$TTF_BUILD/$ITALIC_WOFF_PRE" "$WEB_BUILD/$ITALIC_WOFF"
|
|
|
+mv "$TTF_BUILD/$BOLDITALIC_WOFF_PRE" "$WEB_BUILD/$BOLDITALIC_WOFF"
|
|
|
+
|
|
|
+if [ -f "$WEB_BUILD/$REGULAR_WOFF" ]; then
|
|
|
+ echo "Regular woff build path: $WEB_BUILD/$REGULAR_WOFF"
|
|
|
+fi
|
|
|
+
|
|
|
+if [ -f "$WEB_BUILD/$BOLD_WOFF" ]; then
|
|
|
+ echo "Bold woff build path: $WEB_BUILD/$BOLD_WOFF"
|
|
|
+fi
|
|
|
+
|
|
|
+if [ -f "$WEB_BUILD/$ITALIC_WOFF" ]; then
|
|
|
+ echo "Italic woff build path: $WEB_BUILD/$ITALIC_WOFF"
|
|
|
+fi
|
|
|
+
|
|
|
+if [ -f "$WEB_BUILD/$BOLDITALIC_WOFF" ]; then
|
|
|
+ echo "Bold Italic woff build path: $WEB_BUILD/$BOLDITALIC_WOFF"
|
|
|
+fi
|
|
|
+
|
|
|
+echo "Moving woff2 files to build directory..."
|
|
|
+
|
|
|
+
|
|
|
+mv "$TTF_BUILD/$REGULAR_WOFF2_PRE" "$WEB_BUILD/$REGULAR_WOFF2"
|
|
|
+mv "$TTF_BUILD/$BOLD_WOFF2_PRE" "$WEB_BUILD/$BOLD_WOFF2"
|
|
|
+mv "$TTF_BUILD/$ITALIC_WOFF2_PRE" "$WEB_BUILD/$ITALIC_WOFF2"
|
|
|
+mv "$TTF_BUILD/$BOLDITALIC_WOFF2_PRE" "$WEB_BUILD/$BOLDITALIC_WOFF2"
|
|
|
+
|
|
|
+if [ -f "$WEB_BUILD/$REGULAR_WOFF2" ]; then
|
|
|
+ echo "Regular woff build path: $WEB_BUILD/$REGULAR_WOFF2"
|
|
|
+fi
|
|
|
+
|
|
|
+if [ -f "$WEB_BUILD/$BOLD_WOFF2" ]; then
|
|
|
+ echo "Bold woff build path: $WEB_BUILD/$BOLD_WOFF2"
|
|
|
+fi
|
|
|
+
|
|
|
+if [ -f "$WEB_BUILD/$ITALIC_WOFF2" ]; then
|
|
|
+ echo "Italic woff build path: $WEB_BUILD/$ITALIC_WOFF2"
|
|
|
+fi
|
|
|
+
|
|
|
+if [ -f "$WEB_BUILD/$BOLDITALIC_WOFF2" ]; then
|
|
|
+ echo "Bold Italic woff build path: $WEB_BUILD/$BOLDITALIC_WOFF2"
|
|
|
+fi
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+rm -rf master_ttf
|
|
|
+
|