You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
These tools are used to write feature files which is be based on information found within UFO sources.
7
-
The two main tools are `kernFeatureWriter.py` and `markFeatureWriter.py`.
6
+
## `kernFeatureWriter.py`
7
+
This tool exports the kerning and groups data within a UFO to a
8
+
`makeotf`-compatible GPOS kern feature file.
8
9
9
-
###`kernFeatureWriter.py`
10
+
#### Default functionality:
10
11
11
-
```bash
12
+
- writing of a sorted kern.fea file, which organizes pairs in order of
13
+
specificity (exceptions first, then glyph-to-glyph, then group pairs)
14
+
- filtering of small pairs (often results of interpolation).
15
+
Exceptions (even though they may be small) are not filtered.
16
+
- processing of right-to-left pairs (given that kerning groups containing
17
+
those glyphs are suffixed with `_ARA`, `_HEB`, or `_RTL`)
12
18
13
-
# write out a kern feature file
19
+
#### Optional functionality:
20
+
21
+
- dissolving single-element groups into glyph pairs – this helps with
22
+
subtable optimization, and can be seen as a means to avoid kerning overflow
23
+
- subtable measuring and automatic insertion of subtable breaks
24
+
- specifying a maximum subtable size
25
+
- identification of glyph-to-glyph RTL pairs by way of a global `RTL_KERNING`
26
+
reference group
27
+
- specifying a glyph name suffix for glyphs to be ignored when writing the
28
+
kern feature
29
+
30
+
#### Usage:
31
+
```zsh
32
+
33
+
# write a basic kern feature file
14
34
python kernFeatureWriter.py font.ufo
15
35
16
36
# write a kern feature file with minimum absolute kerning value of 5
@@ -19,21 +39,75 @@ The two main tools are `kernFeatureWriter.py` and `markFeatureWriter.py`.
19
39
# write a kern feature with subtable breaks
20
40
python kernFeatureWriter.py -s font.ufo
21
41
42
+
# further usage information
43
+
python kernFeatureWriter.py -h
44
+
22
45
```
23
46
24
-
### `markFeatureWriter.py`
47
+
----
25
48
26
-
```bash
49
+
## `markFeatureWriter.py`
50
+
This tool interprets glyphs and anchor points within a UFO to write a
51
+
`makeotf`-compatible GPOS mark feature file.
52
+
53
+
The input UFO file needs to have base glyphs and zero-width combining
54
+
marks. Base- and mark glyphs attach via anchor pairs (e.g. `above` and
55
+
`_above`, or `top`, and `_top`).
56
+
Combining marks must be members of a `COMBINING_MARKS` reference group.
57
+
58
+
#### Default functionality:
59
+
60
+
- writing a `mark.fea` file, which contains mark classes/groups, and
61
+
per-anchor mark-to-base positioning lookups (GPOS lookup type 4)
62
+
- writing mark-to-ligature positioning lookups (GPOS lookup type 5).
63
+
This requires anchor names to be suffixed with an ordinal (`1ST`, `2ND`,
64
+
`3RD`, etc). For example – if a mark with an `_above` anchor is to be
65
+
attached to a ligature, the ligature’s anchor names would be `above1ST`,
66
+
`above2ND`, etc – depending on the amount of ligature elements.
67
+
68
+
#### Optional functionality:
69
+
70
+
- writing `mkmk.fea`, for mark-to-mark positioning (GPOS lookup type 6)
71
+
- writing `abvm.fea`/`blwm.fea` files, as used in Indic scripts (anchor pairs
72
+
are `abvm`, `_abvm`, and `blwm`, `_blwm`, respectively)
73
+
- writing mark classes into a separate file (in case classes need to be
74
+
shared across multiple lookup types)
75
+
- trimming casing tags (`UC`, `LC`, or `SC`)
76
+
77
+
Trimming tags is a somewhat specific feature, but it is quite essential:
78
+
In a UFO, anchors can be used to build composite glyphs – for example
79
+
`aacute`, and `Aacute`. Since those glyphs would often receive a
80
+
differently-shaped accent, the anchor pairs (on bases `a`/`A` and
81
+
marks `acutecmb`/`acutecmb.cap`) would be `aboveLC`/`_aboveLC`, and
82
+
`aboveUC/_aboveUC`, respectively.
83
+
84
+
When writing the mark feature, we care more about which group of combining
85
+
marks triggers a certain behavior, so removing those casing tags allows
86
+
grouping all `_above` marks together, hence attaching to a base glyph –
87
+
no matter if it is upper- or lowercase. The aesthetic substitution of the
88
+
mark (e.g. smaller mark on the uppercase letter) can happen later, in the
89
+
`ccmp` feature.
90
+
91
+
#### Usage:
92
+
```zsh
27
93
28
94
# write a basic mark feature
29
95
python markFeatureWriter.py font.ufo
30
96
31
97
# write mark and mkmk feature files
32
98
python markFeatureWriter.py -m font.ufo
33
99
100
+
# trim casing tags
101
+
python markFeatureWriter.py -t font.ufo
102
+
103
+
# further usage information
104
+
python markFeatureWriter.py -h
105
+
34
106
```
35
107
36
-
For both of these scripts, the resulting feature file only contains the raw feature data. This data can be used by means of an `include` statement:
108
+
----
109
+
110
+
Both kern- and mark feature writers export raw feature data, which still needs to be wrapped with feature “fence”. This is easily achieved with an `include` statement:
37
111
38
112
```
39
113
feature kern{
@@ -42,49 +116,31 @@ feature kern{
42
116
} kern;
43
117
```
44
118
45
-
The benefit of this is that different feature flags can be used, see for example https://github.com/adobe-fonts/source-serif/blob/main/familyGPOS.fea#L12-L13
46
-
47
-
48
-
### `kernExport.py`
119
+
The benefit of this is that different feature flags can be used (example)[https://github.com/adobe-fonts/source-serif/blob/main/familyGPOS.fea#L12-L13]. Also, the (sometimes volatile) GPOS feature data can be re-generated periodically without affecting the overal structure of the feature tree.
49
120
50
-
FontLab 5-Module to export FontLab class-kerning to UFO. It needs to be called with a FL font object (`fl.font`), and a prefixOption. The prefixOption is used for renaming kerning classes to various UFO-styles.
51
121
52
-
If the prefixOption is `None`, class names will be prefixed with to @L_ and @R_ to keep track of their side (in case they need to be re-imported into FL).
53
-
54
-
The prefixOptions are:
55
-
`'MM'`: convert class names to MetricsMachine-compatible group names
0 commit comments