From 84900249b9b3a67beebb888e1e24c84fbfc4fd63 Mon Sep 17 00:00:00 2001 From: Chris Simpkins Date: Wed, 7 Mar 2018 17:29:27 -0500 Subject: [PATCH 01/39] add support for pipenv Python dependency version pinning adds Pipfile and Pipfile.lock with currently installed build versions used for Hack v3.003 build --- Pipfile | 20 +++++++ Pipfile.lock | 144 +++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 164 insertions(+) create mode 100644 Pipfile create mode 100644 Pipfile.lock diff --git a/Pipfile b/Pipfile new file mode 100644 index 000000000..eda2f9356 --- /dev/null +++ b/Pipfile @@ -0,0 +1,20 @@ +[[source]] + +url = "https://pypi.python.org/simple" +verify_ssl = true +name = "pypi" + + +[packages] + +fonttools = "*" +fontmake = "*" + + +[dev-packages] + + + +[requires] + +python_version = "3.6" diff --git a/Pipfile.lock b/Pipfile.lock new file mode 100644 index 000000000..f6710e190 --- /dev/null +++ b/Pipfile.lock @@ -0,0 +1,144 @@ +{ + "_meta": { + "hash": { + "sha256": "60fe748ce602e0ad6290ca1db986d09913e7fdefee286a24b92af07cf8d9bb77" + }, + "pipfile-spec": 6, + "requires": { + "python_version": "3.6" + }, + "sources": [ + { + "name": "pypi", + "url": "https://pypi.python.org/simple", + "verify_ssl": true + } + ] + }, + "default": { + "booleanoperations": { + "hashes": [ + "sha256:62723b7cabe3e727546df945c155e2f8be9514ef8c4f3b2f0f5cdb24ebbcfdf1", + "sha256:e405de0126aaf0f6e4f3dcebd18079db601e825e123cb095366b2a50e9abbc8c" + ], + "version": "==0.8.0" + }, + "compreffor": { + "hashes": [ + "sha256:02e03207bd74b8792ea51ff8ad7922d246a38886fc9a5ef4a65391cf0095533f", + "sha256:33ae053dcf2545bdcf9eb56d0ebc5ccc8a0bc49374a9fb3af35971c39109cca6", + "sha256:3c0eed769ecfc0da821cb46ee63d2ac4ab4342560d879a5e9ff194c191d72539", + "sha256:55ce6038dac9f58121ec066ccff8ff9cb4704f663f7ab40d5a548885bc949765", + "sha256:56d4997450c1303f3af4666120b8a504d3787900cc6c565851104371b00ea75d", + "sha256:71bb9f86f150bc132cc3a1c9f7d8b1171eb81603d7af79fc98c424780e468c6a", + "sha256:778ae7e6dd8115748fe3a25d80acd9dfe713a847868e083e0c67bc4c6f4aa220", + "sha256:902ce5a0264f17d693f517468d0cf0e33e0713198d485a43b99bb657baa3933c", + "sha256:bf6f12b7804bd3549df31bd5d77fe8ea3723c12d9f5ce697855b5361ab0e9f7a", + "sha256:c9578301995e9e011896a2ee3751419256b33342004b6ea6d34960c51d1463d5", + "sha256:cd503ea6bceb3dbb39c7f99dce1074803f031ba5980157b91e895a740c40f849", + "sha256:ce932125880f337a6d35cfe4ec444f5c3452ab3baa7e790a819f769499b1e2ff", + "sha256:cee7caea337b9396d9680cb847da8ead569c26974c64d80bd4977611b95aa687", + "sha256:d7edd2216462d5c730ea44fabab6369991fe628a30016bc21157a8aeff0cddb6", + "sha256:eac13d9df51e7ed8ef72c9fdfe82cd9fbab4740f63a441834b7a122a561111a2", + "sha256:faa61f3481a33cc93ae3cbd6daa501fec5091528d9465b86202c0ba7989db067", + "sha256:fc0bfb08401998c02c427e3d530d56b4bb185dd098ef6a017d61bc5080752763", + "sha256:fc7d4fb787b91d903733cbd9c1aa0374499d3ed92a2a45cd9d12483aa0203819" + ], + "version": "==0.4.6" + }, + "cu2qu": { + "hashes": [ + "sha256:b177236481117339a7b9363ab018b31f0cbf80b199abe64e33a10adaddb93a61", + "sha256:f6cb02827079ed41838ddb7d073ad7a426662a2f4fd7be32f33826b64f6facdb" + ], + "version": "==1.4.0" + }, + "defcon": { + "hashes": [ + "sha256:42bcc52bd2a277091c27af4d2ec9308db7a6fc20b5b9898ce46bd3e49fa8540e", + "sha256:a6e27b5d938501514378c5b8adfc2315f738756deef7f1165b6eddf1c40ebb0a" + ], + "version": "==0.3.5" + }, + "fontmake": { + "hashes": [ + "sha256:537586d53e040a8f990ca68ca6efcfc1ac57a080d1dadc6478f79271fce6f5f5", + "sha256:6582efe3b4ae777ee1b6e71f8e94466a68a91935b317dfbf444a32928d6f74c9" + ], + "version": "==1.4.0" + }, + "fontmath": { + "hashes": [ + "sha256:0be82c86eeb620608f7d6c4509e66246d02b95641d686cb8df668a6697ee8f9d", + "sha256:2a7bbee59c2e06659e95c3e9c4a656d19fe0584a2f2bc711588e1c884e14bf14" + ], + "version": "==0.4.4" + }, + "fonttools": { + "hashes": [ + "sha256:5cc459fb891968e35852fceb93aad4272fa782f90332ffb603f0fcab1d0ac2d6", + "sha256:d13e98c9f3b635a5334dab69eb471d7286928ac82db7ca57b5bf4cdf3824789a" + ], + "version": "==3.24.1" + }, + "glyphslib": { + "hashes": [ + "sha256:d1e920e3969434ca1701887ac98372bff5dd0642af8a2b386504dff266610a3f", + "sha256:f56b1bf874b9f99228d610933a9cced919374da8a24059e927376a0a5355d081" + ], + "version": "==2.2.1" + }, + "mutatormath": { + "hashes": [ + "sha256:46bb5209af53ee245d0e6cb9fe47f4f5718db7c158136715cd28494b239395c5", + "sha256:ebf8291637c7de30fe83f9402dad17c6ac9e1feb16d530e0a560d8e6abf48fce" + ], + "version": "==2.1.0" + }, + "pyclipper": { + "hashes": [ + "sha256:013dc2a39722914e2399a7608012c21da81c0e719e4aee958d0cbf3f603094ac", + "sha256:04337a635dc5cd6a17bc9a85f778eeb4b9569bb9a87d789005d1b7e86dadf8ca", + "sha256:191f12cd9ec385d44f181786d250d29b07c515c0b2d6e28d91fe482649d0525b", + "sha256:19beee2f26f6037f7d42aac0acc216d73bd2cc6dc36a6fc0565767de5080b4ba", + "sha256:1c9c298039727c1896c013d7b25bcddd8e778b4f06d8d20c019b0a4679c26446", + "sha256:209a770d211e760b33c8b8af60dc475ad16aea68a5f1f80e66128ce5da7bcb27", + "sha256:30823cd4f27345ef303ea6c1ec7a964fa43067063a76e31cfea032954c648039", + "sha256:3f11e87f0b82bccc6de57eead2628ca419694352e8b843bcd228eec9c9357680", + "sha256:3fa17ca0bb2b78c22efd1844a13789d351b51516a54b9cd8c482afef9c2cff04", + "sha256:5726921e921990915f441ad91304280b26a0d5e70882d503da4e741425100c5e", + "sha256:5ef5c5633c1783836837b7b198c35dec54d9506d9ff5695b4293fe96de8b5481", + "sha256:75d03cf5e6fc6c18329e51e9f1662d9d21c37f99692438761022f5ced7300ebc", + "sha256:79b2b1bf113045481d3f418e692f15e089b2053574accfc951fd9d0b73132204", + "sha256:8794d4f29a650854f503fc63f96a06baec30c604771149b474db92499edc8072", + "sha256:8f09d9eac721726eb7db9bd94597d1910e472a4d08dcb2adb715700124827d3e", + "sha256:9f67c98a51ed0296046f8448ecc25a8d61ab97c55b4281984b2bbfa883813c7b", + "sha256:a1bb42a403e1cfcaaf826384647faa6039c163b4a4a9960c194f37ee48148c00", + "sha256:b06076efafb1e3d4f14b63e8da69da34f883eb541844df108f2629866f42d02a", + "sha256:b685844cc5eb196fbbcd1970e37a6216e257683bba82e4c81030dc7060c027fd", + "sha256:bf23b1343411d977b82ea018189c8c9b84f9da5ea74a3e8c9444e71318a51488", + "sha256:c158f2eab791ce072190188b82dba131475337a6ca5db3a63c78454d21ab989a", + "sha256:d3da370f6947c54e1146784d5deda0ab789f2184a2e189a8e05aaa2cfd9ed82b", + "sha256:e0cd47d425dfa2e1f9da74eeca5b0b568b439d5fa397fbf2979ac2c33eb1772a", + "sha256:e938e1a13f10d1770602ad505c00d7cad3e685adc4548c041ae2d56ca04b4dba", + "sha256:ea169703d1c7a53f6eb8fcbe8ec4057db7064fabbdc402be3bc016218b72c0d5" + ], + "version": "==1.1.0" + }, + "ufo2ft": { + "hashes": [ + "sha256:3fc0aa8283fa28fecf0cf2e86c327778a32cfd1955ae62731fdff0463bd8d6a5", + "sha256:aa2b8dd983b61e401015ced8d30540df39a5f3faf7a6b1e38c15fe23f18749c5" + ], + "version": "==1.1.0" + }, + "ufolib": { + "hashes": [ + "sha256:0cead288602914f6c3fcad6e7b704f2d27797658eaba8637b48cd64784e807f7", + "sha256:34fd6a7492350526beac0d108a6cf8f6059c629150300a864a91837f7a351e1f" + ], + "version": "==2.1.1" + } + }, + "develop": {} +} From 384f3fa9467a46d39e6c0b88a0295bf9391c1edf Mon Sep 17 00:00:00 2001 From: Chris Simpkins Date: Wed, 7 Mar 2018 17:52:20 -0500 Subject: [PATCH 02/39] copies build-ttf.sh as build-ttf-system.sh to use as basis for scripting of system installed versions of build tools --- build-ttf-system.sh | 223 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 223 insertions(+) create mode 100755 build-ttf-system.sh diff --git a/build-ttf-system.sh b/build-ttf-system.sh new file mode 100755 index 000000000..1558dece2 --- /dev/null +++ b/build-ttf-system.sh @@ -0,0 +1,223 @@ +#!/bin/sh + +# ///////////////////////////////////////////////////////////////// +# +# build-ttf.sh +# A shell script that builds the Hack ttf fonts from UFO source +# Copyright 2018 Christopher Simpkins +# MIT License +# +# Usage: ./build-ttf.sh (--install-dependencies) +# Arguments: +# --install-dependencies (optional) - installs all +# build dependencies prior to the build script execution +# +# ///////////////////////////////////////////////////////////////// + +# ttfautohint local install path from Werner Lemberg's ttfautohint-build.sh install script +# - This is revised to ttfautohint on the user's PATH if this local install is not identified +# then the identified ttfautohint is used to execute hinting. Versions of ttfautohint < 1.6 exit with status +# code 1 due to use of -R option +# - The intent is to support use of ttfautohint installed on a user's PATH (e.g. they've previously installed it) +TTFAH="$HOME/ttfautohint-build/local/bin/ttfautohint" + +# test for number of arguments +if [ $# -gt 1 ] + then + echo "Inappropriate arguments included in your command." 1>&2 + echo "Usage: ./build-ttf.sh (--install-dependencies)" 1>&2 + exit 1 +fi + +# Optional build dependency install request with syntax `./build.sh --install-dependencies` +if [ "$1" = "--install-dependencies" ] + then + # fontmake + pip install --upgrade fontmake + # fontTools (installed with fontmake at this time. leave this as dependency check as python scripts for fixes require it should fontTools eliminate dep) + pip install --upgrade fonttools + # ttfautohint v1.6 (must be pinned to v1.6 and above for Hack instruction sets) + tools/scripts/install/ttfautohint-build.sh + +fi + +# confirm executable installs and library imports for build dependencies +INSTALLFLAG=0 + +echo "Confirming that build dependencies are installed..." +echo " " +# fontmake installed +if ! which fontmake + then + echo "Unable to install fontmake with 'pip install fontmake'. Please attempt a manual install of this build dependency and then repeat your build attempt." 1>&2 + INSTALLFLAG=1 +fi +# fontTools python library can be imported +if ! python -c "import fontTools" + then + echo "Unable to install fontTools with 'pip install fonttools'. Please attempt a manual install of this build dependency and then repeat your build attempt." 1>&2 + INSTALLFLAG=1 +else + echo "fontTools Python library identified" +fi +# ttfautohint installed +# - tests for install to local path from ttfautohint-build.sh script +# - if not found on this path, tests for install on system PATH - if found, revises TTFAH to the string "ttfautohint" for execution of instruction sets +if ! [ -f "$TTFAH" ] + then + if ! which ttfautohint + then + echo "Unable to install ttfautohint from source. Please attempt a manual install of this build dependency and then repeat your build attempt." 1>&2 + INSTALLFLAG=1 + else + TTFAH="ttfautohint" # revise TTFAH variable to ttfautohint installed on the user's PATH for excecution of hints below + fi +fi +# if any of the dependency installs failed, exit and do not attempt build, notify user +if [ $INSTALLFLAG -eq 1 ] + then + echo "Build canceled." 1>&2 + exit 1 +fi + +# Desktop ttf font build + +echo "Starting build..." +echo " " + +# remove any existing release files from the build directory +if [ -f "build/ttf/Hack-Regular.ttf" ]; then + rm build/ttf/Hack-Regular.ttf +fi + +if [ -f "build/ttf/Hack-Italic.ttf" ]; then + rm build/ttf/Hack-Italic.ttf +fi + +if [ -f "build/ttf/Hack-Bold.ttf" ]; then + rm build/ttf/Hack-Bold.ttf +fi + +if [ -f "build/ttf/Hack-BoldItalic.ttf" ]; then + rm build/ttf/Hack-BoldItalic.ttf +fi + +# remove master_ttf directory if a previous build failed + exited early and it was not cleaned up + +if [ -d "master_ttf" ]; then + rm -rf master_ttf +fi + +# build regular set + +if ! fontmake -u "source/Hack-Regular.ufo" -o ttf + then + echo "Unable to build the Hack-Regular variant set. Build canceled." 1>&2 + exit 1 +fi + +# build bold set +if ! fontmake -u "source/Hack-Bold.ufo" -o ttf + then + echo "Unable to build the Hack-Bold variant set. Build canceled." 1>&2 + exit 1 +fi + +# build italic set +if ! fontmake -u "source/Hack-Italic.ufo" -o ttf + then + echo "Unable to build the Hack-Italic variant set. Build canceled." 1>&2 + exit 1 +fi + +# build bold italic set + +if ! fontmake -u "source/Hack-BoldItalic.ufo" -o ttf + then + echo "Unable to build the Hack-BoldItalic variant set. Build canceled." 1>&2 + exit 1 +fi + +# Desktop ttf font post build fixes + +# DSIG table fix with adapted fontbakery Python script +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 + +# fstype value fix with adapted fontbakery Python script +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 + +# Desktop ttf font hinting + +echo " " +echo "Attempting ttfautohint hinting..." +echo " " +# make a temporary directory for the hinted files +mkdir master_ttf/hinted + +# Hack-Regular.ttf +if ! "$TTFAH" -l 6 -r 50 -x 10 -H 181 -D latn -f latn -w G -W -t -X "" -I -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 set. Build canceled." 1>&2 + exit 1 +fi +echo "master_ttf/Hack-Regular.ttf - successful hinting with ttfautohint" + +# Hack-Bold.ttf +if ! "$TTFAH" -l 6 -r 50 -x 10 -H 260 -D latn -f latn -w G -W -t -X "" -I -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 set. Build canceled." 1>&2 + exit 1 +fi +echo "master_ttf/Hack-Bold.ttf - successful hinting with ttfautohint" + +# Hack-Italic.ttf +if ! "$TTFAH" -l 6 -r 50 -x 10 -H 145 -D latn -f latn -w G -W -t -X "" -I -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 set. Build canceled." 1>&2 + exit 1 +fi +echo "master_ttf/Hack-Italic.ttf - successful hinting with ttfautohint" + +# Hack-BoldItalic.ttf +if ! "$TTFAH" -l 6 -r 50 -x 10 -H 265 -D latn -f latn -w G -W -t -X "" -I -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 set. Build canceled." 1>&2 + exit 1 +fi +echo "master_ttf/Hack-BoldItalic.ttf - successful hinting with ttfautohint" +echo " " + +# Move release files to build directory +echo " " + +# create directory if it does not exist +# (occurs with git + empty directories) +if ! [ -d build/ttf ]; then + mkdir build/ttf +fi + +mv master_ttf/hinted/Hack-Regular.ttf build/ttf/Hack-Regular.ttf +echo "Regular ttf build path: build/ttf/Hack-Regular.ttf" +mv master_ttf/hinted/Hack-Italic.ttf build/ttf/Hack-Italic.ttf +echo "Italic ttf build path: build/ttf/Hack-Italic.ttf" +mv master_ttf/hinted/Hack-Bold.ttf build/ttf/Hack-Bold.ttf +echo "Bold ttf build path: build/ttf/Hack-Bold.ttf" +mv master_ttf/hinted/Hack-BoldItalic.ttf build/ttf/Hack-BoldItalic.ttf +echo "Bold Italic ttf build path: build/ttf/Hack-BoldItalic.ttf" + +# Remove master_ttf directory +rm -rf master_ttf From fe6e6ba46c5c8f6f7c5c1213b9a91a0e9039e83f Mon Sep 17 00:00:00 2001 From: Chris Simpkins Date: Wed, 7 Mar 2018 20:01:50 -0500 Subject: [PATCH 03/39] [build-pipenv.sh] added new shell script that supports builds of venv with pinned Python package versions using pipenv --- build-pipenv.sh | 50 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) create mode 100644 build-pipenv.sh diff --git a/build-pipenv.sh b/build-pipenv.sh new file mode 100644 index 000000000..05cb92b4b --- /dev/null +++ b/build-pipenv.sh @@ -0,0 +1,50 @@ +#!/bin/sh + +# ///////////////////////////////////////////////////////////////// +# +# build-pipenv.sh +# A shell script that creates a virtualenv for Hack font builds +# Copyright 2018 Christopher Simpkins +# MIT License +# +# Usage: ./build-pipenv.sh +# +# ///////////////////////////////////////////////////////////////// + +if ! which pipenv + then + echo "Unable to detect a pipenv install. Please install with `pip install pipenv` then repeat your build attempt." 1>&2 + exit 1 +done + +# install fontTools and fontmake build dependencies with pipenv +pipenv install --ignore-pipfile fontmake fontTools + +# test for fontmake install in venv +if ! pipenv run fontmake --version + then + echo "Unable to detect fontmake install with pipenv. Please repeat your build attempt." 1>&2 + exit 1 +done + +# test for fontTools install in venv +if ! pipenv run python -c "import fontTools" + then + echo "Unable to detect fontTools install with pipenv. Please repeat your build attempt." 1>&2 + exit 1 +done + +# print environment used for build to std output stream + +echo "=================================" +echo " BUILD ENVIRONMENT" +echo "=================================" +echo " " + +pipenv graph + +echo " " +echo "=================================" +echo " END BUILD ENVIRONMENT" +echo "=================================" +echo " " From e3c0e97f3bec21b1d62e239fc6a09fa3f5114e4a Mon Sep 17 00:00:00 2001 From: Chris Simpkins Date: Wed, 7 Mar 2018 20:02:11 -0500 Subject: [PATCH 04/39] updated script documentation --- build-ttf.sh | 4 ---- 1 file changed, 4 deletions(-) diff --git a/build-ttf.sh b/build-ttf.sh index 1558dece2..18c1f4e82 100755 --- a/build-ttf.sh +++ b/build-ttf.sh @@ -15,10 +15,6 @@ # ///////////////////////////////////////////////////////////////// # ttfautohint local install path from Werner Lemberg's ttfautohint-build.sh install script -# - This is revised to ttfautohint on the user's PATH if this local install is not identified -# then the identified ttfautohint is used to execute hinting. Versions of ttfautohint < 1.6 exit with status -# code 1 due to use of -R option -# - The intent is to support use of ttfautohint installed on a user's PATH (e.g. they've previously installed it) TTFAH="$HOME/ttfautohint-build/local/bin/ttfautohint" # test for number of arguments From 1700e78bdf7299102b74dac633e872f62434ef6b Mon Sep 17 00:00:00 2001 From: Chris Simpkins Date: Wed, 7 Mar 2018 20:06:35 -0500 Subject: [PATCH 05/39] [build-pipenv.sh] modified if blocks in shell script --- build-pipenv.sh | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) mode change 100644 => 100755 build-pipenv.sh diff --git a/build-pipenv.sh b/build-pipenv.sh old mode 100644 new mode 100755 index 05cb92b4b..812d14c18 --- a/build-pipenv.sh +++ b/build-pipenv.sh @@ -13,9 +13,9 @@ if ! which pipenv then - echo "Unable to detect a pipenv install. Please install with `pip install pipenv` then repeat your build attempt." 1>&2 + echo "Unable to detect a pipenv install. Please install with 'pip install pipenv' then repeat your build attempt." 1>&2 exit 1 -done +fi # install fontTools and fontmake build dependencies with pipenv pipenv install --ignore-pipfile fontmake fontTools @@ -25,19 +25,19 @@ if ! pipenv run fontmake --version then echo "Unable to detect fontmake install with pipenv. Please repeat your build attempt." 1>&2 exit 1 -done +fi # test for fontTools install in venv if ! pipenv run python -c "import fontTools" then echo "Unable to detect fontTools install with pipenv. Please repeat your build attempt." 1>&2 exit 1 -done +fi # print environment used for build to std output stream echo "=================================" -echo " BUILD ENVIRONMENT" +echo " PYTHON BUILD ENVIRONMENT" echo "=================================" echo " " @@ -45,6 +45,6 @@ pipenv graph echo " " echo "=================================" -echo " END BUILD ENVIRONMENT" +echo " END PYTHON BUILD ENVIRONMENT" echo "=================================" echo " " From 74d359ef6b86ac974a8bf0d9c1001f39c0e00d0a Mon Sep 17 00:00:00 2001 From: Chris Simpkins Date: Wed, 7 Mar 2018 20:18:11 -0500 Subject: [PATCH 06/39] [build-pipenv.sh] add Python interpreter version to environment report --- build-pipenv.sh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/build-pipenv.sh b/build-pipenv.sh index 812d14c18..2a6fa0645 100755 --- a/build-pipenv.sh +++ b/build-pipenv.sh @@ -40,7 +40,9 @@ echo "=================================" echo " PYTHON BUILD ENVIRONMENT" echo "=================================" echo " " - +echo "Python interpreter version:" +pipenv run python --version +echo " " pipenv graph echo " " From 0eb8a96a5cae0b596334df49d559a40f3965b87c Mon Sep 17 00:00:00 2001 From: Chris Simpkins Date: Wed, 7 Mar 2018 20:19:56 -0500 Subject: [PATCH 07/39] [build-ttf.sh] transitioned Python build tool calls to use of pipenv virtual env with pinned versions --- build-ttf.sh | 33 +++++++-------------------------- 1 file changed, 7 insertions(+), 26 deletions(-) diff --git a/build-ttf.sh b/build-ttf.sh index 18c1f4e82..46c97d8f3 100755 --- a/build-ttf.sh +++ b/build-ttf.sh @@ -28,10 +28,6 @@ fi # Optional build dependency install request with syntax `./build.sh --install-dependencies` if [ "$1" = "--install-dependencies" ] then - # fontmake - pip install --upgrade fontmake - # fontTools (installed with fontmake at this time. leave this as dependency check as python scripts for fixes require it should fontTools eliminate dep) - pip install --upgrade fonttools # ttfautohint v1.6 (must be pinned to v1.6 and above for Hack instruction sets) tools/scripts/install/ttfautohint-build.sh @@ -40,22 +36,7 @@ fi # confirm executable installs and library imports for build dependencies INSTALLFLAG=0 -echo "Confirming that build dependencies are installed..." -echo " " -# fontmake installed -if ! which fontmake - then - echo "Unable to install fontmake with 'pip install fontmake'. Please attempt a manual install of this build dependency and then repeat your build attempt." 1>&2 - INSTALLFLAG=1 -fi -# fontTools python library can be imported -if ! python -c "import fontTools" - then - echo "Unable to install fontTools with 'pip install fonttools'. Please attempt a manual install of this build dependency and then repeat your build attempt." 1>&2 - INSTALLFLAG=1 -else - echo "fontTools Python library identified" -fi + # ttfautohint installed # - tests for install to local path from ttfautohint-build.sh script # - if not found on this path, tests for install on system PATH - if found, revises TTFAH to the string "ttfautohint" for execution of instruction sets @@ -106,21 +87,21 @@ fi # build regular set -if ! fontmake -u "source/Hack-Regular.ufo" -o ttf +if ! pipenv run fontmake -u "source/Hack-Regular.ufo" -o ttf then echo "Unable to build the Hack-Regular variant set. Build canceled." 1>&2 exit 1 fi # build bold set -if ! fontmake -u "source/Hack-Bold.ufo" -o ttf +if ! pipenv run fontmake -u "source/Hack-Bold.ufo" -o ttf then echo "Unable to build the Hack-Bold variant set. Build canceled." 1>&2 exit 1 fi # build italic set -if ! fontmake -u "source/Hack-Italic.ufo" -o ttf +if ! pipenv run fontmake -u "source/Hack-Italic.ufo" -o ttf then echo "Unable to build the Hack-Italic variant set. Build canceled." 1>&2 exit 1 @@ -128,7 +109,7 @@ fi # build bold italic set -if ! fontmake -u "source/Hack-BoldItalic.ufo" -o ttf +if ! pipenv run fontmake -u "source/Hack-BoldItalic.ufo" -o ttf then echo "Unable to build the Hack-BoldItalic variant set. Build canceled." 1>&2 exit 1 @@ -140,7 +121,7 @@ fi echo " " echo "Attempting DSIG table fixes with fontbakery..." echo " " -if ! python postbuild_processing/fixes/fix-dsig.py master_ttf/*.ttf +if ! pipenv run python postbuild_processing/fixes/fix-dsig.py master_ttf/*.ttf then echo "Unable to complete DSIG table fixes on the release files" exit 1 @@ -150,7 +131,7 @@ fi echo " " echo "Attempting fstype fixes with fontbakery..." echo " " -if ! python postbuild_processing/fixes/fix-fstype.py master_ttf/*.ttf +if ! pipenv run python postbuild_processing/fixes/fix-fstype.py master_ttf/*.ttf then echo "Unable to complete fstype fixes on the release files" exit 1 From 176a14a964f2067cbc9327a8e0c5d6e6bd6490ba Mon Sep 17 00:00:00 2001 From: Chris Simpkins Date: Wed, 7 Mar 2018 20:32:33 -0500 Subject: [PATCH 08/39] [build-subsets.sh] eliminated build dependency checks, these are now performed elsewhere in scripting --- build-subsets.sh | 19 ------------------- 1 file changed, 19 deletions(-) diff --git a/build-subsets.sh b/build-subsets.sh index 42df0dc4d..7b439998e 100755 --- a/build-subsets.sh +++ b/build-subsets.sh @@ -96,25 +96,6 @@ fi INSTALLFLAG=0 -echo "Confirming that build dependencies are installed..." -echo " " - -# fontmake installed -if ! which fontmake - then - echo "fontmake was not found. Please install all build dependencies with 'make build-with-dependencies', then attempt your build again." 1>&2 - INSTALLFLAG=1 -fi - -# fontTools python library can be imported -if ! python -c "import fontTools" - then - echo "The fontTools library was not found. Please install all build dependencies with 'make build-with-dependencies', then attempt your build again." 1>&2 - INSTALLFLAG=1 -else - echo "fontTools Python library identified" -fi - # ttfautohint installed # - tests for install to local path from ttfautohint-build.sh script # - if not found on this path, tests for install on system PATH - if found, revises TTFAH to the string "ttfautohint" for execution of instruction sets From bda185c80d9d9f609c119e834c8b993db69c0273 Mon Sep 17 00:00:00 2001 From: Chris Simpkins Date: Wed, 7 Mar 2018 20:34:56 -0500 Subject: [PATCH 09/39] [build-subsets.sh] transitioned to use of pipenv virtualenv installs of pinned Python build dependency versions for builds --- build-subsets.sh | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/build-subsets.sh b/build-subsets.sh index 7b439998e..63e350166 100755 --- a/build-subsets.sh +++ b/build-subsets.sh @@ -185,21 +185,21 @@ fi # build regular subset -if ! fontmake --subset -u "$TEMP_SOURCE/Hack-Regular.ufo" -o ttf +if ! pipenv run fontmake --subset -u "$TEMP_SOURCE/Hack-Regular.ufo" -o ttf then echo "Unable to build the Hack-Regular variant subset. Build canceled." 1>&2 exit 1 fi # build bold subset -if ! fontmake --subset -u "$TEMP_SOURCE/Hack-Bold.ufo" -o ttf +if ! pipenv run fontmake --subset -u "$TEMP_SOURCE/Hack-Bold.ufo" -o ttf then echo "Unable to build the Hack-Bold variant subset. Build canceled." 1>&2 exit 1 fi # build italic subset -if ! fontmake --subset -u "$TEMP_SOURCE/Hack-Italic.ufo" -o ttf +if ! pipenv run fontmake --subset -u "$TEMP_SOURCE/Hack-Italic.ufo" -o ttf then echo "Unable to build the Hack-Italic variant subset. Build canceled." 1>&2 exit 1 @@ -207,7 +207,7 @@ fi # build bold italic subset -if ! fontmake --subset -u "$TEMP_SOURCE/Hack-BoldItalic.ufo" -o ttf +if ! pipenv run fontmake --subset -u "$TEMP_SOURCE/Hack-BoldItalic.ufo" -o ttf then echo "Unable to build the Hack-BoldItalic variant subset. Build canceled." 1>&2 exit 1 @@ -226,7 +226,7 @@ fi echo " " echo "Attempting DSIG table fixes with fontbakery..." echo " " -if ! python postbuild_processing/fixes/fix-dsig.py master_ttf/*.ttf +if ! pipenv run python postbuild_processing/fixes/fix-dsig.py master_ttf/*.ttf then echo "Unable to complete DSIG table fixes on the release files" exit 1 @@ -236,7 +236,7 @@ fi echo " " echo "Attempting fstype fixes with fontbakery..." echo " " -if ! python postbuild_processing/fixes/fix-fstype.py master_ttf/*.ttf +if ! pipenv run python postbuild_processing/fixes/fix-fstype.py master_ttf/*.ttf then echo "Unable to complete fstype fixes on the release files" exit 1 From da2088260a7297b14250cb15aa25ffb779e3daef Mon Sep 17 00:00:00 2001 From: Chris Simpkins Date: Thu, 8 Mar 2018 17:30:08 -0500 Subject: [PATCH 10/39] [Makefile] added pipenv venv setup script to the build process --- Makefile | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 458d0cf75..d76f3d360 100644 --- a/Makefile +++ b/Makefile @@ -6,6 +6,7 @@ archives: build: ttf webfonts build-with-dependencies: source/*.ufo + ./build-pipenv.sh ./build-ttf.sh --install-dependencies ./build-woff.sh --install-dependencies ./build-woff2.sh --install-dependencies @@ -16,19 +17,22 @@ css: lint: shellcheck ufolint -shellcheck: build-ttf.sh build-woff.sh build-woff2.sh build-subsets.sh tools/scripts/install/ttfautohint-build.sh postbuild_processing/archive_prep/archiver.sh tools/scripts/css/css-build.sh +shellcheck: build-pipenv.sh build-ttf.sh build-woff.sh build-woff2.sh build-subsets.sh tools/scripts/install/ttfautohint-build.sh postbuild_processing/archive_prep/archiver.sh tools/scripts/css/css-build.sh $@ $^ subsets: source/*.ufo + ./build-pipenv.sh ./build-subsets.sh ttf: + ./build-pipenv.sh ./build-ttf.sh ufolint: source/*.ufo $@ $^ webfonts: + ./build-pipenv.sh ./build-woff.sh ./build-woff2.sh ./build-subsets.sh From 7de5d6510eb62da0d1d54860d6cf4ee60e3ad08f Mon Sep 17 00:00:00 2001 From: Chris Simpkins Date: Wed, 14 Mar 2018 20:17:32 -0400 Subject: [PATCH 11/39] added Python interpreter version definition to virtualenv scripting --- build-pipenv.sh | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/build-pipenv.sh b/build-pipenv.sh index 2a6fa0645..883478710 100755 --- a/build-pipenv.sh +++ b/build-pipenv.sh @@ -11,6 +11,8 @@ # # ///////////////////////////////////////////////////////////////// +PYTHON_VERSION="3.6" + if ! which pipenv then echo "Unable to detect a pipenv install. Please install with 'pip install pipenv' then repeat your build attempt." 1>&2 @@ -18,7 +20,7 @@ if ! which pipenv fi # install fontTools and fontmake build dependencies with pipenv -pipenv install --ignore-pipfile fontmake fontTools +pipenv install --python $PYTHON_VERSION --ignore-pipfile fontmake fontTools # test for fontmake install in venv if ! pipenv run fontmake --version @@ -47,6 +49,6 @@ pipenv graph echo " " echo "=================================" -echo " END PYTHON BUILD ENVIRONMENT" +echo " " echo "=================================" echo " " From 10c544471dc25c6143d76a602c9d0263bbfd2b9e Mon Sep 17 00:00:00 2001 From: Chris Simpkins Date: Wed, 14 Mar 2018 20:21:28 -0400 Subject: [PATCH 12/39] modified build variable name --- build-pipenv.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/build-pipenv.sh b/build-pipenv.sh index 883478710..a13110f0a 100755 --- a/build-pipenv.sh +++ b/build-pipenv.sh @@ -11,7 +11,7 @@ # # ///////////////////////////////////////////////////////////////// -PYTHON_VERSION="3.6" +BUILD_PYTHON_VERSION="3.6" if ! which pipenv then @@ -20,7 +20,7 @@ if ! which pipenv fi # install fontTools and fontmake build dependencies with pipenv -pipenv install --python $PYTHON_VERSION --ignore-pipfile fontmake fontTools +pipenv install --python $BUILD_PYTHON_VERSION --ignore-pipfile fontmake fontTools # test for fontmake install in venv if ! pipenv run fontmake --version From aff9f86001d59013347886837e570c52e1620cf9 Mon Sep 17 00:00:00 2001 From: Chris Simpkins Date: Wed, 14 Mar 2018 20:22:29 -0400 Subject: [PATCH 13/39] removed unnecessary build shell script --- build-ttf-system.sh | 223 -------------------------------------------- 1 file changed, 223 deletions(-) delete mode 100755 build-ttf-system.sh diff --git a/build-ttf-system.sh b/build-ttf-system.sh deleted file mode 100755 index 1558dece2..000000000 --- a/build-ttf-system.sh +++ /dev/null @@ -1,223 +0,0 @@ -#!/bin/sh - -# ///////////////////////////////////////////////////////////////// -# -# build-ttf.sh -# A shell script that builds the Hack ttf fonts from UFO source -# Copyright 2018 Christopher Simpkins -# MIT License -# -# Usage: ./build-ttf.sh (--install-dependencies) -# Arguments: -# --install-dependencies (optional) - installs all -# build dependencies prior to the build script execution -# -# ///////////////////////////////////////////////////////////////// - -# ttfautohint local install path from Werner Lemberg's ttfautohint-build.sh install script -# - This is revised to ttfautohint on the user's PATH if this local install is not identified -# then the identified ttfautohint is used to execute hinting. Versions of ttfautohint < 1.6 exit with status -# code 1 due to use of -R option -# - The intent is to support use of ttfautohint installed on a user's PATH (e.g. they've previously installed it) -TTFAH="$HOME/ttfautohint-build/local/bin/ttfautohint" - -# test for number of arguments -if [ $# -gt 1 ] - then - echo "Inappropriate arguments included in your command." 1>&2 - echo "Usage: ./build-ttf.sh (--install-dependencies)" 1>&2 - exit 1 -fi - -# Optional build dependency install request with syntax `./build.sh --install-dependencies` -if [ "$1" = "--install-dependencies" ] - then - # fontmake - pip install --upgrade fontmake - # fontTools (installed with fontmake at this time. leave this as dependency check as python scripts for fixes require it should fontTools eliminate dep) - pip install --upgrade fonttools - # ttfautohint v1.6 (must be pinned to v1.6 and above for Hack instruction sets) - tools/scripts/install/ttfautohint-build.sh - -fi - -# confirm executable installs and library imports for build dependencies -INSTALLFLAG=0 - -echo "Confirming that build dependencies are installed..." -echo " " -# fontmake installed -if ! which fontmake - then - echo "Unable to install fontmake with 'pip install fontmake'. Please attempt a manual install of this build dependency and then repeat your build attempt." 1>&2 - INSTALLFLAG=1 -fi -# fontTools python library can be imported -if ! python -c "import fontTools" - then - echo "Unable to install fontTools with 'pip install fonttools'. Please attempt a manual install of this build dependency and then repeat your build attempt." 1>&2 - INSTALLFLAG=1 -else - echo "fontTools Python library identified" -fi -# ttfautohint installed -# - tests for install to local path from ttfautohint-build.sh script -# - if not found on this path, tests for install on system PATH - if found, revises TTFAH to the string "ttfautohint" for execution of instruction sets -if ! [ -f "$TTFAH" ] - then - if ! which ttfautohint - then - echo "Unable to install ttfautohint from source. Please attempt a manual install of this build dependency and then repeat your build attempt." 1>&2 - INSTALLFLAG=1 - else - TTFAH="ttfautohint" # revise TTFAH variable to ttfautohint installed on the user's PATH for excecution of hints below - fi -fi -# if any of the dependency installs failed, exit and do not attempt build, notify user -if [ $INSTALLFLAG -eq 1 ] - then - echo "Build canceled." 1>&2 - exit 1 -fi - -# Desktop ttf font build - -echo "Starting build..." -echo " " - -# remove any existing release files from the build directory -if [ -f "build/ttf/Hack-Regular.ttf" ]; then - rm build/ttf/Hack-Regular.ttf -fi - -if [ -f "build/ttf/Hack-Italic.ttf" ]; then - rm build/ttf/Hack-Italic.ttf -fi - -if [ -f "build/ttf/Hack-Bold.ttf" ]; then - rm build/ttf/Hack-Bold.ttf -fi - -if [ -f "build/ttf/Hack-BoldItalic.ttf" ]; then - rm build/ttf/Hack-BoldItalic.ttf -fi - -# remove master_ttf directory if a previous build failed + exited early and it was not cleaned up - -if [ -d "master_ttf" ]; then - rm -rf master_ttf -fi - -# build regular set - -if ! fontmake -u "source/Hack-Regular.ufo" -o ttf - then - echo "Unable to build the Hack-Regular variant set. Build canceled." 1>&2 - exit 1 -fi - -# build bold set -if ! fontmake -u "source/Hack-Bold.ufo" -o ttf - then - echo "Unable to build the Hack-Bold variant set. Build canceled." 1>&2 - exit 1 -fi - -# build italic set -if ! fontmake -u "source/Hack-Italic.ufo" -o ttf - then - echo "Unable to build the Hack-Italic variant set. Build canceled." 1>&2 - exit 1 -fi - -# build bold italic set - -if ! fontmake -u "source/Hack-BoldItalic.ufo" -o ttf - then - echo "Unable to build the Hack-BoldItalic variant set. Build canceled." 1>&2 - exit 1 -fi - -# Desktop ttf font post build fixes - -# DSIG table fix with adapted fontbakery Python script -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 - -# fstype value fix with adapted fontbakery Python script -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 - -# Desktop ttf font hinting - -echo " " -echo "Attempting ttfautohint hinting..." -echo " " -# make a temporary directory for the hinted files -mkdir master_ttf/hinted - -# Hack-Regular.ttf -if ! "$TTFAH" -l 6 -r 50 -x 10 -H 181 -D latn -f latn -w G -W -t -X "" -I -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 set. Build canceled." 1>&2 - exit 1 -fi -echo "master_ttf/Hack-Regular.ttf - successful hinting with ttfautohint" - -# Hack-Bold.ttf -if ! "$TTFAH" -l 6 -r 50 -x 10 -H 260 -D latn -f latn -w G -W -t -X "" -I -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 set. Build canceled." 1>&2 - exit 1 -fi -echo "master_ttf/Hack-Bold.ttf - successful hinting with ttfautohint" - -# Hack-Italic.ttf -if ! "$TTFAH" -l 6 -r 50 -x 10 -H 145 -D latn -f latn -w G -W -t -X "" -I -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 set. Build canceled." 1>&2 - exit 1 -fi -echo "master_ttf/Hack-Italic.ttf - successful hinting with ttfautohint" - -# Hack-BoldItalic.ttf -if ! "$TTFAH" -l 6 -r 50 -x 10 -H 265 -D latn -f latn -w G -W -t -X "" -I -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 set. Build canceled." 1>&2 - exit 1 -fi -echo "master_ttf/Hack-BoldItalic.ttf - successful hinting with ttfautohint" -echo " " - -# Move release files to build directory -echo " " - -# create directory if it does not exist -# (occurs with git + empty directories) -if ! [ -d build/ttf ]; then - mkdir build/ttf -fi - -mv master_ttf/hinted/Hack-Regular.ttf build/ttf/Hack-Regular.ttf -echo "Regular ttf build path: build/ttf/Hack-Regular.ttf" -mv master_ttf/hinted/Hack-Italic.ttf build/ttf/Hack-Italic.ttf -echo "Italic ttf build path: build/ttf/Hack-Italic.ttf" -mv master_ttf/hinted/Hack-Bold.ttf build/ttf/Hack-Bold.ttf -echo "Bold ttf build path: build/ttf/Hack-Bold.ttf" -mv master_ttf/hinted/Hack-BoldItalic.ttf build/ttf/Hack-BoldItalic.ttf -echo "Bold Italic ttf build path: build/ttf/Hack-BoldItalic.ttf" - -# Remove master_ttf directory -rm -rf master_ttf From 4d8a9a13257b8014902014c99209cb156c497851 Mon Sep 17 00:00:00 2001 From: Chris Simpkins Date: Wed, 14 Mar 2018 21:10:25 -0400 Subject: [PATCH 14/39] added new sfnt2woff-zopfli local install script --- .../scripts/install/sfnt2woff-zopfli-build.sh | 58 +++++++++++++++++++ 1 file changed, 58 insertions(+) create mode 100755 tools/scripts/install/sfnt2woff-zopfli-build.sh diff --git a/tools/scripts/install/sfnt2woff-zopfli-build.sh b/tools/scripts/install/sfnt2woff-zopfli-build.sh new file mode 100755 index 000000000..4cdd9bcf7 --- /dev/null +++ b/tools/scripts/install/sfnt2woff-zopfli-build.sh @@ -0,0 +1,58 @@ +#!/bin/sh + +# ///////////////////////////////////////////////////////////////// +# +# sfnt2woff-zopfli-build.sh +# A shell script that builds the sfnt2woff-zopfli build dependency +# Copyright 2018 Christopher Simpkins +# MIT License +# +# Usage: ./sfnt2woff-zopfli-build.sh +# +# ///////////////////////////////////////////////////////////////// + +# The sfnt2woff-zopfli build directory. +BUILD="$HOME/sfnt2woff-zopfli-build" + +# sfnt2woff-zopfli version +SFNTWOFF_VERSION="1.1.0" +SFNTWOFF="sfnt2woff-zopfli-$SFNTWOFF_VERSION" + +# Path to sfnt2woff-zopfli executable +SFNTWOFF_BIN="$BUILD/$SFNTWOFF/sfnt2woff-zopfli" + +if test -d "$BUILD" -o -f "$BUILD"; then + echo "Build directory '$BUILD' must not exist." + exit 1 +fi + +mkdir "$BUILD" + +cd "$BUILD" || exit 1 + +echo "#####" +echo "Download archive." +echo "#####" + +curl -L -O "https://github.com/bramstein/sfnt2woff-zopfli/archive/v$SFNTWOFF_VERSION.tar.gz" + +echo "#####" +echo "Extract archives." +echo "#####" + +tar -xzvf "v$SFNTWOFF_VERSION.tar.gz" + +cd "$SFNTWOFF" || exit 1 + +echo "#####" +echo "Build $SFNTWOFF." +echo "#####" + +make + +if [ -f "$SFNTWOFF_BIN" ]; then + echo "sfnt2woff-zopfli successfully built on the path '$SFNTWOFF_BIN'" +else + echo "The sfnt2woff-zopfli build failed." + exit 1 +fi From 953c35b258c050d87ca12542651530742bebac00 Mon Sep 17 00:00:00 2001 From: Chris Simpkins Date: Wed, 14 Mar 2018 21:12:56 -0400 Subject: [PATCH 15/39] [build-ttf.sh] updated script to support pinned and system installed build dep versions --- build-ttf.sh | 96 +++++++++++++++++++++++++++++++--------------------- 1 file changed, 58 insertions(+), 38 deletions(-) diff --git a/build-ttf.sh b/build-ttf.sh index 46c97d8f3..5a6e6edbe 100755 --- a/build-ttf.sh +++ b/build-ttf.sh @@ -7,52 +7,72 @@ # Copyright 2018 Christopher Simpkins # MIT License # -# Usage: ./build-ttf.sh (--install-dependencies) +# Usage: ./build-ttf.sh (--system) # Arguments: -# --install-dependencies (optional) - installs all -# build dependencies prior to the build script execution +# --system (optional) - use system installed build dependencies # # ///////////////////////////////////////////////////////////////// -# ttfautohint local install path from Werner Lemberg's ttfautohint-build.sh install script +# default build tooling definitions TTFAH="$HOME/ttfautohint-build/local/bin/ttfautohint" +FONTMAKE="pipenv run fontmake" +PYTHON="pipenv run python" +INSTALLFLAG=0 # test for number of arguments if [ $# -gt 1 ] then echo "Inappropriate arguments included in your command." 1>&2 - echo "Usage: ./build-ttf.sh (--install-dependencies)" 1>&2 + echo "Usage: ./build-ttf.sh (--system)" 1>&2 exit 1 fi -# Optional build dependency install request with syntax `./build.sh --install-dependencies` -if [ "$1" = "--install-dependencies" ] - then - # ttfautohint v1.6 (must be pinned to v1.6 and above for Hack instruction sets) - tools/scripts/install/ttfautohint-build.sh - -fi - -# confirm executable installs and library imports for build dependencies -INSTALLFLAG=0 - - -# ttfautohint installed -# - tests for install to local path from ttfautohint-build.sh script -# - if not found on this path, tests for install on system PATH - if found, revises TTFAH to the string "ttfautohint" for execution of instruction sets -if ! [ -f "$TTFAH" ] - then - if ! which ttfautohint - then - echo "Unable to install ttfautohint from source. Please attempt a manual install of this build dependency and then repeat your build attempt." 1>&2 - INSTALLFLAG=1 - else - TTFAH="ttfautohint" # revise TTFAH variable to ttfautohint installed on the user's PATH for excecution of hints below - fi -fi -# if any of the dependency installs failed, exit and do not attempt build, notify user -if [ $INSTALLFLAG -eq 1 ] +# Optional build with system-installed build dependencies instead of pinned build process defined versions +if [ "$1" = "--system" ] then + # re-define the default executables to executables that exist on PATH + TTFAH="ttfautohint" + FONTMAKE="fontmake" + PYTHON="python3" + + echo "=================================" + echo " BUILD ENVIRONMENT" + echo "=================================" + # test re-defined system-installed build dependency paths + if ! which "$TTFAH"; then + echo "Unable to identify a system installed version of ttfautohint. Please install and try again." 1>&2 + INSTALLFLAG=1 + else + ttfautohint --version + fi + if ! which "$FONTMAKE"; then + echo "Unable to identify a system installed version of fontmake. Please install and try again." 1>&2 + INSTALLFLAG=1 + else + "$FONTMAKE" --version + fi + if ! which "$PYTHON"; then + echo "Unable to identify a Python 3 installation. Please install and try again." 1>&2 + INSTALLFLAG=1 + else + "$PYTHON" --version + fi + echo "=================================" + echo " " + echo "=================================" + echo " " +fi + +# test for local ttfautohint install using repository provided install script and defined ttfautohint version (and its dependencies) +# no tests for Python build dependencies here because they are always installed by default & tested in the pipenv virtualenv before these steps +if ! [ -f "$TTFAH" ]; then + echo "Unable to identify the expected local install path for ttfautohint. Please install and try again." 1>&2 + INSTALLFLAG=1 +fi + + +# If any of the dependency checks failed, exit the build and notify user +if [ $INSTALLFLAG -eq 1 ]; then echo "Build canceled." 1>&2 exit 1 fi @@ -87,21 +107,21 @@ fi # build regular set -if ! pipenv run fontmake -u "source/Hack-Regular.ufo" -o ttf +if ! $FONTMAKE -u "source/Hack-Regular.ufo" -o ttf then echo "Unable to build the Hack-Regular variant set. Build canceled." 1>&2 exit 1 fi # build bold set -if ! pipenv run fontmake -u "source/Hack-Bold.ufo" -o ttf +if ! $FONTMAKE -u "source/Hack-Bold.ufo" -o ttf then echo "Unable to build the Hack-Bold variant set. Build canceled." 1>&2 exit 1 fi # build italic set -if ! pipenv run fontmake -u "source/Hack-Italic.ufo" -o ttf +if ! $FONTMAKE -u "source/Hack-Italic.ufo" -o ttf then echo "Unable to build the Hack-Italic variant set. Build canceled." 1>&2 exit 1 @@ -109,7 +129,7 @@ fi # build bold italic set -if ! pipenv run fontmake -u "source/Hack-BoldItalic.ufo" -o ttf +if ! $FONTMAKE -u "source/Hack-BoldItalic.ufo" -o ttf then echo "Unable to build the Hack-BoldItalic variant set. Build canceled." 1>&2 exit 1 @@ -121,7 +141,7 @@ fi echo " " echo "Attempting DSIG table fixes with fontbakery..." echo " " -if ! pipenv run python postbuild_processing/fixes/fix-dsig.py master_ttf/*.ttf +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 @@ -131,7 +151,7 @@ fi echo " " echo "Attempting fstype fixes with fontbakery..." echo " " -if ! pipenv run python postbuild_processing/fixes/fix-fstype.py master_ttf/*.ttf +if ! $PYTHON postbuild_processing/fixes/fix-fstype.py master_ttf/*.ttf then echo "Unable to complete fstype fixes on the release files" exit 1 From 14b1912f15e9c5edf5dd38e86e9023d063021f2d Mon Sep 17 00:00:00 2001 From: Chris Simpkins Date: Wed, 14 Mar 2018 21:15:13 -0400 Subject: [PATCH 16/39] [Makefile] updated make targets --- Makefile | 52 +++++++++++++++++++++++++++++++++++----------------- 1 file changed, 35 insertions(+), 17 deletions(-) diff --git a/Makefile b/Makefile index d76f3d360..c263a499d 100644 --- a/Makefile +++ b/Makefile @@ -5,40 +5,58 @@ archives: build: ttf webfonts -build-with-dependencies: source/*.ufo - ./build-pipenv.sh - ./build-ttf.sh --install-dependencies - ./build-woff.sh --install-dependencies - ./build-woff2.sh --install-dependencies - ./build-subsets.sh +build-with-dependencies: compile-local-dep ttf webfonts + +build-system: ttf-system webfonts-system + +build-local-ttfa: + tools/scripts/install/ttfautohint-build.sh + +build-local-sfnt2woffzopfli: + tools/scripts/install/sfnt2woff-zopfli-build.sh + +build-local-woff2: + tools/scripts/install/woff2-build.sh + +compile-local-dep: build-local-ttfa build-local-sfnt2woffzopfli build-local-woff2 css: tools/scripts/css/css-build.sh lint: shellcheck ufolint +pipenv: + ./build-pipenv.sh + shellcheck: build-pipenv.sh build-ttf.sh build-woff.sh build-woff2.sh build-subsets.sh tools/scripts/install/ttfautohint-build.sh postbuild_processing/archive_prep/archiver.sh tools/scripts/css/css-build.sh $@ $^ -subsets: source/*.ufo - ./build-pipenv.sh +subsets: pipenv ./build-subsets.sh -ttf: - ./build-pipenv.sh +ttf: pipenv ./build-ttf.sh +ttf-system: + ./build-ttf.sh --system + ufolint: source/*.ufo $@ $^ -webfonts: - ./build-pipenv.sh - ./build-woff.sh - ./build-woff2.sh - ./build-subsets.sh +webfonts: woff woff2 subsets + +webfonts-system: woff-system woff2-system subsets-system -woff: +woff: pipenv ./build-woff.sh -woff2: +woff-system: + ./build-woff.sh --system + +woff2: pipenv ./build-woff2.sh + +woff2-system: + ./build-woff2.sh --system + +.PHONY: all archives build build-with-dependencies build-local-ttfa build-local-sfnt2woffzopfli build-local-woff2 build-system compile-local-dep css lint pipenv shellcheck subsets ttf ttf-system ufolint webfonts webfonts-system woff woff-system woff2 woff2-system From dd71f61df87660f8f4a2a0ac5cbfaf2295ee9f8b Mon Sep 17 00:00:00 2001 From: Chris Simpkins Date: Wed, 14 Mar 2018 22:02:48 -0400 Subject: [PATCH 17/39] [build-woff.sh] added support for pinned version and system installed build dep compiles --- build-woff.sh | 82 ++++++++++++++++----------------------------------- 1 file changed, 25 insertions(+), 57 deletions(-) diff --git a/build-woff.sh b/build-woff.sh index e98fe145c..e16c0cf5d 100755 --- a/build-woff.sh +++ b/build-woff.sh @@ -7,15 +7,14 @@ # Copyright 2018 Christopher Simpkins # MIT License # -# Usage: ./build-woff.sh (--install-dependencies) +# Usage: ./build-woff.sh (--system) # Arguments: -# --install-dependencies (optional) - installs all -# build dependencies prior to the build script execution +# --system (optional) - build with a system installed version +# of build dependencies # -# NOTE: If you change the source, you must build new ttf files -# with build.sh PRIOR to execution of this script. -# This script builds directly from previous ttf builds, -# not source files. +# NOTE: If you modify the source, you must build new ttf files +# PRIOR to execution of this script. This script builds +# directly from previous ttf builds, not source files. # # /////////////////////////////////////////////////////////////////// @@ -50,55 +49,29 @@ BOLDITALIC_WOFF="hack-bolditalic.woff" if [ $# -gt 1 ] then echo "Inappropriate arguments included in your command." 1>&2 - echo "Usage: ./build-woff.sh (--install-dependencies)" 1>&2 + echo "Usage: ./build-woff.sh (--system)" 1>&2 exit 1 fi -# Optional build dependency install request with syntax `./build-web.sh --install-dependencies` -if [ "$1" = "--install-dependencies" ] - then - # define the current directory (Hack repository) - CUR_DIR=$(pwd) - - if test -d "$BUILD" -o -f "$BUILD"; then - echo "Build directory \`$BUILD' must not exist." - exit 1 - fi - - mkdir "$BUILD" - - cd "$BUILD" || exit 1 - - echo "#####" - echo "Download archive." - echo "#####" - - curl -L -O "https://github.com/bramstein/sfnt2woff-zopfli/archive/v$SFNTWOFF_VERSION.tar.gz" - - echo "#####" - echo "Extract archives." - echo "#####" - - tar -xzvf "v$SFNTWOFF_VERSION.tar.gz" - - cd "$SFNTWOFF" || exit 1 - - echo "#####" - echo "Build $SFNTWOFF." - echo "#####" - - make - - # make Hack repository the current directory again following the build - cd "$CUR_DIR" || exit 1 -fi - - -if [ -f "$SFNTWOFF_BIN" ]; then - echo "Beginning web font build with $SFNTWOFF" +# determine if system installed executable on PATH is requested for build +# then test for presence of the sfnt2woff-zopfli build dependency based upon where it should be located +if [ "$1" = "--system" ]; then + SFNTWOFF_BIN="sfnt2woff-zopfli" + if ! which $SFNTWOFF_BIN; then + echo "Unable to identify sfnt2woff-zopfli executable on system PATH. Please install and try again." 1>&2 + exit 1 + else + # display version of installed sfnt2woff-zopfli + echo "Beginning web font build with $SFNTWOFF_BIN" + fi else - echo "Unable to locate sfnt2woff-zopfli on the path $SFNTWOFF_BIN. Please attempt a manual install of this build dependency and then repeat your build attempt." 1>&2 - exit 1 + if [ -f "$SFNTWOFF_BIN" ]; then + echo "Beginning web font build with $SFNTWOFF_BIN" + else + echo "Unable to locate sfnt2woff-zopfli on the path $SFNTWOFF_BIN. Please install this build dependency and then repeat your build attempt." 1>&2 + exit 1 + fi + fi # Build woff files from ttf files @@ -165,8 +138,3 @@ fi if [ -f "$WOFF_BUILD/$BOLDITALIC_WOFF" ]; then echo "Bold Italic woff build path: $WOFF_BUILD/$BOLDITALIC_WOFF" fi - - - - - From 353455d38eff8e9b72e7cf8056e9bbd86c81cc53 Mon Sep 17 00:00:00 2001 From: Chris Simpkins Date: Thu, 15 Mar 2018 15:10:42 -0400 Subject: [PATCH 18/39] [build-ttf.sh] fixes incorrect executable path checks with system installed ttfautohint builds --- build-ttf.sh | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/build-ttf.sh b/build-ttf.sh index 5a6e6edbe..54fe629a0 100755 --- a/build-ttf.sh +++ b/build-ttf.sh @@ -63,14 +63,16 @@ if [ "$1" = "--system" ] echo " " fi +# ttfautohint path test for default builds # test for local ttfautohint install using repository provided install script and defined ttfautohint version (and its dependencies) # no tests for Python build dependencies here because they are always installed by default & tested in the pipenv virtualenv before these steps -if ! [ -f "$TTFAH" ]; then - echo "Unable to identify the expected local install path for ttfautohint. Please install and try again." 1>&2 - INSTALLFLAG=1 +if [ $# -eq 0 ]; then + if ! [ -f "$TTFAH" ]; then + echo "Unable to identify the expected local install path for ttfautohint. Please install and try again." 1>&2 + INSTALLFLAG=1 + fi fi - # If any of the dependency checks failed, exit the build and notify user if [ $INSTALLFLAG -eq 1 ]; then echo "Build canceled." 1>&2 From 0da551bd942bf8c28a6a3bb87e521e6dd0310bda Mon Sep 17 00:00:00 2001 From: Chris Simpkins Date: Thu, 15 Mar 2018 15:12:00 -0400 Subject: [PATCH 19/39] [build-woff.sh] refactored default build approach path test for dependency --- build-woff.sh | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/build-woff.sh b/build-woff.sh index e16c0cf5d..b11b319dd 100755 --- a/build-woff.sh +++ b/build-woff.sh @@ -64,14 +64,16 @@ if [ "$1" = "--system" ]; then # display version of installed sfnt2woff-zopfli echo "Beginning web font build with $SFNTWOFF_BIN" fi -else +fi + +# test for sfnt2woff-zopfli with default build approach +if [ $# -eq 0 ]; then if [ -f "$SFNTWOFF_BIN" ]; then echo "Beginning web font build with $SFNTWOFF_BIN" else echo "Unable to locate sfnt2woff-zopfli on the path $SFNTWOFF_BIN. Please install this build dependency and then repeat your build attempt." 1>&2 exit 1 fi - fi # Build woff files from ttf files From c0f9b0ca4cd334f460556fccec65222f6d6bc0f2 Mon Sep 17 00:00:00 2001 From: Chris Simpkins Date: Thu, 15 Mar 2018 15:22:01 -0400 Subject: [PATCH 20/39] added new woff2-compress-build shell script for local builds of woff2_compress dependency --- tools/scripts/install/woff2-compress-build.sh | 51 +++++++++++++++++++ 1 file changed, 51 insertions(+) create mode 100755 tools/scripts/install/woff2-compress-build.sh diff --git a/tools/scripts/install/woff2-compress-build.sh b/tools/scripts/install/woff2-compress-build.sh new file mode 100755 index 000000000..7f6c9ddb0 --- /dev/null +++ b/tools/scripts/install/woff2-compress-build.sh @@ -0,0 +1,51 @@ +#!/bin/sh + +# ///////////////////////////////////////////////////////////////// +# +# woff2-compress-build.sh +# A shell script that builds the woff2_compress build dependency +# Copyright 2018 Christopher Simpkins +# MIT License +# +# Usage: ./woff2-compress-build.sh +# +# ///////////////////////////////////////////////////////////////// + +# The woff2 git clone directory. +BUILD="$HOME" +INST="$HOME/woff2" + +# woff2 executable path +WOFF2_BIN="$BUILD/woff2/woff2_compress" + +if test -d "$INST" -o -f "$INST"; then + echo "Build directory \`$INST' must not exist." + exit 1 +fi + +cd "$BUILD" || exit 1 + +echo "#####" +echo "git clone woff2 project" +echo "#####" + +# clone the Source Foundry fork of the woff2 repo +# contains fix for OS X build bug - https://github.com/google/woff2/issues/73 +# recursive flag to clone the brotli submodule within the woff2 repo +git clone --recursive https://github.com/source-foundry/woff2.git + +cd "$INST" || exit 1 + +echo "#####" +echo "Build woff2" +echo "#####" + +make clean all + +if [ -f "$WOFF2_BIN" ]; then + echo " " + echo "woff2_compress successfully built on the path '$WOFF2_BIN'" +else + echo "The woff2_compress build failed." + exit 1 +fi From f1c3c53ba3222905fd52ee93f1f8b9805800370c Mon Sep 17 00:00:00 2001 From: Chris Simpkins Date: Thu, 15 Mar 2018 15:23:34 -0400 Subject: [PATCH 21/39] [Makefile] updated make target shell script path for local woff2_compress builds --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index c263a499d..eb89f0508 100644 --- a/Makefile +++ b/Makefile @@ -16,7 +16,7 @@ build-local-sfnt2woffzopfli: tools/scripts/install/sfnt2woff-zopfli-build.sh build-local-woff2: - tools/scripts/install/woff2-build.sh + tools/scripts/install/woff2-compress-build.sh compile-local-dep: build-local-ttfa build-local-sfnt2woffzopfli build-local-woff2 From 8b05246c0ca1c51352819ce4b0890782725839f4 Mon Sep 17 00:00:00 2001 From: Chris Simpkins Date: Thu, 15 Mar 2018 15:30:42 -0400 Subject: [PATCH 22/39] [build-woff2.sh] added support for pinned dependency builds and rolling system installed dependency builds also eliminates dependency installs through this script, refactored to a different shell script --- build-woff2.sh | 69 ++++++++++++++++++-------------------------------- 1 file changed, 24 insertions(+), 45 deletions(-) diff --git a/build-woff2.sh b/build-woff2.sh index 42cbbab68..c74ac0e34 100755 --- a/build-woff2.sh +++ b/build-woff2.sh @@ -7,15 +7,13 @@ # Copyright 2018 Christopher Simpkins # MIT License # -# Usage: ./build-woff2.sh (--install-dependencies) +# Usage: ./build-woff2.sh (--system) # Arguments: -# --install-dependencies (optional) - installs all -# build dependencies prior to the build script execution +# --system (optional) - use build dependencies installed on PATH # # NOTE: If you change the source, you must build new ttf files -# with build.sh PRIOR to execution of this script. -# This script builds directly from previous ttf builds, -# not source files. +# PRIOR to the execution of this script. This script builds +# directly from previous ttf builds, not source files. # # /////////////////////////////////////////////////////////////////// @@ -47,50 +45,31 @@ BOLDITALIC_WOFF="hack-bolditalic.woff2" if [ $# -gt 1 ] then echo "Inappropriate arguments included in your command." 1>&2 - echo "Usage: ./build-woff2.sh (--install-dependencies)" 1>&2 + echo "Usage: ./build-woff2.sh (--system)" 1>&2 exit 1 fi -# Optional build dependency install request with syntax `./build-web.sh --install-dependencies` -if [ "$1" = "--install-dependencies" ] - then - # define the current directory (Hack repository) - CUR_DIR=$(pwd) - - if test -d "$INST" -o -f "$INST"; then - echo "Build directory \`$INST' must not exist." - exit 1 - fi - - cd "$BUILD" || exit 1 - - echo "#####" - echo "git clone woff2 project" - echo "#####" - - # clone the Source Foundry fork of the woff2 repo - # contains fix for OS X build bug - https://github.com/google/woff2/issues/73 - # recursive flag to clone the brotli submodule within the woff2 repo - git clone --recursive https://github.com/source-foundry/woff2.git - - cd "$INST" || exit 1 - - echo "#####" - echo "Build woff2" - echo "#####" - - make clean all - - # make Hack repository the current directory again following the build - cd "$CUR_DIR" || exit 1 +# determine if system installed executable on PATH is requested for build +# then test for presence of the woff2_compress build dependency based upon where it should be located +if [ "$1" = "--system" ]; then + WOFF2_BIN="woff2_compress" + if ! which $WOFF2_BIN; then + echo "Unable to identify woff2_compress executable on system PATH. Please install and try again." 1>&2 + exit 1 + else + # display version of installed woff2_compress + echo "Beginning web font build with $WOFF2_BIN" + fi fi - -if [ -f "$WOFF2_BIN" ]; then - echo "Beginning web font build with $WOFF2_BIN" -else - echo "Unable to locate woff2_compress on path $WOFF2_BIN. Please attempt a manual install of this build dependency and then repeat your build attempt." 1>&2 - exit 1 +# test for woff2_compress executable with default build approach +if [ $# -eq 0 ]; then + if [ -f "$WOFF2_BIN" ]; then + echo "Beginning web font build with $WOFF2_BIN" + else + echo "Unable to locate woff2_compress on path $WOFF2_BIN. Please attempt a manual install of this build dependency and then repeat your build attempt." 1>&2 + exit 1 + fi fi # Build woff2 files from ttf files From 63c6f0522da438dfb30fe53be250de8d0ffab25e Mon Sep 17 00:00:00 2001 From: Chris Simpkins Date: Thu, 15 Mar 2018 17:11:07 -0400 Subject: [PATCH 23/39] [build-woff2.sh] removed unnecessary variable --- build-woff2.sh | 1 - 1 file changed, 1 deletion(-) diff --git a/build-woff2.sh b/build-woff2.sh index c74ac0e34..5c1a399f1 100755 --- a/build-woff2.sh +++ b/build-woff2.sh @@ -19,7 +19,6 @@ # The woff2 git clone directory. BUILD="$HOME" -INST="$HOME/woff2" # woff2 executable path WOFF2_BIN="$BUILD/woff2/woff2_compress" From 83eac6382dd66a6422cfdcb523b929d47dbda561 Mon Sep 17 00:00:00 2001 From: Chris Simpkins Date: Thu, 15 Mar 2018 17:11:37 -0400 Subject: [PATCH 24/39] [Makefile] updated shellcheck target deps --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index eb89f0508..4b97cafba 100644 --- a/Makefile +++ b/Makefile @@ -28,7 +28,7 @@ lint: shellcheck ufolint pipenv: ./build-pipenv.sh -shellcheck: build-pipenv.sh build-ttf.sh build-woff.sh build-woff2.sh build-subsets.sh tools/scripts/install/ttfautohint-build.sh postbuild_processing/archive_prep/archiver.sh tools/scripts/css/css-build.sh +shellcheck: *.sh tools/scripts/css/*.sh tools/scripts/install/*.sh postbuild_processing/archive_prep/*.sh $@ $^ subsets: pipenv From 2b1d273848623bf79f5f0bd7834994da29979ff4 Mon Sep 17 00:00:00 2001 From: Chris Simpkins Date: Thu, 15 Mar 2018 17:13:22 -0400 Subject: [PATCH 25/39] [build-subsets.sh] updated shell script to support pinned build dependency versions and system installed versions of build dependencies also eliminates dependency checks as these will have run during ttf build and other web font builds prior to execution of this script --- build-subsets.sh | 96 +++++++++++++----------------------------------- 1 file changed, 26 insertions(+), 70 deletions(-) diff --git a/build-subsets.sh b/build-subsets.sh index 63e350166..819329038 100755 --- a/build-subsets.sh +++ b/build-subsets.sh @@ -7,27 +7,17 @@ # Copyright 2018 Christopher Simpkins # MIT License # -# Usage: ./build-subsets.sh -# -# NOTE: must install build dependencies in: -# 1) build-ttf.sh -# 2) build-woff.sh -# 3) build-woff2.sh -# before you execute this script. You can do this with: -# -# -# $ ./build-ttf.sh --install-dependencies -# $ ./build-woff.sh --install-dependencies -# $ ./build-woff2.sh --install-dependencies +# Usage: ./build-subsets.sh (--system) +# Arguments: +# --system (optional) - build with system installed versions +# of build dependencies # # ////////////////////////////////////////////////////////////////////// -# ttfautohint local install path from Werner Lemberg's ttfautohint-build.sh install script -# - This is revised to ttfautohint on the user's PATH if this local install is not identified -# then the identified ttfautohint is used to execute hinting. Versions of ttfautohint < 1.6 exit with status -# code 1 due to use of -R option -# - The intent is to support use of ttfautohint installed on a user's PATH (e.g. they've previously installed it) +# default build tooling definitions TTFAH="$HOME/ttfautohint-build/local/bin/ttfautohint" +FONTMAKE="pipenv run fontmake" +PYTHON="pipenv run python" # The sfnt2woff-zopfli build directory. SFNTWOFF_BUILD="$HOME/sfnt2woff-zopfli-build" @@ -79,64 +69,30 @@ BOLDITALIC_WOFF2="hack-bolditalic-subset.woff2" WEB_BUILD="build/web/fonts" # test for number of arguments -if [ $# -gt 0 ] +if [ $# -gt 1 ] then echo "Inappropriate arguments included in your command." 1>&2 - echo "Usage: ./build-subsets.sh" 1>&2 + echo "Usage: ./build-subsets.sh (--system)" 1>&2 exit 1 fi -# //////////////////////////////////////// +# ////////////////////////////////////////////// # # -# Confirm that dependencies are installed +# Re-define build dependencies to PATH +# installed versions if --system flag is used # # -# //////////////////////////////////////// - -INSTALLFLAG=0 - -# ttfautohint installed -# - tests for install to local path from ttfautohint-build.sh script -# - if not found on this path, tests for install on system PATH - if found, revises TTFAH to the string "ttfautohint" for execution of instruction sets -if ! [ -f "$TTFAH" ] - then - if ! which ttfautohint - then - echo "ttfautohint was not found. Please install all build dependencies with 'make build-with-dependencies', then attempt your build again." 1>&2 - INSTALLFLAG=1 - else - TTFAH="ttfautohint" # revise TTFAH variable to ttfautohint installed on the user's PATH for excecution of hints below - echo "ttfautohint executable identified" - fi - else - echo "ttfautohint executable identified" -fi - -# sfntwoff-zopfli installed -if ! [ -f "$SFNTWOFF_BIN" ] - then - echo "sfnt2woff-zopfli was not found on the path $SFNTWOFF_BIN. Please install all build dependencies with 'make build-with-dependencies', then attempt your build again." 1>&2 - INSTALLFLAG=1 -else - echo "sfnt2woff-zopfli executable identified" -fi +# ////////////////////////////////////////////// -# woff2 installed -if ! [ -f "$WOFF2_BIN" ] - then - echo "woff2_compress was not found on the path $WOFF2_BIN. Please install all build dependencies with 'make build-with-dependencies', then attempt your build again." 1>&2 - INSTALLFLAG=1 -else - echo "woff2_compress executable identified" +if [ "$1" = "--system" ]; then + TTFAH="ttfautohint" + FONTMAKE="fontmake" + PYTHON="python3" + SFNTWOFF_BIN="sfnt2woff-zopfli" + WOFF2_BIN="woff2_compress" fi -# if any of the dependency installs failed, exit and do not attempt build, notify user -if [ $INSTALLFLAG -eq 1 ] - then - echo "Build canceled." 1>&2 - exit 1 -fi # //////////////////////////////////////////////// # @@ -148,7 +104,7 @@ fi # //////////////////////////////////////////////// # cleanup any previously created temp directory that was not removed -if ! [ -d "$TEMP_SOURCE" ]; then +if [ -d "$TEMP_SOURCE" ]; then rm -rf $TEMP_SOURCE fi @@ -185,21 +141,21 @@ fi # build regular subset -if ! pipenv run fontmake --subset -u "$TEMP_SOURCE/Hack-Regular.ufo" -o ttf +if ! $FONTMAKE --subset -u "$TEMP_SOURCE/Hack-Regular.ufo" -o ttf then echo "Unable to build the Hack-Regular variant subset. Build canceled." 1>&2 exit 1 fi # build bold subset -if ! pipenv run fontmake --subset -u "$TEMP_SOURCE/Hack-Bold.ufo" -o ttf +if ! $FONTMAKE --subset -u "$TEMP_SOURCE/Hack-Bold.ufo" -o ttf then echo "Unable to build the Hack-Bold variant subset. Build canceled." 1>&2 exit 1 fi # build italic subset -if ! pipenv run fontmake --subset -u "$TEMP_SOURCE/Hack-Italic.ufo" -o ttf +if ! $FONTMAKE --subset -u "$TEMP_SOURCE/Hack-Italic.ufo" -o ttf then echo "Unable to build the Hack-Italic variant subset. Build canceled." 1>&2 exit 1 @@ -207,7 +163,7 @@ fi # build bold italic subset -if ! pipenv run fontmake --subset -u "$TEMP_SOURCE/Hack-BoldItalic.ufo" -o ttf +if ! $FONTMAKE --subset -u "$TEMP_SOURCE/Hack-BoldItalic.ufo" -o ttf then echo "Unable to build the Hack-BoldItalic variant subset. Build canceled." 1>&2 exit 1 @@ -226,7 +182,7 @@ fi echo " " echo "Attempting DSIG table fixes with fontbakery..." echo " " -if ! pipenv run python postbuild_processing/fixes/fix-dsig.py master_ttf/*.ttf +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 @@ -236,7 +192,7 @@ fi echo " " echo "Attempting fstype fixes with fontbakery..." echo " " -if ! pipenv run python postbuild_processing/fixes/fix-fstype.py master_ttf/*.ttf +if ! $PYTHON postbuild_processing/fixes/fix-fstype.py master_ttf/*.ttf then echo "Unable to complete fstype fixes on the release files" exit 1 From 843e68903595097e816983a49bff7675cc5edd0f Mon Sep 17 00:00:00 2001 From: Chris Simpkins Date: Thu, 15 Mar 2018 17:30:10 -0400 Subject: [PATCH 26/39] new build-archives.sh shell script --- .../archive_prep/archiver.sh => build-archives.sh | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) rename postbuild_processing/archive_prep/archiver.sh => build-archives.sh (91%) diff --git a/postbuild_processing/archive_prep/archiver.sh b/build-archives.sh similarity index 91% rename from postbuild_processing/archive_prep/archiver.sh rename to build-archives.sh index ee737f976..4d80db966 100755 --- a/postbuild_processing/archive_prep/archiver.sh +++ b/build-archives.sh @@ -2,18 +2,18 @@ # //////////////////////////////////////////////////////////////////// # -# archiver.sh +# build-archives.sh # A shell script that packages .zip, tar.gz, and tar.xz font archives # Copyright 2018 Christopher Simpkins # MIT License # -# Usage: ./archiver.sh +# Usage: ./build-archives.sh # # //////////////////////////////////////////////////////////////////// -HACK_VERSION="v3.003" -HACK_ARCHIVES_DIR="../../../Hack-archives" -HACK_BUILD_DIR="../../build" +HACK_VERSION="v4.000" +HACK_ARCHIVES_DIR="../../Hack-archives" +HACK_BUILD_DIR="build" # Make build directory the current working directory From 1028b7e918f2082118c7fcbf35edf70d92170c8e Mon Sep 17 00:00:00 2001 From: Chris Simpkins Date: Thu, 15 Mar 2018 17:30:52 -0400 Subject: [PATCH 27/39] [Makefile] updated archives make target with new shell script path also updates shellcheck paths for linting of this new script --- Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 4b97cafba..6f4a73873 100644 --- a/Makefile +++ b/Makefile @@ -1,7 +1,7 @@ all: build archives: - postbuild_processing/archive_prep/archiver.sh + ./build-archives.sh build: ttf webfonts @@ -28,7 +28,7 @@ lint: shellcheck ufolint pipenv: ./build-pipenv.sh -shellcheck: *.sh tools/scripts/css/*.sh tools/scripts/install/*.sh postbuild_processing/archive_prep/*.sh +shellcheck: *.sh tools/scripts/css/*.sh tools/scripts/install/*.sh $@ $^ subsets: pipenv From 842a21fe2ae776da45fcc8b20fa3f19aac516210 Mon Sep 17 00:00:00 2001 From: Chris Simpkins Date: Thu, 15 Mar 2018 20:18:21 -0400 Subject: [PATCH 28/39] [Makefile] added subsets-system make target --- Makefile | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Makefile b/Makefile index 6f4a73873..3957a4362 100644 --- a/Makefile +++ b/Makefile @@ -34,6 +34,9 @@ shellcheck: *.sh tools/scripts/css/*.sh tools/scripts/install/*.sh subsets: pipenv ./build-subsets.sh +subsets-system: + ./build-subsets.sh --system + ttf: pipenv ./build-ttf.sh From 4c485557b6f69e6bd706909cfaf0086fea5c1d9b Mon Sep 17 00:00:00 2001 From: Chris Simpkins Date: Thu, 15 Mar 2018 21:42:05 -0400 Subject: [PATCH 29/39] [Makefile] added subsets-system target to .PHONY --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 3957a4362..f7ed53ff5 100644 --- a/Makefile +++ b/Makefile @@ -62,4 +62,4 @@ woff2: pipenv woff2-system: ./build-woff2.sh --system -.PHONY: all archives build build-with-dependencies build-local-ttfa build-local-sfnt2woffzopfli build-local-woff2 build-system compile-local-dep css lint pipenv shellcheck subsets ttf ttf-system ufolint webfonts webfonts-system woff woff-system woff2 woff2-system +.PHONY: all archives build build-with-dependencies build-local-ttfa build-local-sfnt2woffzopfli build-local-woff2 build-system compile-local-dep css lint pipenv shellcheck subsets subsets-system ttf ttf-system ufolint webfonts webfonts-system woff woff-system woff2 woff2-system From e20d78677fe0a17b2fc12bdeebb15caf891c2690 Mon Sep 17 00:00:00 2001 From: Chris Simpkins Date: Thu, 15 Mar 2018 21:51:37 -0400 Subject: [PATCH 30/39] [fix-dsig.py] removed from __future__ imports, code formatting = passes flake8 tests --- postbuild_processing/fixes/fix-dsig.py | 42 ++++++++++++++------------ 1 file changed, 22 insertions(+), 20 deletions(-) diff --git a/postbuild_processing/fixes/fix-dsig.py b/postbuild_processing/fixes/fix-dsig.py index 9502712fa..916ab1108 100644 --- a/postbuild_processing/fixes/fix-dsig.py +++ b/postbuild_processing/fixes/fix-dsig.py @@ -14,34 +14,36 @@ # See the License for the specific language governing permissions and # limitations under the License. # -# See AUTHORS.txt for the list of Authors and LICENSE.txt for the License. - # Adapted for the Hack typeface build workflow by Chris Simpkins - -from __future__ import print_function, unicode_literals import sys import os from fontTools import ttLib def set_empty_dsig(ttFont): - newDSIG = ttLib.newTable("DSIG") - newDSIG.ulVersion = 1 - newDSIG.usFlag = 0 - newDSIG.usNumSigs = 0 - newDSIG.signatureRecords = [] - ttFont.tables["DSIG"] = newDSIG + newDSIG = ttLib.newTable("DSIG") + newDSIG.ulVersion = 1 + newDSIG.usFlag = 0 + newDSIG.usNumSigs = 0 + newDSIG.signatureRecords = [] + ttFont.tables["DSIG"] = newDSIG + def main(argv): - for path in argv: - if not os.path.exists(path): - sys.stderr.write("[fix-dsig.py] ERROR: " + path + " is not a valid path to a font file") - sys.exit(1) - else: - font = ttLib.TTFont(path) - set_empty_dsig(font) - font.save(path) - print(path + " - successful DSIG table fix") + for path in argv: + if not os.path.exists(path): + sys.stderr.write( + "[fix-dsig.py] ERROR: " + + path + + " is not a valid path to a font file" + ) + sys.exit(1) + else: + font = ttLib.TTFont(path) + set_empty_dsig(font) + font.save(path) + print(path + " - successful DSIG table fix") + if __name__ == '__main__': - main(sys.argv[1:]) + main(sys.argv[1:]) From 0a01f0427571493de23d5dd6ba677f8e909a38e1 Mon Sep 17 00:00:00 2001 From: Chris Simpkins Date: Thu, 15 Mar 2018 21:52:07 -0400 Subject: [PATCH 31/39] [fix-fstype.py] source code formatting changes = passes flake8 tests --- postbuild_processing/fixes/fix-fstype.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/postbuild_processing/fixes/fix-fstype.py b/postbuild_processing/fixes/fix-fstype.py index 011251139..41fdb94a3 100644 --- a/postbuild_processing/fixes/fix-fstype.py +++ b/postbuild_processing/fixes/fix-fstype.py @@ -14,17 +14,20 @@ # See the License for the specific language governing permissions and # limitations under the License. # - # Adapted for the Hack typeface build workflow by Chris Simpkins - import os import sys from fontTools.ttLib import TTFont + def main(argv): for path in argv: if not os.path.exists(path): - sys.stderr.write("[fix-fstype.py] ERROR: " + path + " is not a valid path to a font file") + sys.stderr.write( + "[fix-fstype.py] ERROR: " + + path + + " is not a valid path to a font file" + ) sys.exit(1) else: font = TTFont(path) @@ -32,5 +35,6 @@ def main(argv): font.save(path) print(path + " - successful fstype fix") + if __name__ == '__main__': - main(sys.argv[1:]) + main(sys.argv[1:]) From 96a35cb528c3784e80326f466a99042be0f46938 Mon Sep 17 00:00:00 2001 From: Chris Simpkins Date: Fri, 16 Mar 2018 17:07:13 -0400 Subject: [PATCH 32/39] [woff2-compress-build.sh] convert to upstream woff2 at v1.0.2 (includes brotli v1.0.1) the macOS build issue has been addressed and compiles work on macOS --- tools/scripts/install/woff2-compress-build.sh | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/tools/scripts/install/woff2-compress-build.sh b/tools/scripts/install/woff2-compress-build.sh index 7f6c9ddb0..38b01abbe 100755 --- a/tools/scripts/install/woff2-compress-build.sh +++ b/tools/scripts/install/woff2-compress-build.sh @@ -14,6 +14,7 @@ # The woff2 git clone directory. BUILD="$HOME" INST="$HOME/woff2" +WOFF2_VERSION_TAG="v1.0.2" # woff2 executable path WOFF2_BIN="$BUILD/woff2/woff2_compress" @@ -29,13 +30,16 @@ echo "#####" echo "git clone woff2 project" echo "#####" -# clone the Source Foundry fork of the woff2 repo -# contains fix for OS X build bug - https://github.com/google/woff2/issues/73 -# recursive flag to clone the brotli submodule within the woff2 repo -git clone --recursive https://github.com/source-foundry/woff2.git +# clone the woff2 repository +git clone --recursive https://github.com/google/woff2.git cd "$INST" || exit 1 +# checkout desired version tag +echo " " +echo "Checking out woff2 version tag $WOFF2_VERSION_TAG" +git checkout $WOFF2_VERSION_TAG + echo "#####" echo "Build woff2" echo "#####" From ee180fbffef084f35c98a5afb56a69dc413e1a45 Mon Sep 17 00:00:00 2001 From: Chris Simpkins Date: Fri, 16 Mar 2018 19:30:49 -0400 Subject: [PATCH 33/39] [build-pipenv.sh] modified command to create the pipenv virtual environment --- build-pipenv.sh | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/build-pipenv.sh b/build-pipenv.sh index a13110f0a..4b02873c3 100755 --- a/build-pipenv.sh +++ b/build-pipenv.sh @@ -11,16 +11,14 @@ # # ///////////////////////////////////////////////////////////////// -BUILD_PYTHON_VERSION="3.6" - if ! which pipenv then echo "Unable to detect a pipenv install. Please install with 'pip install pipenv' then repeat your build attempt." 1>&2 exit 1 fi -# install fontTools and fontmake build dependencies with pipenv -pipenv install --python $BUILD_PYTHON_VERSION --ignore-pipfile fontmake fontTools +# create virtualenv and install build dependencies +pipenv install --ignore-pipfile # test for fontmake install in venv if ! pipenv run fontmake --version From 8b7feda71e802c2eb5dcc84ff555de4c4a4ad44d Mon Sep 17 00:00:00 2001 From: Chris Simpkins Date: Sat, 17 Mar 2018 08:17:17 -0400 Subject: [PATCH 34/39] [Makefile] added documentation and process specific target arrangement --- Makefile | 55 ++++++++++++++++++++++++++++++++++++++++++------------- 1 file changed, 42 insertions(+), 13 deletions(-) diff --git a/Makefile b/Makefile index f7ed53ff5..86e192042 100644 --- a/Makefile +++ b/Makefile @@ -1,7 +1,24 @@ all: build -archives: - ./build-archives.sh +# FONT COMPILES + +# +# Recommended usage: +# +# The following targets build *.ttf, *.woff, *.woff2 (including *.woff and *.woff2 subsets): +# +# `make` - builds fonts with pinned build dependency versions of all Python and local, compiled C/C++ projects +# `make build-system` - builds fonts with system PATH installed versions of build dependencies +# +# Dependency installs for default builds with `make` can be executed with: +# +# 1) pip3 install pipenv +# 2) make compile-local-dep +# +# Optional dependency install for `make` if your development system does not support the defined Python interpreter version: +# +# 3) curl -L https://github.com/pyenv/pyenv-installer/raw/master/bin/pyenv-installer | bash +# build: ttf webfonts @@ -20,17 +37,9 @@ build-local-woff2: compile-local-dep: build-local-ttfa build-local-sfnt2woffzopfli build-local-woff2 -css: - tools/scripts/css/css-build.sh - -lint: shellcheck ufolint - pipenv: ./build-pipenv.sh -shellcheck: *.sh tools/scripts/css/*.sh tools/scripts/install/*.sh - $@ $^ - subsets: pipenv ./build-subsets.sh @@ -43,9 +52,6 @@ ttf: pipenv ttf-system: ./build-ttf.sh --system -ufolint: source/*.ufo - $@ $^ - webfonts: woff woff2 subsets webfonts-system: woff-system woff2-system subsets-system @@ -62,4 +68,27 @@ woff2: pipenv woff2-system: ./build-woff2.sh --system + +# RELEASE PREP + +archives: + ./build-archives.sh + +css: + tools/scripts/css/css-build.sh + + +# TESTING + +lint: shellcheck ufolint + +shellcheck: *.sh tools/scripts/css/*.sh tools/scripts/install/*.sh + $@ $^ + +ufolint: source/*.ufo + $@ $^ + + +# PHONY TARGETS + .PHONY: all archives build build-with-dependencies build-local-ttfa build-local-sfnt2woffzopfli build-local-woff2 build-system compile-local-dep css lint pipenv shellcheck subsets subsets-system ttf ttf-system ufolint webfonts webfonts-system woff woff-system woff2 woff2-system From d6df277ba2c7ab1e0b03d011d35bd495173381aa Mon Sep 17 00:00:00 2001 From: Chris Simpkins Date: Sun, 18 Mar 2018 13:31:43 -0400 Subject: [PATCH 35/39] [BUILD.md] updated build documentation with v4.x build tooling changes --- docs/BUILD.md | 115 +++++++++++++++++++++++++++++++++++++------------- 1 file changed, 86 insertions(+), 29 deletions(-) diff --git a/docs/BUILD.md b/docs/BUILD.md index 09c57f984..e85eb273b 100644 --- a/docs/BUILD.md +++ b/docs/BUILD.md @@ -1,37 +1,104 @@ +# Hack Font Builds from Source Files + +Hack is compiled from UFO v2 spec source files to ttf, woff, and woff2 fonts with free, open source build tools. The default build approach requires a *nix platform (macOS, Linux, Unix-like development platform for Windows such as MinGW) and uses pinned build dependency versions in order to support font files that render in a reproducible fashion (relative to upstream repository builds) in a given rendering environment. See the bottom of this document for an alternative approach that uses system-installed versions of all build dependencies and supports build dependency versions that differ from those used in the upstream repository. + +## Quickstart +The following commands will do the following: + +1. Clone the Hack source repository +2. Install the `pipenv` dependency +3. Compile and install a local version `ttfautohint` (i.e., *off of the system PATH*) +4. Build *.ttf desktop fonts +5. Build *.woff web fonts (including subsets) +6. Build *.woff2 web fonts (including subsets) + +**Quickstart Hack font compile process** + +``` +$ git clone https://github.com/source-foundry/Hack.git +$ cd Hack +$ pip3 install pipenv +$ make compile-local-dep +$ make +``` + +The build process takes minutes to complete on the average system. You will see a great deal of text stream by in your terminal during the build. This is normal and expected during the build. + +You will find the compiled fonts in the build directory (located in the top level of the source repository) after you complete these steps. + +Detailed instructions follow if you have difficulties with any of the above steps. If you encounter an error that is not addressed in this build documentation, please report it as a new issue report on the repository. *Please review the entire build document below to confirm that we have not explained how to address your problem before you submit a new issue report*! + ## Build dependencies -Hack is compiled from UFO v2 spec source files to ttf, woff, and woff2 fonts with free, open source build tools. You can either install the tools manually or use the automated build dependency installation approach documented below. +### Python interpreter dependency + +The Hack fonts are built with a Python version 3 interpreter. The Python interpreter version is fixed at each git commit. You may view the Python interpreter in use at any commit in the Pipfile and Pipfile.lock files that are located in the root directory of the repository. [Click here](https://sourcegraph.com/search?q=repo:%5Egithub%5C.com/source-foundry/Hack%24%40master+python_version) to search for these values in the current HEAD commit of the master branch. + +If this version of the Python interpreter is not available on your development system, you may install [`pyenv`](https://github.com/pyenv/pyenv-installer) before you attempt your build. If `pyenv` is installed prior to the build, `pipenv` will automatically install the interpreter defined in the Hack build in the virtual environment used for the build, even if it is not currently installed on your system. -### Desktop font (ttf) build dependencies +The pyenv project defines the following command as a supported approach to install `pyenv`: + + +**Pull and install the pyenv executable** + +``` +curl -L https://github.com/pyenv/pyenv-installer/raw/master/bin/pyenv-installer | bash +``` + +### Desktop font (ttf) dependencies To build the Hack desktop fonts (ttf) from source you will need the following build dependencies: +- [pipenv](https://github.com/pypa/pipenv) Python executable - [fontmake](https://github.com/googlei18n/fontmake) Python executable - [fonttools](https://github.com/fonttools/fonttools) Python library - [ttfautohint](https://www.freetype.org/ttfautohint/) executable (includes Harfbuzz and FreeType dependencies) -### Web font (woff + woff2) build dependencies +`fontmake` and `fontTools` are automatically installed during the compile process. + +`pipenv` must be installed manually with the following command before you attempt a build: + +**Install pipenv** -To build the Hack web fonts from source you will need all of the build dependencies listed above for desktop font builds. In addition you will need the following dependencies for the web font build steps: +``` +$ pip3 install pipenv +``` + +`ttfautohint` (including its Harfbuzz and FreeType dependencies) can be installed locally on the path defined for use in Hack builds with the following command: + +**Compile and install a local copy of ttfautohint** + +``` +$ make compile-local-dep +``` + +This path is defined as the following subdirectory on your $HOME path: + +- ttfautohint: `$HOME/ttfautohint-build` + +### Web font (woff + woff2) dependencies + +To build the Hack web fonts from source you will need all of the build dependencies listed above for desktop font builds and the following additional dependencies: - [sfnt2woff-zopfli](https://github.com/bramstein/sfnt2woff-zopfli) C++ executable - [woff2_compress](https://github.com/source-foundry/woff2) C++ executable +The sfnt2woff-zopfli executable and woff2_compress executable are compiled and installed on a local build path (i.e., off of system PATH) with the following command: -### Automated build dependency installation - -Install all build dependencies for desktop and web fonts with the following make command: +**Compile and install local copies of sfnt2woff-zopfli and woff2_compress** ``` -$ make build-with-dependencies +$ make compile-local-dep ``` -This will install all necessary build dependencies and complete a build of all desktop and web fonts. +These paths are defined as the following subdirectories on your $HOME path: +- sfnt2woff-zopfli: `$HOME/sfnt2woff-zopfli-build` +- woff2: `$HOME/woff2` ## Automated font builds -After the build dependencies are installed, use make targets from the root of the Hack repository to build font sets. +After the build dependencies are installed, use make targets from the root of the Hack repository to build font sets. The following commands build the regular, bold, italic, and bold italic variants of the respective build types: #### Build all desktop and web fonts (including web font subsets) @@ -40,7 +107,7 @@ After the build dependencies are installed, use make targets from the root of th $ make ``` -#### Build ttf desktop fonts +#### Build ttf desktop fonts only ``` $ make ttf @@ -80,37 +147,27 @@ Desktop fonts are available on the path `build/ttf` from the root of the reposit ### Web fonts (woff + woff2) -Web fonts are available on the path `build/web/fonts` from the root of the repository upon completion of your build. - +Web fonts are available on the path `build/web/fonts` from the root of the repository upon completion of your build. CSS files that may be used with your web font builds are available on the path `build/web`. ## Uninstall -All build dependencies installed with the automated approaches can be uninstalled with the following commands: +Python packages that are used during the build process are installed in a virtual environment with `pipenv`. The virtual environment and all Python packages installed in that environment can be eliminated with execution of the following command in the root of the repository: ``` -$ pip uninstall fontmake -$ pip uninstall fonttools -$ rm -rf ~/ttfautohint-build -$ rm -rf ~/sfnt2woff-zopfli-build -$ rm -rf ~/woff2 +$ pipenv -rm ``` -Here are all of the above commands in a single line that can be copied/pasted into your terminal to accomplish the entire uninstall process: +All compiled project build dependencies installed as part of this build process can be uninstalled with the following commands: ``` -$ pip uninstall fontmake && pip uninstall fonttools && rm -rf ~/ttfautohint-build && rm -rf ~/sfnt2woff-zopfli-build && rm -rf ~/woff2 +$ rm -rf ~/ttfautohint-build +$ rm -rf ~/sfnt2woff-zopfli-build +$ rm -rf ~/woff2 ``` -In cases where a compile did not proceed to completion (e.g. you intentionally exited early or an exception was raised) a temporary directory may still exist in the root of the repository on the path `master_ttf`. This can be removed with: +In cases where a compile did not proceed to completion (e.g. you intentionally exited early or an exception was raised that halted the build prior to completion) a temporary directory may still exist in the root of the repository on the path `master_ttf`. This can be removed with: ``` $ rm -rf master_ttf ``` -### Uninstall Details - -fontmake and fonttools are Python packages and are uninstalled with pip. - -The FreeType library (including its build dependency Harfbuzz), ttfautohint, sfnt2woff-zopfli, and woff2 are built in directories on your $HOME path. They are not installed on your $PATH (unless of course you have defined $HOME on $PATH) so they **will not** work from the command line with the name of the executable file only (e.g. `$ ttfautohint [file path]`). This is intentional. - -Repeat execution of the build process cleans up the temporary directory `master_ttf` if found so this step is not mandatory to repeat a build and should not lead to errors with the build. From 1dd36648c22d26ea914990775343747c29b0b5d4 Mon Sep 17 00:00:00 2001 From: Chris Simpkins Date: Sun, 18 Mar 2018 13:39:34 -0400 Subject: [PATCH 36/39] [BUILD.md] added TOC --- docs/BUILD.md | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/docs/BUILD.md b/docs/BUILD.md index e85eb273b..5261b62fd 100644 --- a/docs/BUILD.md +++ b/docs/BUILD.md @@ -28,6 +28,16 @@ You will find the compiled fonts in the build directory (located in the top leve Detailed instructions follow if you have difficulties with any of the above steps. If you encounter an error that is not addressed in this build documentation, please report it as a new issue report on the repository. *Please review the entire build document below to confirm that we have not explained how to address your problem before you submit a new issue report*! +## Contents + +- [Build dependency installation](#build-dependencies) + - [Python interpreter](#python-interpreter-dependency) + - [ttf desktop font dependencies](#desktop-font-ttf-dependencies) + - [woff and woff2 web font dependencies](#web-font-woff--woff2-dependencies) +- [Automated font builds with make](#automated-font-builds) +- [Build paths](#build-paths) +- [Uninstall build dependencies](#uninstall-build-dependencies) + ## Build dependencies ### Python interpreter dependency @@ -149,7 +159,7 @@ Desktop fonts are available on the path `build/ttf` from the root of the reposit Web fonts are available on the path `build/web/fonts` from the root of the repository upon completion of your build. CSS files that may be used with your web font builds are available on the path `build/web`. -## Uninstall +## Uninstall build dependencies Python packages that are used during the build process are installed in a virtual environment with `pipenv`. The virtual environment and all Python packages installed in that environment can be eliminated with execution of the following command in the root of the repository: @@ -170,4 +180,3 @@ In cases where a compile did not proceed to completion (e.g. you intentionally e ``` $ rm -rf master_ttf ``` - From b1ebe12a4b72aeec7ea81d4ed2dd385a5656c1e5 Mon Sep 17 00:00:00 2001 From: Chris Simpkins Date: Sun, 18 Mar 2018 13:49:33 -0400 Subject: [PATCH 37/39] [BUILD.md] minor text revisions --- docs/BUILD.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/docs/BUILD.md b/docs/BUILD.md index 5261b62fd..993d5a5de 100644 --- a/docs/BUILD.md +++ b/docs/BUILD.md @@ -1,6 +1,6 @@ # Hack Font Builds from Source Files -Hack is compiled from UFO v2 spec source files to ttf, woff, and woff2 fonts with free, open source build tools. The default build approach requires a *nix platform (macOS, Linux, Unix-like development platform for Windows such as MinGW) and uses pinned build dependency versions in order to support font files that render in a reproducible fashion (relative to upstream repository builds) in a given rendering environment. See the bottom of this document for an alternative approach that uses system-installed versions of all build dependencies and supports build dependency versions that differ from those used in the upstream repository. +Hack is compiled from UFO v2 spec source files to ttf, woff, and woff2 fonts with free, open source build tools. The default build approach requires a *nix platform (macOS, Linux, a Unix-like development platform for Windows such as MinGW) and uses pinned build dependency versions to support font files that render reproducibly (relative to upstream repository builds) in a given rendering environment. See the bottom of this document for an alternative approach that uses system-installed versions of all build dependencies and supports build dependency versions that differ from those used in the upstream repository. ## Quickstart The following commands will do the following: @@ -22,7 +22,7 @@ $ make compile-local-dep $ make ``` -The build process takes minutes to complete on the average system. You will see a great deal of text stream by in your terminal during the build. This is normal and expected during the build. +The build process takes minutes to complete on the average system. You will see a great deal of text stream by in your terminal during the build. This text stream is normal and expected during the build. You will find the compiled fonts in the build directory (located in the top level of the source repository) after you complete these steps. @@ -44,7 +44,7 @@ Detailed instructions follow if you have difficulties with any of the above step The Hack fonts are built with a Python version 3 interpreter. The Python interpreter version is fixed at each git commit. You may view the Python interpreter in use at any commit in the Pipfile and Pipfile.lock files that are located in the root directory of the repository. [Click here](https://sourcegraph.com/search?q=repo:%5Egithub%5C.com/source-foundry/Hack%24%40master+python_version) to search for these values in the current HEAD commit of the master branch. -If this version of the Python interpreter is not available on your development system, you may install [`pyenv`](https://github.com/pyenv/pyenv-installer) before you attempt your build. If `pyenv` is installed prior to the build, `pipenv` will automatically install the interpreter defined in the Hack build in the virtual environment used for the build, even if it is not currently installed on your system. +If this version of the Python interpreter is not available on your development system, you may install [`pyenv`](https://github.com/pyenv/pyenv-installer) before you attempt your build. If `pyenv` is installed before the build, `pipenv` will automatically install the interpreter defined in the Hack build in the virtual environment used for the build, even if it is not installed on your system. The pyenv project defines the following command as a supported approach to install `pyenv`: @@ -161,7 +161,7 @@ Web fonts are available on the path `build/web/fonts` from the root of the repos ## Uninstall build dependencies -Python packages that are used during the build process are installed in a virtual environment with `pipenv`. The virtual environment and all Python packages installed in that environment can be eliminated with execution of the following command in the root of the repository: +Python packages that are used during the build process are installed in a virtual environment with `pipenv`. The virtual environment and all Python packages installed in that environment can be eliminated with the execution of the following command in the root of the repository: ``` $ pipenv -rm @@ -175,7 +175,7 @@ $ rm -rf ~/sfnt2woff-zopfli-build $ rm -rf ~/woff2 ``` -In cases where a compile did not proceed to completion (e.g. you intentionally exited early or an exception was raised that halted the build prior to completion) a temporary directory may still exist in the root of the repository on the path `master_ttf`. This can be removed with: +In cases where a compile did not proceed to completion (e.g., you intentionally exited early, or an exception was raised that led to an early termination of the build), a temporary directory may still exist in the root of the repository on the path `master_ttf`. This directory can be removed with: ``` $ rm -rf master_ttf From bc6a683fba3170e16eb690f45bbce5043e19d10a Mon Sep 17 00:00:00 2001 From: Chris Simpkins Date: Sun, 18 Mar 2018 14:36:33 -0400 Subject: [PATCH 38/39] [BUILD.md] added documentation for system PATH installed build dependencies --- docs/BUILD.md | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/docs/BUILD.md b/docs/BUILD.md index 993d5a5de..1ea6ea2ca 100644 --- a/docs/BUILD.md +++ b/docs/BUILD.md @@ -180,3 +180,39 @@ In cases where a compile did not proceed to completion (e.g., you intentionally ``` $ rm -rf master_ttf ``` + +## Compile with system PATH installed build dependencies + +The following make targets are available for those who would like to build with system PATH installed versions of all build dependencies. This approach allows you build with dependency versions that differ from those used in the upstream project. Please see the note at the bottom of this section for caveats to this approach. + +#### System PATH build dependency compiles of all fonts + +``` +$ make build-system +``` + +#### System PATH build dependency compiles of desktop fonts + +``` +$ make ttf-system +``` + +#### System PATH build dependency compiles of all web fonts + +``` +$ make webfonts-system +``` + +#### System PATH build dependency compiles of woff web fonts + +``` +$ make woff-system +``` + +#### System PATH build dependency compiles of woff web fonts + +``` +$ make woff2-system +``` + +You must install all build dependencies before use of these make targets. Please refer to the documentation for the respective build dependency projects for details about installations. While we release these system PATH installed compile make targets to simplify the approach to builds for users who prefer not to (or cannot) create a development environment that matches the one used for our upstream builds, this approach is not otherwise supported or tested in this repository. Please understand this caveat if you intend to release fonts built with this approach in a production environment as differences in the build dependency versions can alter font renders. From 2a46cad575da4d7c4c48acb9232d111636150e1e Mon Sep 17 00:00:00 2001 From: Chris Simpkins Date: Wed, 21 Mar 2018 17:35:41 -0400 Subject: [PATCH 39/39] [woff2-compress-build.sh] modified woff2_compress to use brotli v1.0.3 --- tools/scripts/install/woff2-compress-build.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tools/scripts/install/woff2-compress-build.sh b/tools/scripts/install/woff2-compress-build.sh index 38b01abbe..3f17c959b 100755 --- a/tools/scripts/install/woff2-compress-build.sh +++ b/tools/scripts/install/woff2-compress-build.sh @@ -14,7 +14,7 @@ # The woff2 git clone directory. BUILD="$HOME" INST="$HOME/woff2" -WOFF2_VERSION_TAG="v1.0.2" +WOFF2_COMMIT="5e5f2cf20d5f9d3373a2d8b4905105f80646c014" # woff2 executable path WOFF2_BIN="$BUILD/woff2/woff2_compress" @@ -37,8 +37,8 @@ cd "$INST" || exit 1 # checkout desired version tag echo " " -echo "Checking out woff2 version tag $WOFF2_VERSION_TAG" -git checkout $WOFF2_VERSION_TAG +echo "Checking out woff2 at commit $WOFF2_COMMIT" +git checkout $WOFF2_COMMIT echo "#####" echo "Build woff2"