Skip to main content

Python cffi bridge to fontconfig's FcFontList/FcFontMatch

Project description

Python cffi bridge to fontconfig's FcFontList/FcFontMatch

Note: this is a plublished fork of tarruda python-fclist.

Useful for python programs that need to query information about fonts installed in the system(use this instead of parsing fc-list output). Requires the fontconfig shared library installed in a directory that the cffi module can find.

Installing

pip install fclist-cffi

Usage

from fclist import fclist, fcmatch

# Print the family, style and file path of monospace/truetype fonts
for font in fclist(spacing='mono', fontformat='TrueType'):
    print font.family, font.style, font.file

# Print the system's default monospace font
print fcmatch('monospace')

fclist can receive any keyword arguments that can be passed to the fc-list command, and the returned font objects have most attributes defined by fontconfig.h.

fcmatch receives the same pattern that is normally passed to fc-match, but it doesn't support the --all/--sort options(only returns a single font object).

Tests

Tests are written to use pytest.

Project details


Download files

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

Source Distribution

fclist-cffi-1.1.2.tar.gz (3.7 kB view hashes)

Uploaded Source

Built Distribution

fclist_cffi-1.1.2-py2.py3-none-any.whl (4.6 kB view hashes)

Uploaded Python 2 Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page