2024-09-16 12:48:15 +01:00
|
|
|
#################################################
|
|
|
|
ttLib: Read and write OpenType and TrueType fonts
|
|
|
|
#################################################
|
2021-11-18 13:06:02 +00:00
|
|
|
|
2024-12-06 14:04:27 +00:00
|
|
|
.. contents:: On this page:
|
|
|
|
:local:
|
|
|
|
|
|
|
|
.. rubric:: Overview:
|
|
|
|
:heading-level: 2
|
|
|
|
|
|
|
|
Most users of the :mod:`fontTools` library will be using it to generate or manipulate
|
2021-11-18 13:06:02 +00:00
|
|
|
OpenType and TrueType fonts. (FontTools initially only supported TrueType fonts,
|
|
|
|
gaining OpenType support in version 2.0, and so uses the ``tt`` prefix to refer to
|
|
|
|
both kinds of font. Because of this we will refer to both as "TrueType fonts"
|
|
|
|
unless we need to make a distinction.)
|
|
|
|
|
|
|
|
The main entry point for such operations is the :py:mod:`fontTools.ttLib.ttFont`
|
|
|
|
module, but other modules also provide useful functionality for handling OpenType
|
2024-12-07 17:00:01 +00:00
|
|
|
fonts:
|
2017-04-21 19:47:28 -03:00
|
|
|
|
|
|
|
.. toctree::
|
2024-12-07 17:00:01 +00:00
|
|
|
:maxdepth: 1
|
2017-04-21 19:47:28 -03:00
|
|
|
|
2021-11-18 13:06:02 +00:00
|
|
|
ttFont
|
2024-12-06 14:04:27 +00:00
|
|
|
|
|
|
|
:mod:`.ttLib` supports fonts with TrueType-flavored glyphs (i.e., with
|
|
|
|
a ``glyf`` table), with PostScript-flavored glyphs (i.e., ``CFF`` or
|
|
|
|
``CFF2`` tables), and with all of the glyph formats used for color fonts
|
|
|
|
(``CBDT``, ``COLR``, ``sbix``, and ``SVG``). Static and variable fonts
|
|
|
|
are both supported.
|
|
|
|
|
|
|
|
|
|
|
|
Command-line utilities
|
|
|
|
----------------------
|
|
|
|
|
|
|
|
:mod:`.ttLib` includes two modules that provide command-line operations:
|
|
|
|
|
|
|
|
.. toctree::
|
|
|
|
:maxdepth: 1
|
|
|
|
|
|
|
|
removeOverlaps
|
|
|
|
scaleUpem
|
|
|
|
|
|
|
|
|
|
|
|
Supporting modules
|
|
|
|
------------------
|
|
|
|
|
|
|
|
It also contains helper modules that enable lower-level
|
|
|
|
functionality. In most cases, users will not need to access these
|
|
|
|
modules directly:
|
|
|
|
|
|
|
|
.. toctree::
|
|
|
|
:maxdepth: 1
|
|
|
|
|
2021-11-18 13:06:02 +00:00
|
|
|
ttCollection
|
2024-12-06 14:04:27 +00:00
|
|
|
ttGlyphSet
|
2017-04-21 19:47:28 -03:00
|
|
|
macUtils
|
2024-12-06 14:04:27 +00:00
|
|
|
reorderGlyphs
|
2017-04-21 19:47:28 -03:00
|
|
|
sfnt
|
2018-10-10 15:43:58 -04:00
|
|
|
standardGlyphOrder
|
2017-04-21 19:47:28 -03:00
|
|
|
tables
|
|
|
|
woff2
|