├── .github └── workflows │ ├── lint.yml │ ├── linux-ci.yml │ ├── macos-ci.yml │ └── publish-release.yml ├── LICENSE ├── Makefile ├── README.md └── ttfautohint-build.sh /.github/workflows/lint.yml: -------------------------------------------------------------------------------- 1 | name: Shell script lints 2 | 3 | on: [push, pull_request] 4 | 5 | jobs: 6 | lints: 7 | runs-on: ubuntu-latest 8 | name: lints 9 | steps: 10 | - name: Check out source repository 11 | uses: actions/checkout@v2 12 | - name: Install lint dependencies 13 | run: sudo apt-get install -y shellcheck devscripts 14 | - name: shellcheck lints of shell script source 15 | run: make shellcheck 16 | - name: checkbashisms lints of shell script source 17 | run: make checkbashisms 18 | -------------------------------------------------------------------------------- /.github/workflows/linux-ci.yml: -------------------------------------------------------------------------------- 1 | name: Linux Build CI 2 | 3 | on: [push, pull_request] 4 | 5 | jobs: 6 | linux-build: 7 | runs-on: ubuntu-latest 8 | name: Linux Build 9 | steps: 10 | - name: Check out source repository 11 | uses: actions/checkout@v2 12 | - name: Linux build test 13 | run: make 14 | -------------------------------------------------------------------------------- /.github/workflows/macos-ci.yml: -------------------------------------------------------------------------------- 1 | name: macOS Build CI 2 | 3 | on: [push, pull_request] 4 | 5 | jobs: 6 | macos-build: 7 | runs-on: macos-latest 8 | name: macOS Build 9 | steps: 10 | - name: Check out source repository 11 | uses: actions/checkout@v2 12 | - name: macOS build test 13 | run: make 14 | -------------------------------------------------------------------------------- /.github/workflows/publish-release.yml: -------------------------------------------------------------------------------- 1 | on: 2 | push: 3 | # Sequence of patterns matched against refs/tags 4 | tags: 5 | - "v*" # Push events to matching v*, i.e. v1.0, v20.15.10 6 | 7 | name: Create and Publish Release 8 | 9 | jobs: 10 | build: 11 | name: Create and Publish Release 12 | runs-on: ubuntu-latest 13 | strategy: 14 | matrix: 15 | python-version: [3.8] 16 | steps: 17 | - uses: actions/checkout@v2 18 | - name: Create GitHub release 19 | id: create_release 20 | uses: actions/create-release@v1 21 | env: 22 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} 23 | with: 24 | tag_name: ${{ github.ref }} 25 | release_name: ${{ github.ref }} 26 | body: | 27 | Changes: 28 | draft: false 29 | prerelease: false 30 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2018 Werner Lemberg 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy of 6 | this software and associated documentation files (the "Software"), to deal in 7 | the Software without restriction, including without limitation the rights to 8 | use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 9 | the Software, and to permit persons to whom the Software is furnished to do so, 10 | subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 17 | FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 18 | COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 19 | IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 20 | CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | .PHONY: default build lint shellcheck checkbashisms 2 | 3 | default: build 4 | 5 | build: ttfautohint-build.sh 6 | ./ttfautohint-build.sh 7 | 8 | lint: shellcheck checkbashisms 9 | 10 | shellcheck: ttfautohint-build.sh 11 | $@ $^ 12 | 13 | checkbashisms: ttfautohint-build.sh 14 | $@ $^ 15 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | 2 | # ttfautohint-build 3 | 4 | [![Linux Build CI](https://github.com/source-foundry/ttfautohint-build/actions/workflows/linux-ci.yml/badge.svg)](https://github.com/source-foundry/ttfautohint-build/actions/workflows/linux-ci.yml) 5 | [![macOS Build CI](https://github.com/source-foundry/ttfautohint-build/actions/workflows/macos-ci.yml/badge.svg)](https://github.com/source-foundry/ttfautohint-build/actions/workflows/macos-ci.yml) 6 | 7 | ## About 8 | 9 | ttfautohint-build includes a simple, straightforward [ttfautohint](https://www.freetype.org/ttfautohint/) build from scratch approach on Linux and macOS platforms. [FreeType](https://www.freetype.org/) and [Harfbuzz](https://github.com/behdad/harfbuzz) build dependencies (at appropriate release versions) are included in the installation. 10 | 11 | The build script is `ttfautohint-build.sh` (located in the root of the repository). This script is linted with `shellcheck` & `checkbashisms` and is tested for build execution completion on Ubuntu Linux and macOS v10.10-v10.15 using [the Travis CI service](https://travis-ci.org/source-foundry/ttfautohint-build). 12 | 13 | Builds employ a simple `make` workflow that does not require super user permissions. 14 | 15 | If you are looking for a simple way to install + use ttfautohint and do not need to build the application from source, check out the free, open [ttfautohint-py project](https://github.com/fonttools/ttfautohint-py). 16 | 17 | ## Pre-Install Build Dependencies 18 | 19 | ### Linux 20 | 21 | - None 22 | 23 | ### macOS 24 | 25 | - macOS v10.11 and above 26 | - XCode v7.3 and above 27 | 28 | ## Usage 29 | 30 | Select one of the following approaches to install the current release of `ttfautohint`. 31 | 32 | ### git clone Approach 33 | 34 | ``` 35 | $ git clone https://github.com/source-foundry/ttfautohint-build.git 36 | $ cd ttfautohint-build 37 | $ make 38 | ``` 39 | 40 | ### cURL Approach 41 | 42 | ``` 43 | $ curl -L -O https://github.com/source-foundry/ttfautohint-build/archive/v1.8.3.2.tar.gz 44 | $ tar -xzvf v1.8.3.2.tar.gz 45 | $ cd ttfautohint-build-1.8.3.2 46 | $ make 47 | ``` 48 | 49 | With both of the above approaches, the `ttfautohint` executable is installed on the path `$HOME/ttfautohint-build/local/bin/ttfautohint`. 50 | 51 | ### ttfautohint Execution 52 | 53 | You can use the following approaches to execute `ttfautohint` with your font files: 54 | 55 | #### Shell Scripts 56 | 57 | 58 | ``` 59 | # without shell script constant 60 | 61 | "$HOME/ttfautohint-build/local/bin/ttfautohint" [ttfautohint args] 62 | ``` 63 | 64 | ``` 65 | # with shell script constant 66 | 67 | TTFAH="$HOME/ttfautohint-build/local/bin/ttfautohint" 68 | 69 | "$TTFAH" [ttfautohint args] 70 | ``` 71 | 72 | #### Command Line 73 | 74 | Modify the PATH definition in your shell settings file (e.g. .bashrc if you are using bash) with the following line **after** PATH is defined in the file: 75 | 76 | ``` 77 | export PATH="$HOME/ttfautohint-build/local/bin/:$PATH" 78 | ``` 79 | 80 | then, source your shell settings file on the command line with: 81 | 82 | ``` 83 | $ source [shell settings file path] 84 | ``` 85 | 86 | You can then use `ttfautohint` on the command line as follows: 87 | 88 | ``` 89 | $ ttfautohint [ttfautohint args] 90 | ``` 91 | 92 | ## Changes 93 | 94 | Please see the changelog in [the project releases](https://github.com/source-foundry/ttfautohint-build/releases). 95 | 96 | ## License 97 | 98 | [MIT License](LICENSE) 99 | -------------------------------------------------------------------------------- /ttfautohint-build.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # shellcheck disable=SC2103 3 | # shellcheck disable=SC2003 4 | # shellcheck disable=SC2006 5 | # This script builds a stand-alone binary for the command line version of 6 | # ttfautohint, downloading any necessary libraries. 7 | # 8 | # Version 2019-Aug-14. 9 | 10 | # The MIT License (MIT) 11 | 12 | # Copyright (c) 2017 Werner Lemberg 13 | 14 | # Permission is hereby granted, free of charge, to any person obtaining a copy of 15 | # this software and associated documentation files (the "Software"), to deal in 16 | # the Software without restriction, including without limitation the rights to 17 | # use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 18 | # the Software, and to permit persons to whom the Software is furnished to do so, 19 | # subject to the following conditions: 20 | 21 | # The above copyright notice and this permission notice shall be included in all 22 | # copies or substantial portions of the Software. 23 | 24 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 25 | # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 26 | # FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 27 | # COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 28 | # IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 29 | # CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 30 | 31 | 32 | # 33 | # User configuration. 34 | # 35 | 36 | # The build directory. 37 | BUILD="$HOME/ttfautohint-build" 38 | INST="$BUILD/local" 39 | 40 | # Excepted build binary path 41 | TTFAUTOHINT_BIN="$INST/bin/ttfautohint" 42 | 43 | # The library versions. 44 | FREETYPE_VERSION="2.10.2" 45 | HARFBUZZ_VERSION="2.7.2" 46 | TTFAUTOHINT_VERSION="1.8.3" 47 | 48 | # Necessary patches (lists of at most 10 URLs each separated by whitespace, 49 | # to be applied in order). 50 | FREETYPE_PATCHES="" 51 | HARFBUZZ_PATCHES="" 52 | TTFAUTOHINT_PATCHES="" 53 | 54 | 55 | # 56 | # Nothing to configure below this comment. 57 | # 58 | 59 | FREETYPE="freetype-$FREETYPE_VERSION" 60 | HARFBUZZ="harfbuzz-$HARFBUZZ_VERSION" 61 | TTFAUTOHINT="ttfautohint-$TTFAUTOHINT_VERSION" 62 | 63 | if test -d "$BUILD" -o -f "$BUILD"; then 64 | echo "Build directory \`$BUILD' must not exist." 65 | exit 1 66 | fi 67 | 68 | mkdir "$BUILD" 69 | mkdir "$INST" 70 | 71 | cd "$BUILD" || exit 1 72 | 73 | 74 | echo "#####" 75 | echo "Download all necessary archives and patches." 76 | echo "#####" 77 | 78 | curl -L -O "https://download.savannah.gnu.org/releases/freetype/$FREETYPE.tar.gz" 79 | curl -L -O "https://github.com/harfbuzz/harfbuzz/releases/download/$HARFBUZZ_VERSION/$HARFBUZZ.tar.xz" 80 | curl -L -O "https://download.savannah.gnu.org/releases/freetype/$TTFAUTOHINT.tar.gz" 81 | 82 | count=0 83 | for i in $FREETYPE_PATCHES 84 | do 85 | curl -o ft-patch-$count.diff "$i" 86 | count=`expr $count + 1` 87 | done 88 | 89 | count=0 90 | for i in $HARFBUZZ_PATCHES 91 | do 92 | curl -o hb-patch-$count.diff "$i" 93 | count=`expr $count + 1` 94 | done 95 | 96 | count=0 97 | for i in $TTFAUTOHINT_PATCHES 98 | do 99 | curl -o ta-patch-$count.diff "$i" 100 | count=`expr $count + 1` 101 | done 102 | 103 | 104 | # Our environment variables. 105 | TA_CPPFLAGS="-I$INST/include" 106 | TA_CFLAGS="-g -O2" 107 | TA_CXXFLAGS="-g -O2" 108 | TA_LDFLAGS="-L$INST/lib -L$INST/lib64" 109 | 110 | 111 | echo "#####" 112 | echo "Extract archives." 113 | echo "#####" 114 | 115 | tar -xzvf "$FREETYPE.tar.gz" 116 | tar -xvf "$HARFBUZZ.tar.xz" 117 | tar -xzvf "$TTFAUTOHINT.tar.gz" 118 | 119 | 120 | echo "#####" 121 | echo "Apply patches." 122 | echo "#####" 123 | 124 | cd "$FREETYPE" || exit 1 125 | for i in ../ft-patch-*.diff 126 | do 127 | test -f "$i" || continue 128 | patch -p1 -N -r - < "$i" 129 | done 130 | cd .. 131 | 132 | cd "$HARFBUZZ" || exit 1 133 | for i in ../hb-patch-*.diff 134 | do 135 | test -f "$i" || continue 136 | patch -p1 -N -r - < "$i" 137 | done 138 | cd .. 139 | 140 | cd "$TTFAUTOHINT" || exit 1 141 | for i in ../ta-patch-*.diff 142 | do 143 | test -f "$i" || continue 144 | patch -p1 -N -r - < "$i" 145 | done 146 | cd .. 147 | 148 | 149 | echo "#####" 150 | echo "$FREETYPE" 151 | echo "#####" 152 | 153 | cd "$FREETYPE" || exit 1 154 | 155 | # The space in `PKG_CONFIG' ensures that the created `freetype-config' file 156 | # doesn't find a working pkg-config, falling back to the stored strings 157 | # (which is what we want). 158 | ./configure \ 159 | --without-bzip2 \ 160 | --without-png \ 161 | --without-zlib \ 162 | --without-harfbuzz \ 163 | --prefix="$INST" \ 164 | --enable-static \ 165 | --disable-shared \ 166 | --enable-freetype-config \ 167 | PKG_CONFIG=" " \ 168 | CFLAGS="$TA_CPPFLAGS $TA_CFLAGS" \ 169 | CXXFLAGS="$TA_CPPFLAGS $TA_CXXFLAGS" \ 170 | LDFLAGS="$TA_LDFLAGS" 171 | make 172 | make install 173 | cd .. 174 | 175 | 176 | echo "#####" 177 | echo "$HARFBUZZ" 178 | echo "#####" 179 | 180 | cd "$HARFBUZZ" || exit 1 181 | 182 | # Value `true' for `PKG_CONFIG' ensures that XXX_CFLAGS and XXX_LIBS 183 | # get actually used. 184 | ./configure \ 185 | --disable-dependency-tracking \ 186 | --disable-gtk-doc-html \ 187 | --with-glib=no \ 188 | --with-cairo=no \ 189 | --with-fontconfig=no \ 190 | --with-icu=no \ 191 | --prefix="$INST" \ 192 | --enable-static \ 193 | --disable-shared \ 194 | CFLAGS="$TA_CPPFLAGS $TA_CFLAGS" \ 195 | CXXFLAGS="$TA_CPPFLAGS $TA_CXXFLAGS" \ 196 | LDFLAGS="$TA_LDFLAGS" \ 197 | PKG_CONFIG=true \ 198 | FREETYPE_CFLAGS="$TA_CPPFLAGS/freetype2" \ 199 | FREETYPE_LIBS="$TA_LDFLAGS -lfreetype" 200 | make 201 | make install 202 | cd .. 203 | 204 | 205 | echo "#####" 206 | echo "$TTFAUTOHINT" 207 | echo "#####" 208 | 209 | cd "$TTFAUTOHINT" || exit 1 210 | 211 | # Value `true' for `PKG_CONFIG' ensures that XXX_CFLAGS and XXX_LIBS 212 | # get actually used. 213 | ./configure \ 214 | --disable-dependency-tracking \ 215 | --without-qt \ 216 | --without-doc \ 217 | --prefix="$INST" \ 218 | --enable-static \ 219 | --disable-shared \ 220 | --with-freetype-config="$INST/bin/freetype-config" \ 221 | CFLAGS="$TA_CPPFLAGS $TA_CFLAGS" \ 222 | CXXFLAGS="$TA_CPPFLAGS $TA_CXXFLAGS" \ 223 | LDFLAGS="$TA_LDFLAGS" \ 224 | PKG_CONFIG=true \ 225 | HARFBUZZ_CFLAGS="$TA_CPPFLAGS/harfbuzz" \ 226 | HARFBUZZ_LIBS="$TA_LDFLAGS -lharfbuzz" 227 | make LDFLAGS="$TA_LDFLAGS -all-static" 228 | make install-strip 229 | cd .. 230 | 231 | # test for the expected path to the executable 232 | if [ -f "$INST/bin/ttfautohint" ]; then 233 | echo "#####" 234 | echo "binary: $TTFAUTOHINT_BIN" 235 | echo "#####" 236 | else 237 | echo "ttfautohint executable was not found on the path $TTFAUTOHINT_BIN" 1>&2 238 | exit 1 239 | fi 240 | 241 | # eof 242 | --------------------------------------------------------------------------------