| 1 |
.. image:: ../../Icons/FontToolsIconGreenCircle.png |
| 2 |
:width: 200px |
| 3 |
:height: 200px |
| 4 |
:alt: Font Tools |
| 5 |
:align: center |
| 6 |
|
| 7 |
|
| 8 |
---fontTools Documentation--- |
| 9 |
============================= |
| 10 |
About |
| 11 |
----- |
| 12 |
|
| 13 |
fontTools is a family of libraries and utilities for manipulating fonts in Python. |
| 14 |
|
| 15 |
The project is licensed under the `MIT open-source license <https://github.com/fonttools/fonttools/blob/main/LICENSE>`_, allowing free usage. |
| 16 |
|
| 17 |
Installation |
| 18 |
------------ |
| 19 |
|
| 20 |
.. note:: |
| 21 |
|
| 22 |
fontTools requires `Python <http://www.python.org/download/>`_ 3.9 or later. |
| 23 |
|
| 24 |
To install fontTools, use `pip <https://pip.pypa.io/>`_: |
| 25 |
|
| 26 |
|
| 27 |
pip install fonttools |
| 28 |
|
| 29 |
Utilities |
| 30 |
--------- |
| 31 |
|
| 32 |
fontTools includes the following command-line utilities: |
| 33 |
|
| 34 |
- ``pyftmerge``: Tool for merging fonts; see :py:mod:`fontTools.merge` |
| 35 |
- ``pyftsubset``: Tool for subsetting fonts; see :py:mod:`fontTools.subset` |
| 36 |
- ``ttx``: Tool for converting between OTF and XML representation; see :py:mod:`fontTools.ttx` |
| 37 |
- ``fonttools``: Meta-tool for accessing other fontTools components. |
| 38 |
|
| 39 |
For ``fonttools``, you can use subcommands like: |
| 40 |
|
| 41 |
- ``cffLib.width``: Calculate optimum defaultWidthX/nominalWidthX values |
| 42 |
- ``cu2qu``: Convert a UFO font from cubic to quadratic curves |
| 43 |
- ``feaLib``: Add features from a feature file (.fea) into a OTF font |
| 44 |
- ``merge``: Merge multiple fonts into one |
| 45 |
- ``subset``: OpenType font subsetter and optimizer |
| 46 |
- ``ttx``: Convert OpenType fonts to XML and back |
| 47 |
- ``varLib``: Build a variable font from a designspace file and masters |
| 48 |
- ``varLib.instancer``: Partially instantiate a variable font |
| 49 |
- ``voltLib.voltToFea``: Convert MS VOLT to AFDKO feature files. |
| 50 |
|
| 51 |
Libraries |
| 52 |
--------- |
| 53 |
|
| 54 |
The main library for font engineering is :py:mod:`fontTools.ttLib.ttFont`, which handles TrueType/OpenType fonts. Other libraries include: |
| 55 |
|
| 56 |
- :py:mod:`fontTools.afmLib`: Read and write AFM files |
| 57 |
- :py:mod:`fontTools.agl`: Access the Adobe Glyph List |
| 58 |
- :py:mod:`fontTools.cffLib`: Tools for Adobe CFF fonts |
| 59 |
- :py:mod:`fontTools.colorLib`: Handle colors in CPAL/COLR fonts |
| 60 |
- :py:mod:`fontTools.cu2qu`: Convert cubic to quadratic curves |
| 61 |
- :py:mod:`fontTools.designspaceLib`: Read and write designspace files |
| 62 |
- :py:mod:`fontTools.encodings`: Support for font-related encodings |
| 63 |
- :py:mod:`fontTools.feaLib`: Read and write AFDKO feature files |
| 64 |
- :py:mod:`fontTools.fontBuilder`: Construct TTF/OTF fonts from scratch |
| 65 |
- :py:mod:`fontTools.merge`: Tools for merging font files |
| 66 |
- :py:mod:`fontTools.subset`: OpenType font subsetting and optimization |
| 67 |
- :py:mod:`fontTools.svgLib.path`: Draw SVG paths onto glyphs |
| 68 |
- :py:mod:`fontTools.ttLib`: Read/write OpenType and TrueType fonts |
| 69 |
- :py:mod:`fontTools.ttx`: Convert between OTF and XML representation |
| 70 |
- :py:mod:`fontTools.ufoLib`: Read and write UFO files |
| 71 |
- :py:mod:`fontTools.unicodedata`: Convert between Unicode and OpenType script info |
| 72 |
- :py:mod:`fontTools.varLib`: Deal with 'gvar'-style font variations |
| 73 |
- :py:mod:`fontTools.voltLib`: Deal with Visual OpenType Layout Tool (VOLT) files |
| 74 |
|
| 75 |
Optional Dependencies |
| 76 |
--------------------- |
| 77 |
|
| 78 |
fontTools has no external dependencies besides the Python Standard Library. Some optional features require additional modules; see the :doc:`optional requirements </optional>` page for details. |
| 79 |
|
| 80 |
Developer Information |
| 81 |
--------------------- |
| 82 |
|
| 83 |
For developer resources, refer to the :doc:`developer information </developer>`. |
| 84 |
|
| 85 |
License |
| 86 |
------- |
| 87 |
|
| 88 |
fontTools is licensed under the `MIT license <https://github.com/fonttools/fonttools/blob/main/LICENSE>`_. Refer to the full text of the license for details. |
| 89 |
|
| 90 |
|
| 91 |
.. toctree:: |
| 92 |
:maxdepth: 1 |
| 93 |
:hidden: |
| 94 |
|
| 95 |
afmLib |
| 96 |
agl |
| 97 |
cffLib/index |
| 98 |
colorLib/index |
| 99 |
config |
| 100 |
cu2qu/index |
| 101 |
designspaceLib/index |
| 102 |
encodings/index |
| 103 |
feaLib/index |
| 104 |
merge |
| 105 |
misc/index |
| 106 |
mtiLib |
| 107 |
otlLib/index |
| 108 |
pens/index |
| 109 |
qu2cu/index |
| 110 |
subset/index |
| 111 |
svgLib/index |
| 112 |
t1Lib |
| 113 |
tfmLib |
| 114 |
ttLib/index |
| 115 |
ttx |
| 116 |
ufoLib/index |
| 117 |
unicodedata/index |
| 118 |
varLib/index |
| 119 |
voltLib/index |
| 120 |
|
| 121 |
.. |Travis Build Status| image:: https://travis-ci.org/fonttools/fonttools.svg |
| 122 |
:target: https://travis-ci.org/fonttools/fonttools |
| 123 |
.. |Appveyor Build status| image:: https://ci.appveyor.com/api/projects/status/0f7fmee9as744sl7/branch/master?svg=true |
| 124 |
:target: https://ci.appveyor.com/project/fonttools/fonttools/branch/master |
| 125 |
.. |Coverage Status| image:: https://codecov.io/gh/fonttools/fonttools/branch/main/graph/badge.svg |
| 126 |
:target: https://codecov.io/gh/fonttools/fonttools |
| 127 |
.. |PyPI| image:: https://img.shields.io/pypi/v/fonttools.svg |
| 128 |
:target: https://pypi.org/project/FontTools |
| 129 |
.. |Gitter Chat| image:: https://badges.gitter.im/fonttools-dev/Lobby.svg |
| 130 |
:alt: Join the chat at https://gitter.im/fonttools-dev/Lobby |
| 131 |
:target: https://gitter.im/fonttools-dev/Lobby?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge |