fontconfig-py
Python bindings to fontconfig based on Cython.
What is fontconfig? Fontconfig is a library for configuring and customizing font access on Unix-based systems. It helps applications locate installed fonts and select the best matching font based on criteria like family name, weight, slant, and language support. Instead of hardcoding font paths, applications use fontconfig to query the system's font database.
Currently, Linux and macOS are supported.
Install
Install from PyPI:
pip install fontconfig-py
Usage
Finding the best matching font
Use fontconfig.match() to find the single best font matching your criteria:
import fontconfig
# Find the best Arial font
font = fontconfig.match(":family=Arial:weight=200")
if font:
print(font["family"], font["file"])
# Or using a properties dict
font = fontconfig.match(properties={"family": "Arial", "weight": 200})
Listing all matching fonts
Use fontconfig.list() to get all fonts matching a pattern:
import fontconfig
# List all English fonts
fonts = fontconfig.list(":lang=en", select=("family", "file"))
for font in fonts:
print(font["family"], font["file"])
# List all available fonts
all_fonts = fontconfig.list()
Getting sorted font results
Use fontconfig.sort() to get fonts sorted by match quality:
import fontconfig
# Get Arial fonts sorted by match quality
fonts = fontconfig.sort(":family=Arial")
for font in fonts[:5]: # Top 5 matches
print(font["family"], font["file"])
Documentation
For detailed API documentation and advanced usage, visit fontconfig-py.readthedocs.io.
Features
This package offers several advantages over other fontconfig wrappers:
- Cython-based wrapper - High performance with Pythonic API
- Statically linked binary wheels - No runtime dependencies on fontconfig or freetype
- Cross-platform support - Linux and macOS wheels available
- Modern high-level API - Simple
match(),list(), andsort()functions - Continuous integration - Automated PyPI releases and testing
- MIT license - Permissive licensing
Other Python fontconfig wrappers
- fontconfig: CFFI bindings for fontconfig
- python_fontconfig: Python wrapper based on ctypes
- Python_fontconfig: Unmaintained Cython wrapper
Contributing
Contributions are welcome! Please see our Contributing Guidelines for details on:
- Setting up the development environment
- Running tests and code quality checks
- Submitting pull requests
- Code of conduct
For security vulnerabilities, please see our Security Policy.
License
This project is distributed under MIT license.
The binary wheels bundle fontconfig and freetype, which are distributed under their respective licenses. See NOTICE for details.
Release files for fontconfig-py 1.0.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Built distributions (wheels)
| File | Reset | |||
|---|---|---|---|---|
| fontconfig_py-1.0.3-cp310-abi3-musllinux_1_2_x86_64.whl | CPython 3.10 | abi3 | Linux musl 1.2+ x86-64 | Details |
| fontconfig_py-1.0.3-cp310-abi3-musllinux_1_2_aarch64.whl | CPython 3.10 | abi3 | Linux musl 1.2+ ARM64 | Details |
| fontconfig_py-1.0.3-cp310-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl | CPython 3.10 | abi3 | Linux glibc 2.28+ x86-64, Linux glibc 2.17+ x86-64 | Details |
| fontconfig_py-1.0.3-cp310-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl | CPython 3.10 | abi3 | Linux glibc 2.28+ ARM64, Linux glibc 2.17+ ARM64 | Details |
| fontconfig_py-1.0.3-cp310-abi3-macosx_10_9_universal2.whl | CPython 3.10 | abi3 | macOS 10.9+ universal2 (ARM64, x86-64) | Details |
Total release size: 4.9 MB
Release files / fontconfig_py-1.0.3-cp310-abi3-musllinux_1_2_x86_64.whl
| Download URL | fontconfig_py-1.0.3-cp310-abi3-musllinux_1_2_x86_64.whl |
|---|---|
| Size | 917.0 kB |
| Tags | CPython 3.10 Linux musl 1.2+ x86-64 abi3 |
|
SHA-256 checksum How to use checksums |
723bdec4374207bee930fbeedcc0ee667cf25ef102b3237f7591f37c64134789
|
|
BLAKE2b-256 checksum How to use checksums |
f47ac66b33fa321ec09a94ce348066e8d4d491357d6b0e24cb4553db229b6bd5
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Aug 18, 2026.
Transparency logRelease files / fontconfig_py-1.0.3-cp310-abi3-musllinux_1_2_aarch64.whl
| Download URL | fontconfig_py-1.0.3-cp310-abi3-musllinux_1_2_aarch64.whl |
|---|---|
| Size | 907.9 kB |
| Tags | CPython 3.10 Linux musl 1.2+ ARM64 abi3 |
|
SHA-256 checksum How to use checksums |
32248cce4b707eaab5c0dd0df5f4b6795e846b8ef190e6a23010b4d76fdc0189
|
|
BLAKE2b-256 checksum How to use checksums |
bcb2c11aef6d10c643739f521a0ce6218394a838fe984fc78fbded659d768ad9
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Aug 18, 2026.
Transparency logRelease files / fontconfig_py-1.0.3-cp310-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
| Download URL | fontconfig_py-1.0.3-cp310-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl |
|---|---|
| Size | 844.4 kB |
| Tags | CPython 3.10 Linux glibc 2.17+ x86-64 Linux glibc 2.28+ x86-64 abi3 |
|
SHA-256 checksum How to use checksums |
56fa5304d2fa9e97abc6e11076e470dd4b795d978e5cc2fd4156e6db4359d607
|
|
BLAKE2b-256 checksum How to use checksums |
f7f03c1cd0505140128101abc4f08fd4ed50852dccb58309174895a5f9b303f1
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Aug 18, 2026.
Transparency logRelease files / fontconfig_py-1.0.3-cp310-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl
| Download URL | fontconfig_py-1.0.3-cp310-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl |
|---|---|
| Size | 845.1 kB |
| Tags | CPython 3.10 Linux glibc 2.17+ ARM64 Linux glibc 2.28+ ARM64 abi3 |
|
SHA-256 checksum How to use checksums |
0cc6d8b5552e6c90fae6056dd38ea8d57f77a45e786f406744fbfd3090a9477a
|
|
BLAKE2b-256 checksum How to use checksums |
47be6292eeb1b1242b3900afcc2d4e25ed984c39491bc91d5454033a318d5e4f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Aug 18, 2026.
Transparency logRelease files / fontconfig_py-1.0.3-cp310-abi3-macosx_10_9_universal2.whl
| Download URL | fontconfig_py-1.0.3-cp310-abi3-macosx_10_9_universal2.whl |
|---|---|
| Size | 1.4 MB |
| Tags | CPython 3.10 abi3 macOS 10.9+ universal2 (ARM64, x86-64) |
|
SHA-256 checksum How to use checksums |
9a12d8d9f88bd23de57424465c1aa4ad57b13f40fb31b8f01ae9d5b58cdb69d8
|
|
BLAKE2b-256 checksum How to use checksums |
df9b99a8de63b4bbe83ea7206b0d306ed16ee0aae0d1ba6534dfd0cc450f496c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Aug 18, 2026.
Transparency log