• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1:orphan:
2
3Optional Dependencies
4=====================
5
6The fonttools PyPI distribution also supports so-called "extras", i.e. a
7set of keywords that describe a group of additional dependencies, which can be
8used when installing via pip, or when specifying a requirement.
9For example:
10
11.. code:: sh
12
13    pip install fonttools[ufo,lxml,woff,unicode]
14
15This command will install fonttools, as well as the optional dependencies that
16are required to unlock the extra features named "ufo", etc.
17
18.. note::
19
20    Optional dependencies are detailed by module in the list below with the ``Extra`` setting that automates ``pip`` dependency installation when this is supported.
21
22
23
24:py:mod:`fontTools.misc.etree`
25^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
26
27The module exports a ElementTree-like API for reading/writing XML files, and allows to use as the backend either the built-in ``xml.etree`` module or `lxml <https://lxml.de>`__. The latter is preferred whenever present, as it is generally faster and more secure.
28
29*Extra:* ``lxml``
30
31
32:py:mod:`fontTools.ufoLib`
33^^^^^^^^^^^^^^^^^^^^^^^^^^
34
35Package for reading and writing UFO source files; it requires:
36
37* `fs <https://pypi.org/pypi/fs>`__: (aka ``pyfilesystem2``) filesystem abstraction layer.
38
39* `enum34 <https://pypi.org/pypi/enum34>`__: backport for the built-in ``enum`` module (only required on Python < 3.4).
40
41*Extra:* ``ufo``
42
43
44:py:mod:`fontTools.ttLib.woff2`
45^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
46
47Module to compress/decompress WOFF 2.0 web fonts; it requires:
48
49* `brotli <https://pypi.python.org/pypi/Brotli>`__: Python bindings of the Brotli compression library.
50
51*Extra:* ``woff``
52
53
54:py:mod:`fontTools.unicode`
55^^^^^^^^^^^^^^^^^^^^^^^^^^^
56
57To display the Unicode character names when dumping the ``cmap`` table
58with ``ttx`` we use the ``unicodedata`` module in the Standard Library.
59The version included in there varies between different Python versions.
60To use the latest available data, you can install:
61
62* `unicodedata2 <https://pypi.python.org/pypi/unicodedata2>`__: ``unicodedata`` backport for Python
63  3.x updated to the latest Unicode version 14.0. Note this is not necessary if you use Python 3.11
64  as the latter already comes with an up-to-date ``unicodedata``.
65
66*Extra:* ``unicode``
67
68
69:py:mod:`fontTools.varLib.interpolatable`
70^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
71
72Module for finding wrong contour/component order between different masters.
73It requires one of the following packages in order to solve the so-called
74"minimum weight perfect matching problem in bipartite graphs", or
75the Assignment problem:
76
77* `scipy <https://pypi.python.org/pypi/scipy>`__: the Scientific Library for Python, which internally
78  uses `NumPy <https://pypi.python.org/pypi/numpy>`__ arrays and hence is very fast;
79* `munkres <https://pypi.python.org/pypi/munkres>`__: a pure-Python module that implements the Hungarian
80  or Kuhn-Munkres algorithm.
81
82*Extra:* ``interpolatable``
83
84
85:py:mod:`fontTools.varLib.plot`
86^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
87
88Module for visualizing DesignSpaceDocument and resulting VariationModel.
89
90* `matplotlib <https://pypi.org/pypi/matplotlib>`__: 2D plotting library.
91
92*Extra:* ``plot``
93
94
95:py:mod:`fontTools.misc.symfont`
96^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
97
98Advanced module for symbolic font statistics analysis; it requires:
99
100* `sympy <https://pypi.python.org/pypi/sympy>`__: the Python library for symbolic mathematics.
101
102*Extra:* ``symfont``
103
104
105:py:mod:`fontTools.t1Lib`
106^^^^^^^^^^^^^^^^^^^^^^^^^
107
108To get the file creator and type of Macintosh PostScript Type 1 fonts
109on Python 3 you need to install the following module, as the old ``MacOS``
110module is no longer included in Mac Python:
111
112* `xattr <https://pypi.python.org/pypi/xattr>`__: Python wrapper for extended filesystem attributes
113  (macOS platform only).
114
115*Extra:* ``type1``
116
117
118:py:mod:`fontTools.pens.cocoaPen`
119^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
120
121Pen for drawing glyphs with Cocoa ``NSBezierPath``, requires:
122
123* `PyObjC <https://pypi.python.org/pypi/pyobjc>`__: the bridge between Python and the Objective-C
124  runtime (macOS platform only).
125
126
127:py:mod:`fontTools.pens.qtPen`
128^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
129
130Pen for drawing glyphs with Qt's ``QPainterPath``, requires:
131
132* `PyQt5 <https://pypi.python.org/pypi/PyQt5>`__: Python bindings for the Qt cross platform UI and
133  application toolkit.
134
135
136:py:mod:`fontTools.pens.reportLabPen`
137^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
138
139Pen to drawing glyphs as PNG images, requires:
140
141* `reportlab <https://pypi.python.org/pypi/reportlab>`__: Python toolkit for generating PDFs and
142  graphics.
143