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 details)

Uploaded Source

Built Distribution

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

Uploaded Python 2 Python 3

File details

Details for the file fclist-cffi-1.1.2.tar.gz.

File metadata

  • Download URL: fclist-cffi-1.1.2.tar.gz
  • Upload date:
  • Size: 3.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/47.1.1 requests-toolbelt/0.9.1 tqdm/4.46.0 CPython/3.8.3

File hashes

Hashes for fclist-cffi-1.1.2.tar.gz
Algorithm Hash digest
SHA256 1bb3c039156b8b1913b9e582d4a8f1a48b3d8ea56e5152d604c020874a7e779a
MD5 8efef3cdb69a69b62e34e07f06288b2e
BLAKE2b-256 7e457cace5df531d61b2dfd5b313fda77f64e9f85cf8dd27b0a00dcc19ee2057

See more details on using hashes here.

File details

Details for the file fclist_cffi-1.1.2-py2.py3-none-any.whl.

File metadata

  • Download URL: fclist_cffi-1.1.2-py2.py3-none-any.whl
  • Upload date:
  • Size: 4.6 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/47.1.1 requests-toolbelt/0.9.1 tqdm/4.46.0 CPython/3.8.3

File hashes

Hashes for fclist_cffi-1.1.2-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 e8d0eff93f40a60f611db67aef13283a2de23314b42b6a161d413d3827bc8c04
MD5 9befbd7acf5e7947d446756d6978f78b
BLAKE2b-256 1371a8ab7fdc3df972ea80fc42b9874d642a7ef2e69b8b5203978664f03b3ac8

See more details on using hashes here.

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