Feature Code
Edit the master's features.fea, or generate the mechanical parts from glyph names and anchors.
| Status | Implemented |
|---|---|
| Stability | Stable |
The Editor
The Features section in the grid view holds the active master’s
features.fea in a plain text editor. UFO keeps prefixes, classes,
and features in that one file, so that is what you edit.
| Apply | Writes the file, recompiles, and reports the verdict. Text in the editor reshapes with the new rules at once. |
|---|---|
| Generate | Rewrites the mechanical feature blocks from the font. See below. |
| Revert | Throws away your edits and reloads the file from disk. |
A file that does not compile is still saved. The previously compiled rules stay in force for shaping, so you can leave a broken feature file open and keep working while you fix it.
What Generate Writes
Generate reads your glyph names and anchors and writes the feature blocks that follow mechanically from them. It replaces those blocks and leaves everything else you wrote alone.
init, medi, fina | Positional substitutions, from glyphs named base.init and so on where base also exists. |
|---|---|
curs | Cursive attachment, from entry and exit anchors. A missing side becomes NULL. |
mark | Mark positioning, from each anchor family and the marks that attach to it. |
mkmk | Mark-to-mark positioning, reusing the classes the mark block defines. |
ccmp | Composition, from composite-only glyphs. |
liga | Ligatures from underscore-joined names, longest first, so f_f_i wins over f_f. |
table GDEF | Ligature caret positions, from caret_1, caret_2, and so on. |
Keeping Your Own Code
Generate never overwrites hand-written blocks with tags it does not
produce. To control where new blocks land, put a line reading
# Automatic Code in the file. Generated blocks are inserted above
that marker, so your own code can sit below it and stay put.
Review what Generate produced before pressing Apply. The status line names the tags it rewrote.
Compiling
Apply compiles the file against the active master’s glyph set, using the same build the text tool shapes with. That means a feature you just wrote is testable immediately: switch to the text tool, type the sequence, and look.
The compile verdict appears beside the buttons. When it fails, the message names the problem.
languagesystem statements must come before every feature block. It
is the most common reason a file that looks right refuses to
compile.
Testing Under a Language
Shaping can be run under a chosen script and language rather than
letting the engine infer them. Use it to check that a locl rule
fires for the language it was written for. See
Text and Shaping.