Python bindings to fontconfig
Project description
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.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
Built Distributions
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file fontconfig_py-1.0.1-cp310-abi3-musllinux_1_2_x86_64.whl.
File metadata
- Download URL: fontconfig_py-1.0.1-cp310-abi3-musllinux_1_2_x86_64.whl
- Upload date:
- Size: 913.9 kB
- Tags: CPython 3.10+, musllinux: musl 1.2+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
25648e376da1bd503c1285feb406943b189cc2026a233bd8de2e5d34be61c520
|
|
| MD5 |
73a5b8c435f7cd56a24b67ba21d9cdd8
|
|
| BLAKE2b-256 |
8cee955cdde98562159ad353a001251d92ae09e80401973cfca988b7a7fe7de9
|
Provenance
The following attestation bundles were made for fontconfig_py-1.0.1-cp310-abi3-musllinux_1_2_x86_64.whl:
Publisher:
wheels.yaml on kyamagu/fontconfig-py
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
fontconfig_py-1.0.1-cp310-abi3-musllinux_1_2_x86_64.whl -
Subject digest:
25648e376da1bd503c1285feb406943b189cc2026a233bd8de2e5d34be61c520 - Sigstore transparency entry: 776000673
- Sigstore integration time:
-
Permalink:
kyamagu/fontconfig-py@b47a0c2d3fb87de060502753bd261a52e1321423 -
Branch / Tag:
refs/tags/v1.0.1 - Owner: https://github.com/kyamagu
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
wheels.yaml@b47a0c2d3fb87de060502753bd261a52e1321423 -
Trigger Event:
release
-
Statement type:
File details
Details for the file fontconfig_py-1.0.1-cp310-abi3-musllinux_1_2_aarch64.whl.
File metadata
- Download URL: fontconfig_py-1.0.1-cp310-abi3-musllinux_1_2_aarch64.whl
- Upload date:
- Size: 904.4 kB
- Tags: CPython 3.10+, musllinux: musl 1.2+ ARM64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
79c7e9025fc8f2c4eb3369c64d177f612792ef06d0f9042b16d7bc459a1f5074
|
|
| MD5 |
2747f383c9e5ee56c280b7a4b6cb1321
|
|
| BLAKE2b-256 |
03d370ce5ffbdaba3e53b33e27afa0be8df01e0ab92a89668e56491c75612bb7
|
Provenance
The following attestation bundles were made for fontconfig_py-1.0.1-cp310-abi3-musllinux_1_2_aarch64.whl:
Publisher:
wheels.yaml on kyamagu/fontconfig-py
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
fontconfig_py-1.0.1-cp310-abi3-musllinux_1_2_aarch64.whl -
Subject digest:
79c7e9025fc8f2c4eb3369c64d177f612792ef06d0f9042b16d7bc459a1f5074 - Sigstore transparency entry: 776000652
- Sigstore integration time:
-
Permalink:
kyamagu/fontconfig-py@b47a0c2d3fb87de060502753bd261a52e1321423 -
Branch / Tag:
refs/tags/v1.0.1 - Owner: https://github.com/kyamagu
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
wheels.yaml@b47a0c2d3fb87de060502753bd261a52e1321423 -
Trigger Event:
release
-
Statement type:
File details
Details for the file fontconfig_py-1.0.1-cp310-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl.
File metadata
- Download URL: fontconfig_py-1.0.1-cp310-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
- Upload date:
- Size: 841.8 kB
- Tags: CPython 3.10+, manylinux: glibc 2.17+ x86-64, manylinux: glibc 2.28+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4d405ed7ad3766a4a343d6667ceb499d903a5a63a633313fdf431311d819f3cd
|
|
| MD5 |
d8a36e873d700da9592ca14c865aaa10
|
|
| BLAKE2b-256 |
abcb7eb9573fe8aa991ea3fce804c85f61cb57cc9be5a15979866dd8ac9e5011
|
Provenance
The following attestation bundles were made for fontconfig_py-1.0.1-cp310-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl:
Publisher:
wheels.yaml on kyamagu/fontconfig-py
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
fontconfig_py-1.0.1-cp310-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl -
Subject digest:
4d405ed7ad3766a4a343d6667ceb499d903a5a63a633313fdf431311d819f3cd - Sigstore transparency entry: 776000692
- Sigstore integration time:
-
Permalink:
kyamagu/fontconfig-py@b47a0c2d3fb87de060502753bd261a52e1321423 -
Branch / Tag:
refs/tags/v1.0.1 - Owner: https://github.com/kyamagu
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
wheels.yaml@b47a0c2d3fb87de060502753bd261a52e1321423 -
Trigger Event:
release
-
Statement type:
File details
Details for the file fontconfig_py-1.0.1-cp310-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl.
File metadata
- Download URL: fontconfig_py-1.0.1-cp310-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl
- Upload date:
- Size: 842.2 kB
- Tags: CPython 3.10+, manylinux: glibc 2.17+ ARM64, manylinux: glibc 2.28+ ARM64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e5e4f23fdaed3d2bdc20a0b2f4402babe9ed37b949d3fdebe4c0387a4ea02359
|
|
| MD5 |
e458e84a561b72f68922bad51c318303
|
|
| BLAKE2b-256 |
093c272faeb1d59ba24bbaa2ee733b54dfb6941901026451d38d38ff7676496a
|
Provenance
The following attestation bundles were made for fontconfig_py-1.0.1-cp310-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl:
Publisher:
wheels.yaml on kyamagu/fontconfig-py
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
fontconfig_py-1.0.1-cp310-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl -
Subject digest:
e5e4f23fdaed3d2bdc20a0b2f4402babe9ed37b949d3fdebe4c0387a4ea02359 - Sigstore transparency entry: 776000701
- Sigstore integration time:
-
Permalink:
kyamagu/fontconfig-py@b47a0c2d3fb87de060502753bd261a52e1321423 -
Branch / Tag:
refs/tags/v1.0.1 - Owner: https://github.com/kyamagu
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
wheels.yaml@b47a0c2d3fb87de060502753bd261a52e1321423 -
Trigger Event:
release
-
Statement type:
File details
Details for the file fontconfig_py-1.0.1-cp310-abi3-macosx_10_9_universal2.whl.
File metadata
- Download URL: fontconfig_py-1.0.1-cp310-abi3-macosx_10_9_universal2.whl
- Upload date:
- Size: 1.4 MB
- Tags: CPython 3.10+, macOS 10.9+ universal2 (ARM64, x86-64)
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b6f79ae351f38aade0883a01e739aaee328bf2943ab73ba17b403f9e5cd067d8
|
|
| MD5 |
11b8c8adb461f7ac9dd1b83683d66e63
|
|
| BLAKE2b-256 |
6e8730fa0c484172f08187c0cca9125bf8733ca769c6f2bff4520deeda075dda
|
Provenance
The following attestation bundles were made for fontconfig_py-1.0.1-cp310-abi3-macosx_10_9_universal2.whl:
Publisher:
wheels.yaml on kyamagu/fontconfig-py
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
fontconfig_py-1.0.1-cp310-abi3-macosx_10_9_universal2.whl -
Subject digest:
b6f79ae351f38aade0883a01e739aaee328bf2943ab73ba17b403f9e5cd067d8 - Sigstore transparency entry: 776000663
- Sigstore integration time:
-
Permalink:
kyamagu/fontconfig-py@b47a0c2d3fb87de060502753bd261a52e1321423 -
Branch / Tag:
refs/tags/v1.0.1 - Owner: https://github.com/kyamagu
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
wheels.yaml@b47a0c2d3fb87de060502753bd261a52e1321423 -
Trigger Event:
release
-
Statement type: