Skip to main content

fontconfig-py

PyPI version Docs status

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(), and sort() functions
  • Continuous integration - Automated PyPI releases and testing
  • MIT license - Permissive licensing

Other Python fontconfig wrappers

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.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

fontconfig_py-1.0.3-cp310-abi3-musllinux_1_2_x86_64.whl (917.0 kB view details)

Uploaded CPython 3.10+musllinux: musl 1.2+ x86-64

fontconfig_py-1.0.3-cp310-abi3-musllinux_1_2_aarch64.whl (907.9 kB view details)

Uploaded CPython 3.10+musllinux: musl 1.2+ ARM64

fontconfig_py-1.0.3-cp310-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl (844.4 kB view details)

Uploaded CPython 3.10+manylinux: glibc 2.17+ x86-64manylinux: glibc 2.28+ x86-64

fontconfig_py-1.0.3-cp310-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl (845.1 kB view details)

Uploaded CPython 3.10+manylinux: glibc 2.17+ ARM64manylinux: glibc 2.28+ ARM64

fontconfig_py-1.0.3-cp310-abi3-macosx_10_9_universal2.whl (1.4 MB view details)

Uploaded CPython 3.10+macOS 10.9+ universal2 (ARM64, x86-64)

File details

Details for the file fontconfig_py-1.0.3-cp310-abi3-musllinux_1_2_x86_64.whl.

File metadata

File hashes

Hashes for fontconfig_py-1.0.3-cp310-abi3-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 723bdec4374207bee930fbeedcc0ee667cf25ef102b3237f7591f37c64134789
MD5 c18261cb471eb584b93fccc24af60ddc
BLAKE2b-256 f47ac66b33fa321ec09a94ce348066e8d4d491357d6b0e24cb4553db229b6bd5

See more details on using hashes here.

Provenance

The following attestation bundles were made for fontconfig_py-1.0.3-cp310-abi3-musllinux_1_2_x86_64.whl:

Publisher: wheels.yaml on CyberAgent/fontconfig-py

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file fontconfig_py-1.0.3-cp310-abi3-musllinux_1_2_aarch64.whl.

File metadata

File hashes

Hashes for fontconfig_py-1.0.3-cp310-abi3-musllinux_1_2_aarch64.whl
Algorithm Hash digest
SHA256 32248cce4b707eaab5c0dd0df5f4b6795e846b8ef190e6a23010b4d76fdc0189
MD5 4f22ee450f17a1e3f22e3c64705ad1bb
BLAKE2b-256 bcb2c11aef6d10c643739f521a0ce6218394a838fe984fc78fbded659d768ad9

See more details on using hashes here.

Provenance

The following attestation bundles were made for fontconfig_py-1.0.3-cp310-abi3-musllinux_1_2_aarch64.whl:

Publisher: wheels.yaml on CyberAgent/fontconfig-py

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file fontconfig_py-1.0.3-cp310-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for fontconfig_py-1.0.3-cp310-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 56fa5304d2fa9e97abc6e11076e470dd4b795d978e5cc2fd4156e6db4359d607
MD5 a5e81c87aad2d55e074abffb2995ca9b
BLAKE2b-256 f7f03c1cd0505140128101abc4f08fd4ed50852dccb58309174895a5f9b303f1

See more details on using hashes here.

Provenance

The following attestation bundles were made for fontconfig_py-1.0.3-cp310-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl:

Publisher: wheels.yaml on CyberAgent/fontconfig-py

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file fontconfig_py-1.0.3-cp310-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl.

File metadata

File hashes

Hashes for fontconfig_py-1.0.3-cp310-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 0cc6d8b5552e6c90fae6056dd38ea8d57f77a45e786f406744fbfd3090a9477a
MD5 bfb3732cbd48cbb429508371b2b3c245
BLAKE2b-256 47be6292eeb1b1242b3900afcc2d4e25ed984c39491bc91d5454033a318d5e4f

See more details on using hashes here.

Provenance

The following attestation bundles were made for fontconfig_py-1.0.3-cp310-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl:

Publisher: wheels.yaml on CyberAgent/fontconfig-py

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file fontconfig_py-1.0.3-cp310-abi3-macosx_10_9_universal2.whl.

File metadata

File hashes

Hashes for fontconfig_py-1.0.3-cp310-abi3-macosx_10_9_universal2.whl
Algorithm Hash digest
SHA256 9a12d8d9f88bd23de57424465c1aa4ad57b13f40fb31b8f01ae9d5b58cdb69d8
MD5 fccb8716276420201e866b673ad136eb
BLAKE2b-256 df9b99a8de63b4bbe83ea7206b0d306ed16ee0aae0d1ba6534dfd0cc450f496c

See more details on using hashes here.

Provenance

The following attestation bundles were made for fontconfig_py-1.0.3-cp310-abi3-macosx_10_9_universal2.whl:

Publisher: wheels.yaml on CyberAgent/fontconfig-py

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Release history Release notifications | RSS feed

This release

1.0.3 This release

5 files

1.0.1

5 files

1.0.0

5 files

0.4.0

35 files

0.3.1

35 files

0.3.0

35 files

0.2.1

35 files

0.2.0

35 files

0.1.3

35 files

0.1.2

14 files

0.1.1

14 files

0.1.0

14 files

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page