diff --git a/README.md b/README.md index bd95bf7..2018134 100644 --- a/README.md +++ b/README.md @@ -30,10 +30,14 @@ After running `build.py`, you should get: - **Python 3** - **[fontTools](https://github.com/fonttools/fonttools)** — install with `pip install fonttools` - **[FontForge](https://fontforge.org)** — the build script auto-detects FontForge from PATH, Flatpak, or the macOS app bundle +- **[ttfautohint](https://freetype.org/ttfautohint/)** — required for proper rendering on Kobo e-readers ### Linux preparation ``` +sudo apt install ttfautohint # Debian/Ubuntu +sudo dnf install ttfautohint # Fedora +brew install ttfautohint # Bazzite (immutable Fedora) pip install fonttools flatpak install flathub org.fontforge.FontForge ``` @@ -44,7 +48,7 @@ On macOS, if you're using the built-in version of Python (via Xcode), you may ne ```bash echo 'export PATH="$HOME/Library/Python/3.9/bin:$PATH"' >> ~/.zshrc -brew install fontforge +brew install fontforge ttfautohint brew unlink python3 # ensure that python3 isn't linked via Homebrew pip3 install fonttools font-line source ~/.zshrc diff --git a/build.py b/build.py index df35a3b..baaaf1a 100755 --- a/build.py +++ b/build.py @@ -659,6 +659,24 @@ def autohint_ttf(ttf_path): # MAIN # ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +def check_ttfautohint(): + """Verify ttfautohint is installed before starting the build.""" + if shutil.which("ttfautohint"): + return + print( + "ERROR: ttfautohint not found.\n" + "\n" + "ttfautohint is required for proper rendering on Kobo e-readers.\n" + "Install it with:\n" + " macOS/Bazzite: brew install ttfautohint\n" + " Debian/Ubuntu: sudo apt install ttfautohint\n" + " Fedora: sudo dnf install ttfautohint\n" + " Arch: sudo pacman -S ttfautohint\n", + file=sys.stderr, + ) + sys.exit(1) + + def main(): print("=" * 60) print(" Readerly Build") @@ -666,6 +684,8 @@ def main(): ff_cmd = find_fontforge() print(f" FontForge: {' '.join(ff_cmd)}") + check_ttfautohint() + print(f" ttfautohint: {shutil.which('ttfautohint')}") family = DEFAULT_FAMILY old_kern = False