xref: /aosp_15_r20/external/fonttools/Doc/source/index.rst (revision e1fe3e4ad2793916b15cccdc4a7da52a7e1dd0e9)
1.. image:: ../../Icons/FontToolsIconGreenCircle.png
2   :width: 200px
3   :height: 200px
4   :alt: Font Tools
5   :align: center
6
7
8fontTools Docs
9==============
10
11About
12-----
13
14fontTools is a family of libraries and utilities for manipulating fonts in Python.
15
16The project has an `MIT open-source license <https://github.com/fonttools/fonttools/blob/main/LICENSE>`_. Among other things this means you can use it free of charge.
17
18Installation
19------------
20
21.. note::
22
23    fontTools requires `Python <http://www.python.org/download/>`_ 3.8 or later.
24
25The package is listed in the Python Package Index (PyPI), so you can install it with `pip <https://pip.pypa.io/>`_::
26
27    pip install fonttools
28
29See the Optional Requirements section below for details about module-specific dependencies that must be installed in select cases.
30
31Utilities
32---------
33
34fontTools installs four command-line utilities:
35
36- ``pyftmerge``, a tool for merging fonts; see :py:mod:`fontTools.merge`
37- ``pyftsubset``, a tool for subsetting fonts; see :py:mod:`fontTools.subset`
38- ``ttx``, a tool for converting between OpenType binary fonts (OTF) and an XML representation (TTX); see :py:mod:`fontTools.ttx`
39- ``fonttools``, a "meta-tool" for accessing other components of the fontTools family.
40
41This last utility takes a subcommand, which could be one of:
42
43- ``cffLib.width``: Calculate optimum defaultWidthX/nominalWidthX values
44- ``cu2qu``: Convert a UFO font from cubic to quadratic curves
45- ``feaLib``: Add features from a feature file (.fea) into a OTF font
46- ``help``: Show this help
47- ``merge``: Merge multiple fonts into one
48- ``mtiLib``: Convert a FontDame OTL file to TTX XML
49- ``subset``: OpenType font subsetter and optimizer
50- ``ttLib.woff2``: Compress and decompress WOFF2 fonts
51- ``ttx``: Convert OpenType fonts to XML and back
52- ``varLib``: Build a variable font from a designspace file and masters
53- ``varLib.instancer``: Partially instantiate a variable font.
54- ``varLib.interpolatable``: Test for interpolatability issues between fonts
55- ``varLib.interpolate_layout``: Interpolate GDEF/GPOS/GSUB tables for a point on a designspace
56- ``varLib.models``: Normalize locations on a given designspace
57- ``varLib.mutator``: Instantiate a variation font
58- ``varLib.varStore``: Optimize a font's GDEF variation store
59- ``voltLib.voltToFea``: Convert MS VOLT to AFDKO feature files.
60
61Libraries
62---------
63
64The main library you will want to access when using fontTools for font
65engineering is likely to be :py:mod:`fontTools.ttLib.ttFont`, which is the module
66for handling TrueType/OpenType fonts. However, there are many other
67libraries in the fontTools suite:
68
69- :py:mod:`fontTools.afmLib`: Module for reading and writing AFM files
70- :py:mod:`fontTools.agl`: Access to the Adobe Glyph List
71- :py:mod:`fontTools.cffLib`: Read/write tools for Adobe CFF fonts
72- :py:mod:`fontTools.colorLib`: Module for handling colors in CPAL/COLR fonts
73- :py:mod:`fontTools.config`: Configure fontTools
74- :py:mod:`fontTools.cu2qu`: Module for cubic to quadratic conversion
75- :py:mod:`fontTools.designspaceLib`: Read and write designspace files
76- :py:mod:`fontTools.encodings`: Support for font-related character encodings
77- :py:mod:`fontTools.feaLib`: Read and read AFDKO feature files
78- :py:mod:`fontTools.fontBuilder`: Construct TTF/OTF fonts from scratch
79- :py:mod:`fontTools.merge`: Tools for merging font files
80- :py:mod:`fontTools.pens`: Various classes for manipulating glyph outlines
81- :py:mod:`fontTools.subset`: OpenType font subsetting and optimization
82- :py:mod:`fontTools.svgLib.path`: Library for drawing SVG paths onto glyphs
83- :py:mod:`fontTools.t1Lib`: Tools for PostScript Type 1 fonts (Python2 only)
84- :py:mod:`fontTools.tfmLib`: Module for reading TFM files
85- :py:mod:`fontTools.ttLib`: Module for reading/writing OpenType and Truetype fonts
86- :py:mod:`fontTools.ttx`: Module for converting between OTF and XML representation
87- :py:mod:`fontTools.ufoLib`: Module for reading and writing UFO files
88- :py:mod:`fontTools.unicodedata`: Convert between Unicode and OpenType script information
89- :py:mod:`fontTools.varLib`: Module for dealing with 'gvar'-style font variations
90- :py:mod:`fontTools.voltLib`: Module for dealing with Visual OpenType Layout Tool (VOLT) files
91
92A selection of sample Python programs using these libaries can be found in the `Snippets directory <https://github.com/fonttools/fonttools/blob/main/Snippets/>`_ of the fontTools repository.
93
94Optional Dependencies
95---------------------
96
97The fontTools package currently has no (required) external dependencies
98besides the modules included in the Python Standard Library.
99However, a few extra dependencies are required to unlock optional features
100in some of the library modules. See the :doc:`optional requirements <./optional>`
101page for more information.
102
103Developer information
104---------------------
105
106Information for developers can be found :doc:`here <./developer>`.
107
108License
109-------
110
111`MIT license <https://github.com/fonttools/fonttools/blob/main/LICENSE>`_.  See the full text of the license for details.
112
113
114Table of Contents
115-----------------
116
117.. toctree::
118   :maxdepth: 2
119   :caption: Library
120
121   afmLib
122   agl
123   cffLib/index
124   colorLib/index
125   config
126   cu2qu/index
127   designspaceLib/index
128   encodings/index
129   feaLib/index
130   merge
131   misc/index
132   mtiLib
133   otlLib/index
134   pens/index
135   subset/index
136   svgLib/index
137   t1Lib
138   tfmLib
139   ttLib/index
140   ttx
141   ufoLib/index
142   unicode
143   unicodedata/index
144   varLib/index
145   voltLib/index
146
147
148.. |Travis Build Status| image:: https://travis-ci.org/fonttools/fonttools.svg
149   :target: https://travis-ci.org/fonttools/fonttools
150.. |Appveyor Build status| image:: https://ci.appveyor.com/api/projects/status/0f7fmee9as744sl7/branch/master?svg=true
151   :target: https://ci.appveyor.com/project/fonttools/fonttools/branch/master
152.. |Coverage Status| image:: https://codecov.io/gh/fonttools/fonttools/branch/main/graph/badge.svg
153   :target: https://codecov.io/gh/fonttools/fonttools
154.. |PyPI| image:: https://img.shields.io/pypi/v/fonttools.svg
155   :target: https://pypi.org/project/FontTools
156.. |Gitter Chat| image:: https://badges.gitter.im/fonttools-dev/Lobby.svg
157   :alt: Join the chat at https://gitter.im/fonttools-dev/Lobby
158   :target: https://gitter.im/fonttools-dev/Lobby?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge
159