Skip to main content

pyfontaine

Latest PyPI Version Python Travis Build Status License: GPL v3

pyfontaine analyses fonts for their language and character/glyph-set support.

It has a straightforward pythonic set definition format:

Additional definitions are downloaded from the Extensis, font-config and Unicode websites during installation, and can be updated without reinstalling.

Adding your own definitions is easy. All files in the internals directory are auto-detected, so just add definition files there.

Installation

First, install Python and the pip python package manager. This is installed by default with homebrew python, so, install homebrew, then install pip as follows:

brew install python;
brew install icu4c;

On Mac OS X, install the pyicu dependency as follows:

CFLAGS=-I/usr/local/opt/icu4c/include LDFLAGS=-L/usr/local/opt/icu4c/lib pip install pyicu;

Install the latest release easily with pip:

sudo pip install fontaine

To install the latest development version:

sudo pip install https://github.com/googlefonts/pyfontaine/archive/master.zip;

Usage

Given a list of space separated font filenames, it returns a report with some general metadata and a language support analysis:

pyfontaine font.ttf;

Given a list of space separated unicode characters, or unicode values, it returns a list of character sets that include that character:

pyfontaine 0x0061;
pyfontaine ğ ø ∂;

Similarly you can find out if a font supports specific characters by also giving the filename:

pyfontaine U+C480 U+C481 font.ttf;

To output font reports in various formats:

pyfontaine --xml font.ttf;
pyfontaine --json font.ttf;
pyfontaine --csv font.ttf;
pyfontaine --wiki font.ttf;

The –wiki format produces a MediaWiki table (example)

To only show character sets from different collections:

pyfontaine --collections all font.ttf; # default
pyfontaine --collections pyfontaine font.ttf;
pyfontaine --collections uniblocks font.ttf;
pyfontaine --collections extensis font.ttf;
pyfontaine --collections fontconfig font.ttf;
pyfontaine --collections cldr font.ttf;
pyfontaine --collections subsets font.ttf;

To only show specific character sets:

pyfontaine --set africaan,adobe_latin_3 font.ttf;

To print a list of all the missing unicode values from each set:

   pyfontaine --missing --set adobe_latin_3 font.ttf;

To output visualisations of the coverage using `Hilbert curves <http://en.wikipedia.org/wiki/Hilbert_curve>`__ (thanks for the idea, `Øyvind 'pippin' Kolås <http://github.com/hodefoting>`__!):

   pyfontaine --show_hilbert font.ttf; ls -l coverage_pngs/;

The PNG files are stored in a new directory, ``coverage_pngs``, under the current directory.

Update collection data

You can update remote collections data when you are online:

pyfontaine --update-data 1;

Python Module

It has a python module called fontaine

Making a release on PyPI

To release a new version on PyPI, create and push a new git tag with a version number following the [semver](https://www.semver.org) versioning scheme.

Then set up a ~/.pypirc file:

[distutils]
index-servers=pypi

[pypi]
repository = https://pypi.python.org/pypi

            [server-login]
username = user
password = password

Then run:

python setup.py build;
python setup.py sdist upload;

Contributing

Your contributions under the GPLv3 are welcome!

pyfontaine is a python reimplementation of Fontaine by Ed Trager, and has been made by Vitaly Volkov, Dave Crossland, Mikhail Kashkin and Felipe Sanches.

Thanks

We would like to thank some upstream projects that make pyfontaine even more useful:

Dependencies

Release files for fontaine 1.4.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Built distribution (wheel)

Table of built distributions (wheels) for fontaine 1.4.0
File Interpreter ABI Platform
fontaine-1.4.0-py2.py3-none-any.whl Python 3, Python 2 none any Details

Release files / fontaine-1.4.0-py2.py3-none-any.whl

Download URL fontaine-1.4.0-py2.py3-none-any.whl
Size 3.4 MB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
3c1ab64e7581d90922526cf50f527c38ca4d19a07bca06f618e053cdada2610b
BLAKE2b-256 checksum
How to use checksums
163288c6e98ed1d29c34212f59308139018c0f6d63d8d86659c0bc6a8ad4ad2a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/2.0.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.4.0 requests-toolbelt/0.9.1 tqdm/4.36.1 CPython/3.6.3

Release history Release notifications | RSS feed

This release

1.4.0 This release

1 release file

1.3.10

1 release file

1.3.9

1 release file

1.3.7

1 release file

1.3.6

1 release file

1.3.5

1 release file

1.3.4

1 release file

1.3.3

1 release file

1.3.2

1 release file

1.3.0

1 release file

1.2.2

1 release file

1.2.1

1 release file

1.1.5

1 release file

1.1.4

1 release file

1.0.9

1 release file

1.0.8

2 release files

1.0.7

1 release file

1.0.6

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page