Add ttfautohint dependency check
This commit is contained in:
@@ -30,10 +30,14 @@ After running `build.py`, you should get:
|
|||||||
- **Python 3**
|
- **Python 3**
|
||||||
- **[fontTools](https://github.com/fonttools/fonttools)** — install with `pip install fonttools`
|
- **[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
|
- **[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
|
### Linux preparation
|
||||||
|
|
||||||
```
|
```
|
||||||
|
sudo apt install ttfautohint # Debian/Ubuntu
|
||||||
|
sudo dnf install ttfautohint # Fedora
|
||||||
|
brew install ttfautohint # Bazzite (immutable Fedora)
|
||||||
pip install fonttools
|
pip install fonttools
|
||||||
flatpak install flathub org.fontforge.FontForge
|
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
|
```bash
|
||||||
echo 'export PATH="$HOME/Library/Python/3.9/bin:$PATH"' >> ~/.zshrc
|
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
|
brew unlink python3 # ensure that python3 isn't linked via Homebrew
|
||||||
pip3 install fonttools font-line
|
pip3 install fonttools font-line
|
||||||
source ~/.zshrc
|
source ~/.zshrc
|
||||||
|
|||||||
20
build.py
20
build.py
@@ -659,6 +659,24 @@ def autohint_ttf(ttf_path):
|
|||||||
# MAIN
|
# 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():
|
def main():
|
||||||
print("=" * 60)
|
print("=" * 60)
|
||||||
print(" Readerly Build")
|
print(" Readerly Build")
|
||||||
@@ -666,6 +684,8 @@ def main():
|
|||||||
|
|
||||||
ff_cmd = find_fontforge()
|
ff_cmd = find_fontforge()
|
||||||
print(f" FontForge: {' '.join(ff_cmd)}")
|
print(f" FontForge: {' '.join(ff_cmd)}")
|
||||||
|
check_ttfautohint()
|
||||||
|
print(f" ttfautohint: {shutil.which('ttfautohint')}")
|
||||||
|
|
||||||
family = DEFAULT_FAMILY
|
family = DEFAULT_FAMILY
|
||||||
old_kern = False
|
old_kern = False
|
||||||
|
|||||||
Reference in New Issue
Block a user