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