| 1 |
############################################# |
| 2 |
feaLib: Read and write OpenType feature files |
| 3 |
############################################# |
| 4 |
|
| 5 |
.. currentmodule:: fontTools.feaLib |
| 6 |
|
| 7 |
.. contents:: On this page: |
| 8 |
:local: |
| 9 |
|
| 10 |
|
| 11 |
.. rubric:: Overview |
| 12 |
:heading-level: 2 |
| 13 |
|
| 14 |
fontTools' :mod:`.feaLib` allows for the creation and parsing of Adobe |
| 15 |
Font Development Kit for OpenType feature (``.fea``) files. The syntax |
| 16 |
of these files is described `here <https://adobe-type-tools.github.io/afdko/OpenTypeFeatureFileSpecification.html>`_. |
| 17 |
|
| 18 |
``.fea`` files are primarily used for writing human-readable |
| 19 |
definitions for the OpenType features stored in a font's ``GSUB`` and |
| 20 |
``GPOS`` tables. |
| 21 |
|
| 22 |
Supporting modules |
| 23 |
------------------ |
| 24 |
|
| 25 |
feaLib contains modules for parsing and inspecting ``.fea`` files |
| 26 |
as well as utilities for converting ``.fea`` rules into ``GSUB`` and |
| 27 |
``GPOS`` tables and inserting them into fonts. |
| 28 |
|
| 29 |
.. toctree:: |
| 30 |
:maxdepth: 1 |
| 31 |
|
| 32 |
parser |
| 33 |
ast |
| 34 |
|
| 35 |
The :class:`fontTools.feaLib.parser.Parser` class can be used to parse files |
| 36 |
into an abstract syntax tree, and from there the |
| 37 |
:class:`fontTools.feaLib.builder.Builder` class can add features to an existing |
| 38 |
font file. You can inspect the parsed syntax tree, walk the tree and do clever |
| 39 |
things with it, and also generate your own feature files programmatically, by |
| 40 |
using the classes in the :mod:`fontTools.feaLib.ast` module. |
| 41 |
|
| 42 |
|
| 43 |
|
| 44 |
fontTools.feaLib.builder |
| 45 |
------------------------ |
| 46 |
|
| 47 |
.. currentmodule:: fontTools.feaLib.builder |
| 48 |
|
| 49 |
.. automodule:: fontTools.feaLib.builder |
| 50 |
:members: addOpenTypeFeatures, addOpenTypeFeaturesFromString, Builder |
| 51 |
:undoc-members: |
| 52 |
|
| 53 |
|
| 54 |
fontTools.feaLib.lookupDebugInfo |
| 55 |
-------------------------------- |
| 56 |
|
| 57 |
.. currentmodule:: fontTools.feaLib.lookupDebugInfo |
| 58 |
|
| 59 |
.. automodule:: fontTools.feaLib.lookupDebugInfo |
| 60 |
:members: |
| 61 |
:undoc-members: |
| 62 |
|
| 63 |
|
| 64 |
fontTools.feaLib.error |
| 65 |
---------------------- |
| 66 |
|
| 67 |
.. currentmodule:: fontTools.feaLib.error |
| 68 |
|
| 69 |
.. automodule:: fontTools.feaLib.error |
| 70 |
:members: |
| 71 |
:undoc-members: |