Skip to content

Add APIs to report FreeType features - #9905

Open
akx wants to merge 1 commit into
python-pillow:mainfrom
akx:ft-features
Open

Add APIs to report FreeType features#9905
akx wants to merge 1 commit into
python-pillow:mainfrom
akx:ft-features

Conversation

@akx

@akx akx commented Aug 25, 2026

Copy link
Copy Markdown
Contributor

Refs #9898 (part of the investigation there).

This PR adds new PIL.features APIs to introspect the FreeType features that are available for a given build. On my default macOS-Homebrew-supplied-FreeType, the features are

FreeType built with bytecode_interpreter, bzip2, color_layers, lzw, mac_fonts, png, subpixel_hinting, svg, zlib

but when FreeType is built as an everything-and-the-kitchen-sink build,

FreeType built with brotli, bytecode_interpreter, bzip2, color_layers, gpos_kerning, harfbuzz_autohinter, lzw, mac_fonts, png, subpixel_hinting, svg, zlib

The existence of gpos_kerning here (and not in the default build) is the interesting thing for #9898, as it looks like Noto Sans doesn't have a kern table, just GPOS (though that'll only matter if one explicitly requests basic layout):

$ uvx --from=fonttools[lxml] ttx Tests/fonts/NotoSans-Regular.ttf 2>&1 | grep kern
$ uvx --from=fonttools[lxml] ttx Tests/fonts/NotoSans-Regular.ttf 2>&1 | grep GPOS
Dumping 'GPOS' table...
~/b/Pillow (ft-features) $

Let's see what the flags end up being on the CI builds.

@akx

akx commented Aug 25, 2026

Copy link
Copy Markdown
Contributor Author
# Checks FreeType built with
1 (21) Benchmark Python 3.14
Docs
debian-13-trixie-amd64
debian-13-trixie-x86
ubuntu-24.04-noble-amd64
ubuntu-24.04-noble-amd64-valgrind 1, 2, 3, 4
ubuntu-latest Python 3.11, 3.12, 3.13, 3.14, 3.14t, 3.15, 3.15t, pypy3.11
brotli, bytecode_interpreter, bzip2, color_layers, lzw, mac_fonts, png, subpixel_hinting, svg, zlib
2 (11) MinGW
alpine
amazon-2023-amd64
arch
centos-stream-10-amd64
fedora-43-amd64
fedora-44-amd64
ubuntu-26.04-resolute-amd64
ubuntu-26.04-resolute-arm64v8
ubuntu-26.04-resolute-ppc64le
ubuntu-26.04-resolute-s390x
brotli, bytecode_interpreter, bzip2, color_layers, harfbuzz_autohinter, lzw, mac_fonts, png, subpixel_hinting, svg, zlib
3 (8) macos-26-intel Python 3.11
macos-latest Python 3.12, 3.13, 3.14, 3.14t, 3.15, 3.15t, pypy3.11
bytecode_interpreter, bzip2, color_layers, lzw, mac_fonts, png, subpixel_hinting, svg, zlib
4 (6) Python 3.11 (x86)
Python 3.12 (x64)
Python 3.13 (x64)
Python 3.14 (x64)
Python 3.15 (x64)
Python pypy3.11 (x64)
bytecode_interpreter, color_layers, lzw, mac_fonts, subpixel_hinting, svg, zlib
5 (1) centos-stream-9-amd64 brotli, bytecode_interpreter, bzip2, color_layers, lzw, mac_fonts, subpixel_hinting, svg
6 (1) gentoo bytecode_interpreter, bzip2, color_layers, harfbuzz_autohinter, lzw, mac_fonts, png, subpixel_hinting, svg, zlib

Differences at a glance

Feature G1 G2 G3 G4 G5 G6
brotli
bytecode_interpreter
bzip2
color_layers
harfbuzz_autohinter
lzw
mac_fonts
png
subpixel_hinting
svg
zlib

So yeah, no build of ours seems to enable gpos_kerning, so the only way to get kerning for fonts with a GPOS table is RAQM shaping.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant