2018-10-20 23:08:24 -04:00
.. image :: ../../Icons/FontToolsIconGreenCircle.png
:width: 200px
:height: 200px
:alt: Font Tools
:align: center
2018-10-22 19:24:59 -04:00
2017-04-21 19:47:28 -03:00
fontTools Docs
==============
2018-10-11 11:46:36 -04:00
About
-----
2020-05-03 21:06:56 +01:00
fontTools is a family of libraries and utilities for manipulating fonts in Python.
2018-10-11 11:46:36 -04:00
2020-05-03 21:06:56 +01:00
The project has an `MIT open-source license <https://github.com/fonttools/fonttools/blob/master/LICENSE> `_ . Among other things this means you can use it free of charge.
2018-10-11 11:46:36 -04:00
Installation
------------
2020-04-20 16:35:51 -04:00
.. note ::
fontTools requires `Python <http://www.python.org/download/> `_ 3.6 or later.
2018-10-11 11:46:36 -04:00
The package is listed in the Python Package Index (PyPI), so you can install it with `pip <https://pip.pypa.io/> `_ ::
pip install fonttools
See the Optional Requirements section below for details about module-specific dependencies that must be installed in select cases.
2020-05-03 21:06:56 +01:00
Utilities
---------
2018-10-11 11:46:36 -04:00
2020-05-03 22:04:55 +01:00
fontTools installs four command-line utilities:
2018-10-11 11:46:36 -04:00
2020-05-03 22:04:55 +01:00
- `` pyftmerge `` , a tool for merging fonts; see :py:mod: `fontTools.merge`
- `` pyftsubset `` , a tool for subsetting fonts; see :py:mod: `fontTools.subset`
- `` ttx `` , a tool for converting between OpenType binary fonts (OTF) and an XML representation (TTX); see :py:mod: `fontTools.ttx`
- `` fonttools `` , a "meta-tool" for accessing other components of the fontTools family.
2018-10-11 11:46:36 -04:00
2020-05-03 22:04:55 +01:00
This last utility takes a subcommand, which could be one of:
2020-05-07 14:55:55 +01:00
- `` cffLib.width `` : Calculate optimum defaultWidthX/nominalWidthX values
- `` cu2qu `` : Convert a UFO font from cubic to quadratic curves
2020-05-03 22:04:55 +01:00
- `` feaLib `` : Add features from a feature file (.fea) into a OTF font
2020-05-07 14:55:55 +01:00
- `` help `` : Show this help
- `` merge `` : Merge multiple fonts into one
- `` mtiLib `` : Convert a FontDame OTL file to TTX XML
2020-05-03 22:04:55 +01:00
- `` subset `` : OpenType font subsetter and optimizer
2020-05-07 14:55:55 +01:00
- `` ttLib.woff2 `` : Compress and decompress WOFF2 fonts
- `` ttx `` : Convert OpenType fonts to XML and back
2020-05-03 22:04:55 +01:00
- `` varLib `` : Build a variable font from a designspace file and masters
2020-05-07 14:55:55 +01:00
- `` varLib.instancer `` : Partially instantiate a variable font.
- `` varLib.interpolatable `` : Test for interpolatability issues between fonts
- `` varLib.interpolate_layout `` : Interpolate GDEF/GPOS/GSUB tables for a point on a designspace
- `` varLib.models `` : Normalize locations on a given designspace
- `` varLib.mutator `` : Instantiate a variation font
- `` varLib.varStore `` : Optimize a font's GDEF variation store
2018-10-11 11:46:36 -04:00
2020-05-03 21:06:56 +01:00
Libraries
---------
2018-10-11 11:46:36 -04:00
2020-05-03 22:04:55 +01:00
The main library you will want to access when using fontTools for font
2021-11-18 13:06:02 +00:00
engineering is likely to be :py:mod: `fontTools.ttLib.ttFont` , which is the module
2020-05-03 22:04:55 +01:00
for handling TrueType/OpenType fonts. However, there are many other
libraries in the fontTools suite:
- :py:mod: `fontTools.afmLib` : Module for reading and writing AFM files
- :py:mod: `fontTools.agl` : Access to the Adobe Glyph List
- :py:mod: `fontTools.cffLib` : Read/write tools for Adobe CFF fonts
- :py:mod: `fontTools.colorLib` : Module for handling colors in CPAL/COLR fonts
- :py:mod: `fontTools.cu2qu` : Module for cubic to quadratic conversion
- :py:mod: `fontTools.designspaceLib` : Read and write designspace files
- :py:mod: `fontTools.encodings` : Support for font-related character encodings
- :py:mod: `fontTools.feaLib` : Read and read AFDKO feature files
- :py:mod: `fontTools.fontBuilder` : Construct TTF/OTF fonts from scratch
- :py:mod: `fontTools.merge` : Tools for merging font files
- :py:mod: `fontTools.pens` : Various classes for manipulating glyph outlines
- :py:mod: `fontTools.subset` : OpenType font subsetting and optimization
- :py:mod: `fontTools.svgLib.path` : Library for drawing SVG paths onto glyphs
- :py:mod: `fontTools.t1Lib` : Tools for PostScript Type 1 fonts (Python2 only)
2021-07-05 16:08:04 +02:00
- :py:mod: `fontTools.tfmLib` : Module for reading TFM files
2021-11-18 13:06:02 +00:00
- :py:mod: `fontTools.ttLib` : Module for reading/writing OpenType and Truetype fonts
2020-05-03 22:04:55 +01:00
- :py:mod: `fontTools.ttx` : Module for converting between OTF and XML representation
- :py:mod: `fontTools.ufoLib` : Module for reading and writing UFO files
- :py:mod: `fontTools.unicodedata` : Convert between Unicode and OpenType script information
- :py:mod: `fontTools.varLib` : Module for dealing with 'gvar'-style font variations
- :py:mod: `fontTools.voltLib` : Module for dealing with Visual OpenType Layout Tool (VOLT) files
2018-10-11 11:46:36 -04:00
2020-05-03 21:06:56 +01:00
A selection of sample Python programs using these libaries can be found in the `Snippets directory <https://github.com/fonttools/fonttools/blob/master/Snippets/> `_ of the fontTools repository.
2018-10-11 11:46:36 -04:00
2020-05-03 22:04:55 +01:00
Optional Dependencies
2018-10-11 11:46:36 -04:00
---------------------
2020-04-22 00:08:23 -04:00
The fontTools package currently has no (required) external dependencies
besides the modules included in the Python Standard Library.
However, a few extra dependencies are required to unlock optional features
2020-05-03 22:04:55 +01:00
in some of the library modules. See the :doc: `optional requirements <./optional>`
page for more information.
2018-10-11 11:46:36 -04:00
2020-05-03 21:06:56 +01:00
Developer information
2018-10-11 11:46:36 -04:00
---------------------
2020-05-03 21:06:56 +01:00
Information for developers can be found :doc: `here <./developer>` .
2018-10-11 11:46:36 -04:00
License
-------
`MIT license <https://github.com/fonttools/fonttools/blob/master/LICENSE> `_ . See the full text of the license for details.
Table of Contents
-----------------
2017-04-21 19:47:28 -03:00
.. toctree ::
2018-10-10 22:34:52 -04:00
:maxdepth: 2
2018-10-20 23:17:37 -04:00
:caption: Library
2017-04-21 19:47:28 -03:00
afmLib
agl
2018-10-10 15:57:36 -04:00
cffLib/index
2020-04-20 17:36:25 -04:00
colorLib/index
2020-04-20 17:43:06 -04:00
cu2qu/index
2017-11-29 12:03:34 +00:00
designspaceLib/index
2018-10-10 18:03:29 -04:00
encodings/index
2018-10-10 18:24:35 -04:00
feaLib/index
2017-04-21 19:47:28 -03:00
merge
misc/index
2018-10-10 22:34:52 -04:00
mtiLib
otlLib/index
2017-04-21 19:47:28 -03:00
pens/index
2020-04-20 17:52:35 -04:00
subset/index
2018-10-10 22:34:52 -04:00
svgLib/index
2017-04-21 19:47:28 -03:00
t1Lib
2021-07-05 16:08:04 +02:00
tfmLib
2017-04-21 19:47:28 -03:00
ttLib/index
ttx
2018-10-19 20:58:57 -04:00
ufoLib/index
2018-10-10 22:34:52 -04:00
unicode
unicodedata/index
2017-04-21 19:47:28 -03:00
varLib/index
voltLib
2018-10-22 19:24:59 -04:00
.. |Travis Build Status| image :: https://travis-ci.org/fonttools/fonttools.svg
:target: https://travis-ci.org/fonttools/fonttools
.. |Appveyor Build status| image :: https://ci.appveyor.com/api/projects/status/0f7fmee9as744sl7/branch/master?svg=true
:target: https://ci.appveyor.com/project/fonttools/fonttools/branch/master
.. |Coverage Status| image :: https://codecov.io/gh/fonttools/fonttools/branch/master/graph/badge.svg
:target: https://codecov.io/gh/fonttools/fonttools
.. |PyPI| image :: https://img.shields.io/pypi/v/fonttools.svg
:target: https://pypi.org/project/FontTools
.. |Gitter Chat| image :: https://badges.gitter.im/fonttools-dev/Lobby.svg
:alt: Join the chat at https://gitter.im/fonttools-dev/Lobby
:target: https://gitter.im/fonttools-dev/Lobby?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge