• Home
  • History
  • Annotate
Name Date Size #Lines LOC

..03-May-2022-

bin/H18-Oct-2019-734606

data/test/H18-Oct-2019-

fontaine/H18-Oct-2019-322,426307,630

.gitignoreH A D18-Oct-2019334 4133

.gitmodulesH A D18-Oct-2019131 43

.travis.ymlH A D18-Oct-20191.1 KiB3130

INSTALL.mdH A D18-Oct-20191.2 KiB5850

MANIFEST.inH A D18-Oct-201972 32

README.rstH A D18-Oct-20196.2 KiB179117

setup.cfgH A D18-Oct-201922 32

setup.pyH A D03-May-20222.2 KiB6750

README.rst

1pyfontaine
2==========================================================
3
4|Latest PyPI Version| |Python| |Travis Build Status| |License: GPL v3|
5
6pyfontaine analyses fonts for their language and character/glyph-set support.
7
8It has a straightforward pythonic set definition format:
9
10- `simple example <https://github.com/googlefonts/pyfontaine/blob/master/fontaine/charsets/internals/africaan.py>`__
11- `medium example <https://github.com/googlefonts/pyfontaine/blob/master/fontaine/charsets/internals/armenian.py>`__
12- `complex example <https://github.com/googlefonts/pyfontaine/blob/master/fontaine/charsets/internals/polish.py>`__
13
14Additional definitions are downloaded from the Extensis, font-config and Unicode websites during installation, and can be updated without reinstalling.
15
16Adding your own definitions is easy.
17All files in the `internals <https://github.com/googlefonts/pyfontaine/tree/master/fontaine/charsets/internals>`__ directory are auto-detected, so just add definition files there.
18
19Installation
20------------
21
22First, install Python and the `pip <http://www.pip-installer.org>`__ python package manager. This is installed by default with `homebrew <http://brew.sh/>`__ python, so, install homebrew, then install pip as follows::
23
24    brew install python;
25    brew install icu4c;
26
27On Mac OS X, install the pyicu dependency as follows::
28
29    CFLAGS=-I/usr/local/opt/icu4c/include LDFLAGS=-L/usr/local/opt/icu4c/lib pip install pyicu;
30
31Install the latest release easily with pip::
32
33    sudo pip install fontaine
34
35To install the latest development version::
36
37    sudo pip install https://github.com/googlefonts/pyfontaine/archive/master.zip;
38
39Usage
40-----
41
42Given a list of space separated font filenames, it returns a report with some general metadata and a language support analysis::
43
44    pyfontaine font.ttf;
45
46Given a list of space separated unicode characters, or unicode values, it returns a list of character sets that include that character::
47
48    pyfontaine 0x0061;
49    pyfontaine ğ ø ∂;
50
51Similarly you can find out if a font supports specific characters by also giving the filename::
52
53    pyfontaine U+C480 U+C481 font.ttf;
54
55To output font reports in various formats::
56
57    pyfontaine --xml font.ttf;
58    pyfontaine --json font.ttf;
59    pyfontaine --csv font.ttf;
60    pyfontaine --wiki font.ttf;
61
62The `--wiki` format produces a MediaWiki table
63(`example <https://en.wikipedia.org/wiki/DejaVu_fonts#Unicode_coverage>`__)
64
65To only show character sets from different collections::
66
67    pyfontaine --collections all font.ttf; # default
68    pyfontaine --collections pyfontaine font.ttf;
69    pyfontaine --collections uniblocks font.ttf;
70    pyfontaine --collections extensis font.ttf;
71    pyfontaine --collections fontconfig font.ttf;
72    pyfontaine --collections cldr font.ttf;
73    pyfontaine --collections subsets font.ttf;
74
75To only show specific character sets::
76
77    pyfontaine --set africaan,adobe_latin_3 font.ttf;
78
79To print a list of all the missing unicode values from each set::
80
81    pyfontaine --missing --set adobe_latin_3 font.ttf;
82
83 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>`__!):
84
85    pyfontaine --show_hilbert font.ttf; ls -l coverage_pngs/;
86
87 The PNG files are stored in a new directory, ``coverage_pngs``, under the current directory.
88
89Update collection data
90~~~~~~~~~~~~~~~~~~~~~~
91
92You can update remote collections data when you are online::
93
94    pyfontaine --update-data 1;
95
96Python Module
97~~~~~~~~~~~~~
98
99It has a python module called ``fontaine``
100
101Making a release on PyPI
102~~~~~~~~~~~~~~~~~~~~~~~~
103
104To 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.
105
106Then set up a ``~/.pypirc`` file::
107
108    [distutils]
109    index-servers=pypi
110
111    [pypi]
112    repository = https://pypi.python.org/pypi
113
114		[server-login]
115    username = user
116    password = password
117
118Then run::
119
120    python setup.py build;
121    python setup.py sdist upload;
122
123Contributing
124------------
125
126Your contributions under `the GPLv3 <LICENSE.txt>`__ are welcome!
127
128pyfontaine is a python reimplementation of
129`Fontaine <http://fontaine.sf.net>`__ by Ed Trager, and has been made by
130`Vitaly Volkov <http://github.com/hash3g>`__,
131`Dave Crossland <http://github.com/davelab6>`__,
132`Mikhail Kashkin <http://github.com/xen>`__ and
133`Felipe Sanches <http://github.com/felipesanches>`__.
134
135Thanks
136------
137
138We would like to thank some upstream projects that make pyfontaine even
139more useful:
140
141* `Thomas Phinney <http://www.thomasphinney.com/>`__ for the `WebINK Character
142  Sets <http://web.archive.org/web/20150222004543/http://blog.webink.com/custom-font-subsetting-for-faster-websites/>`__
143
144* `Behdad Esfabod <http://behdad.org>`__ for the `font-config languages
145  definitions <http://cgit.freedesktop.org/fontconfig/tree/fc-lang>`__
146
147* Unicode Consortium for the `Unicode Blocks
148  <http://www.unicode.org/Public/UNIDATA/Blocks.txt>`__
149
150Dependencies
151------------
152
153- Mac OS X requires the XCode Command Line Tools to be installed
154- `fonttools <https://github.com/behdad/fonttools>`__ (common) *or*
155  `freetype-py <http://code.google.com/p/freetype-py>`__ (fast)
156- `lxml <http://pypi.python.org/pypi/lxml>`__
157- `PyICU <http://pyicu.osafoundation.org/>`__
158- `simpleHilbertCurve <https://github.com/dentearl/simpleHilbertCurve>`__
159- `matplotlib <https://pypi.python.org/pypi/matplotlib>`__
160- `tabulate <https://pypi.python.org/pypi/tabulate>`__
161- `requests <https://pypi.python.org/pypi/requests>`__
162
163Related Projects
164----------------
165
166-  `fontaine <http://fontaine.sf.net>`__
167-  `fontbakery <https://github.com/googlefonts/fontbakery>`__
168-  `libunicodenames <https://bitbucket.org/sortsmill/libunicodenames>`__
169
170
171.. |Latest PyPI Version| image:: https://img.shields.io/pypi/v/fontaine.svg?style=flat
172   :target: https://pypi.python.org/pypi/fontaine
173.. |Python| image:: https://img.shields.io/pypi/pyversions/fontaine.svg?style=flat
174   :target: https://pypi.python.org/pypi/fontaine
175.. |Travis Build Status| image:: https://travis-ci.org/googlefonts/pyfontaine.svg
176   :target: https://travis-ci.org/googlefonts/pyfontaine
177.. |License: GPL v3| image:: https://img.shields.io/badge/License-GPLv3-blue.svg
178   :target: https://www.gnu.org/licenses/gpl-3.0
179