Skip to main content

Python bindings for Fontconfig library

Project description

Python bindings for Fontconfig library

Requirement

Tested on

  • Python 2.7.2 (32-bit, 64-bit)

  • Python 3.2.2 (32-bit, 64-bit)

Installation

From PyPI:

>>> pip install Python-fontconfig

or

>>> easy_install Python-fontconfig

From GitHub:

>>> git clone git://github.com/Vayn/python-fontconfig.git
>>> cd python-fontconfig/
>>> python setup.py install

Building C source

>>> python setup.py build_ext -i

Testing

>>> cd test/
>>> python test.py

Usage

>>> import fontconfig
>>> fonts = fontconfig.query(family='ubuntu', lang='en')
>>> fonts
['/usr/share/fonts/truetype/ubuntu-font-family/Ubuntu-BI.ttf',
 '/usr/share/fonts/truetype/ubuntu-font-family/Ubuntu-L.ttf',
 '/usr/share/fonts/truetype/ubuntu-font-family/Ubuntu-LI.ttf',
 '/usr/share/fonts/truetype/ubuntu-font-family/Ubuntu-R.ttf',
 '/usr/share/fonts/truetype/ubuntu-font-family/Ubuntu-B.ttf',
 '/usr/share/fonts/truetype/ubuntu-font-family/Ubuntu-RI.ttf']
>>> font = fonts[0]
>>> font
<FcFont: Ubuntu>
>>> font.
font.capability     font.fullname       font.slant
font.count_chars    font.get_languages  font.spacing
font.decorative     font.has_char       font.style
font.family         font.index          font.weight
font.file           font.outline        font.width
font.fontformat     font.print_pattern
font.foundry        font.scalable
>>> font.family
[('en', 'Ubuntu')]
>>> font.foundry
'unknown'
>>> font.fontformat
'TrueType'
>>> font.has_char('A')
True
>>> font.file
'/usr/share/fonts/truetype/ubuntu-font-family/Ubuntu-BI.ttf'
>>> font = fontconfig.FcFont(font.file)
>>> font.family
[('en', 'Ubuntu')]

License

This program is released under GPLv3 license, see LICENSE for more detail.

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

Python-fontconfig-0.5.1.tar.gz (45.9 kB view details)

Uploaded Source

File details

Details for the file Python-fontconfig-0.5.1.tar.gz.

File metadata

File hashes

Hashes for Python-fontconfig-0.5.1.tar.gz
Algorithm Hash digest
SHA256 b7cfe366242f83b8cd7175b7d4dd95d19f42d619c58a51914f72b1e741739994
MD5 8ccdc2bf074da3ef1cc9a8c0a296c80d
BLAKE2b-256 e601a28b0160f82ca5e946e315251c797f07c74e5c5a53f2a9e706eebc680191

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