Debian Codegraph @

Doc/source/optional.rst

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