Python tool to check font files for language/character set support
Python
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
bin delimiter for csv List specific characters supported in the passed fo… Dec 15, 2015
fontaine
.gitignore Updated .gitignore Nov 10, 2014
.gitmodules
.travis.yml
AUTHORS.txt
INSTALL.md
LICENSE.txt
MANIFEST.in Warning message about README.md #47 Sep 11, 2014
README.rst
setup.cfg
setup.py

README.rst

pyfontaine

Build Status Health Coverage Status

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/davelab6/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;

Update collection data

You can update remote collections data when you are online:

pyfontaine --update-data 1;

Python Module

It has a python module, fontaine

Making a release on PyPI

To release a new version on PyPI, increment the [fontaine/__init__.py](fontaine/__init__.py) 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 by Vitaly Volkov, Dave Crossland and Mikhail Kashkin.

Thanks

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

Dependencies

Related Projects