renames woff web font build script from build-web.sh to build-woff.sh

pull/291/head
Chris Simpkins 2017-08-25 22:40:43 +07:00
parent e07c3eb0d3
commit 0715aa9c5d
1 changed files with 23 additions and 15 deletions

@ -1,13 +1,13 @@
#!/bin/sh #!/bin/sh
# ///////////////////////////////////////////////////////////////// # ///////////////////////////////////////////////////////////////////
# #
# build-web.sh # build-woff.sh
# A shell script that builds the Hack web fonts from ttf files # A shell script that builds the Hack woff web fonts from ttf files
# Copyright 2017 Christopher Simpkins # Copyright 2017 Christopher Simpkins
# MIT License # MIT License
# #
# Usage: ./build-web.sh (--install-dependencies) # Usage: ./build-woff.sh (--install-dependencies)
# Arguments: # Arguments:
# --install-dependencies (optional) - installs all # --install-dependencies (optional) - installs all
# build dependencies prior to the build script execution # build dependencies prior to the build script execution
@ -17,7 +17,7 @@
# This script builds directly from previous ttf builds, # This script builds directly from previous ttf builds,
# not source files. # not source files.
# #
# ///////////////////////////////////////////////////////////////// # ///////////////////////////////////////////////////////////////////
# The sfnt2woff-zopfli build directory. # The sfnt2woff-zopfli build directory.
BUILD="$HOME/sfnt2woff-zopfli-build" BUILD="$HOME/sfnt2woff-zopfli-build"
@ -49,13 +49,16 @@ BOLDITALIC_WOFF="hack-bolditalic.woff"
if [ $# -gt 1 ] if [ $# -gt 1 ]
then then
echo "Inappropriate arguments included in your command." 1>&2 echo "Inappropriate arguments included in your command." 1>&2
echo "Usage: ./build-web.sh (--install-dependencies)" 1>&2 echo "Usage: ./build-woff.sh (--install-dependencies)" 1>&2
exit 1 exit 1
fi fi
# Optional build dependency install request with syntax `./build-web.sh --install-dependencies` # Optional build dependency install request with syntax `./build-web.sh --install-dependencies`
if [ "$1" = "--install-dependencies" ] if [ "$1" = "--install-dependencies" ]
then then
# define the current directory (Hack repository)
CUR_DIR=$(pwd)
if test -d "$BUILD" -o -f "$BUILD"; then if test -d "$BUILD" -o -f "$BUILD"; then
echo "Build directory \`$BUILD' must not exist." echo "Build directory \`$BUILD' must not exist."
exit 1 exit 1
@ -84,6 +87,9 @@ if [ "$1" = "--install-dependencies" ]
echo "#####" echo "#####"
make make
# make Hack repository the current directory again following the build
cd "$CUR_DIR" || exit 1
fi fi
@ -100,7 +106,7 @@ if ! "$SFNTWOFF_BIN" "$TTF_BUILD/$REGULAR_TTF"; then
echo "Failed to build $REGULAR_WOFF from $REGULAR_TTF." 1>&2 echo "Failed to build $REGULAR_WOFF from $REGULAR_TTF." 1>&2
exit 1 exit 1
else else
echo "Regular web font set successfully built from $REGULAR_TTF" echo "Regular woff set successfully built from $REGULAR_TTF"
fi fi
# bold set # bold set
@ -108,15 +114,15 @@ if ! "$SFNTWOFF_BIN" "$TTF_BUILD/$BOLD_TTF"; then
echo "Failed to build $BOLD_WOFF from $BOLD_TTF" 1>&2 echo "Failed to build $BOLD_WOFF from $BOLD_TTF" 1>&2
exit 1 exit 1
else else
echo "Bold web font set successfully built from $BOLD_TTF" echo "Bold woff set successfully built from $BOLD_TTF"
fi fi
# italic set # italic set
if ! "$SFNTWOFF_BIN" "$TTF_BUILD/$ITALIC_TTF"; then if ! "$SFNTWOFF_BIN" "$TTF_BUILD/$ITALIC_TTF"; then
echo "Failed to build $BOLD_WOFF from $ITALIC_TTF" 1>&2 echo "Failed to build $BOLD_WOFF from $ITALIC_TTF" 1>&2
exit 1 exit 1
else else
echo "Italic web font set successfully built from $ITALIC_TTF" echo "Italic woff set successfully built from $ITALIC_TTF"
fi fi
# bold italic set # bold italic set
@ -124,9 +130,11 @@ if ! "$SFNTWOFF_BIN" "$TTF_BUILD/$BOLDITALIC_TTF"; then
echo "Failed to build $BOLDITALIC_WOFF from $BOLDITALIC_TTF" 1>&2 echo "Failed to build $BOLDITALIC_WOFF from $BOLDITALIC_TTF" 1>&2
exit 1 exit 1
else else
echo "Bold Italic web font set successfully built from $BOLDITALIC_TTF" echo "Bold Italic woff set successfully built from $BOLDITALIC_TTF"
fi fi
echo "Moving woff files to build directory..."
# move woff files to appropriate build directory # move woff files to appropriate build directory
mv "$TTF_BUILD/$REGULAR_PRE" "$WOFF_BUILD/$REGULAR_WOFF" mv "$TTF_BUILD/$REGULAR_PRE" "$WOFF_BUILD/$REGULAR_WOFF"
mv "$TTF_BUILD/$BOLD_PRE" "$WOFF_BUILD/$BOLD_WOFF" mv "$TTF_BUILD/$BOLD_PRE" "$WOFF_BUILD/$BOLD_WOFF"
@ -136,19 +144,19 @@ mv "$TTF_BUILD/$BOLDITALIC_PRE" "$WOFF_BUILD/$BOLDITALIC_WOFF"
echo " " echo " "
if [ -f "$WOFF_BUILD/$REGULAR_WOFF" ]; then if [ -f "$WOFF_BUILD/$REGULAR_WOFF" ]; then
echo "Regular web font path: $WOFF_BUILD/$REGULAR_WOFF" echo "Regular woff build path: $WOFF_BUILD/$REGULAR_WOFF"
fi fi
if [ -f "$WOFF_BUILD/$BOLD_WOFF" ]; then if [ -f "$WOFF_BUILD/$BOLD_WOFF" ]; then
echo "Bold web font path: $WOFF_BUILD/$BOLD_WOFF" echo "Bold woff build path: $WOFF_BUILD/$BOLD_WOFF"
fi fi
if [ -f "$WOFF_BUILD/$ITALIC_WOFF" ]; then if [ -f "$WOFF_BUILD/$ITALIC_WOFF" ]; then
echo "Italic web font path: $WOFF_BUILD/$ITALIC_WOFF" echo "Italic woff build path: $WOFF_BUILD/$ITALIC_WOFF"
fi fi
if [ -f "$WOFF_BUILD/$BOLDITALIC_WOFF" ]; then if [ -f "$WOFF_BUILD/$BOLDITALIC_WOFF" ]; then
echo "Bold Italic web font path: $WOFF_BUILD/$BOLDITALIC_WOFF" echo "Bold Italic woff build path: $WOFF_BUILD/$BOLDITALIC_WOFF"
fi fi