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
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 Distribution
Built Distribution
Hashes for fclist_cffi-1.1.2-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e8d0eff93f40a60f611db67aef13283a2de23314b42b6a161d413d3827bc8c04 |
|
MD5 | 9befbd7acf5e7947d446756d6978f78b |
|
BLAKE2b-256 | 1371a8ab7fdc3df972ea80fc42b9874d642a7ef2e69b8b5203978664f03b3ac8 |