| 1 |
#################################################### |
| 2 |
ast: Interrogate and generate OpenType feature files |
| 3 |
#################################################### |
| 4 |
|
| 5 |
.. currentmodule:: fontTools.feaLib.astt |
| 6 |
|
| 7 |
.. rubric:: Overview: |
| 8 |
:heading-level: 2 |
| 9 |
|
| 10 |
feaLib's :mod:`.ast` module provides classes that represent the objects |
| 11 |
and structures used to define OpenType feature lookups in the ``fea`` |
| 12 |
syntax. After your code has parsed a ``.fea`` file into an abstract |
| 13 |
syntax tree (AST), you can use these classes to modify existing |
| 14 |
lookups or create new lookups and features. |
| 15 |
|
| 16 |
The root of the AST representation of a parsed ``.fea`` file is a |
| 17 |
:class:`fontTools.feaLib.ast.FeatureFile` object. You can walk the |
| 18 |
tree by examining its :attr:`statements` attribute. Nodes in the |
| 19 |
tree have an :meth:`asFea` method that will return a ``.fea`` |
| 20 |
formated string representation, including correct indentation of block elements. |
| 21 |
|
| 22 |
|
| 23 |
.. _`glyph-containing object`: |
| 24 |
.. _`glyph-containing objects`: |
| 25 |
|
| 26 |
In the below, a **glyph-containing object** is an object of one of the following |
| 27 |
classes: :class:`GlyphName`, :class:`GlyphClass`, :class:`GlyphClassName`. |
| 28 |
|
| 29 |
.. automodule:: fontTools.feaLib.ast |
| 30 |
:members: |
| 31 |
:undoc-members: |
| 32 |
|
| 33 |
.. rubric:: Module members |
| 34 |
:heading-level: 2 |
| 35 |
|
| 36 |
|
| 37 |
|