Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
87 changes: 52 additions & 35 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,53 +9,70 @@ AFDKO Python Modules
pip3 install git+https://github.com/adobe-type-tools/python-modules
```

## `goadbWriter`
The goadbWriter extracts a UFO’s glyph order into a GlyphOrderAndAliasDB file. In the `makeotf`-workflow, this file is essential for assignment of glyph order and code points. The GOADB can also be used to filter non-exporting glyphs. [Read more about the GOADB](https://adobe-type-tools.github.io/afdko/MakeOTFUserGuide.html#glyphorderandaliasdb-goadb)

## `kernFeatureWriter.py`
This tool exports the kerning and groups data within a UFO to a
#### Usage:
```zsh

# simple, really
goadbWriter font.ufo

```



## `kernFeatureWriter`
The kernFeatureWriter exports the kerning and groups data within a UFO to a
`makeotf`-compatible GPOS kern feature file.

#### Default functionality:

- writing of a sorted kern.fea file, which organizes pairs in order of
specificity (exceptions first, then glyph-to-glyph, then group pairs)
- filtering of small pairs (often results of interpolation).
Exceptions (even though they may be small) are not filtered.
- processing of right-to-left pairs (given that kerning groups containing
those glyphs are suffixed with `_ARA`, `_HEB`, or `_RTL`)
- write a sorted kern.fea file. Pairs are organized in order of specificity:
- glyph-glyph
- glyph-glyph exceptions
- glyph-group exceptions
- group-glyph exceptions
- glyph-group
- glyph-group
- group-glyph and group-group

- filter low-value pairs (<3 or custom value), which are often results of interpolation (exceptions are not filtered)
- process right-to-left pairs (given that kerning groups containing
those glyphs are suffixed with `_ARA`, `_HEB`, or `_RTL`, or RTL glyphs are in a `RTL_KERNING` group)

#### Optional functionality:

- dissolving single-element groups into glyph pairs – this helps with
- dissolve single-element groups into glyph pairs – this helps with
subtable optimization, and can be seen as a means to avoid kerning overflow
- subtable measuring and automatic insertion of subtable breaks
- specifying a maximum subtable size
- identification of glyph-to-glyph RTL pairs by way of a global `RTL_KERNING`
- specify a maximum subtable size
- identify of glyph-to-glyph RTL pairs by way of a global `RTL_KERNING`
reference group
- specifying a glyph name suffix for glyphs to be ignored when writing the
- specify a glyph name suffix for glyphs to be ignored when writing the
kern feature

#### Usage:
```zsh

# write a basic kern feature file
python kernFeatureWriter.py font.ufo
kernFeatureWriter font.ufo

# write a kern feature file with minimum absolute kerning value of 5
python kernFeatureWriter.py -min 5 font.ufo
kernFeatureWriter -min 5 font.ufo

# write a kern feature with subtable breaks
python kernFeatureWriter.py -s font.ufo
kernFeatureWriter -s font.ufo

# further usage information
python kernFeatureWriter.py -h
kernFeatureWriter -h

```

----

## `markFeatureWriter.py`
This tool interprets glyphs and anchor points within a UFO to write a
`makeotf`-compatible GPOS mark feature file.
## `markFeatureWriter`
The markFeatureWriter interprets glyphs and anchor points within a UFO to write a `makeotf`-compatible GPOS mark feature file.

The input UFO file needs to have base glyphs and zero-width combining
marks. Base- and mark glyphs attach via anchor pairs (e.g. `above` and
Expand All @@ -64,22 +81,22 @@ Combining marks must be members of a `COMBINING_MARKS` reference group.

#### Default functionality:

- writing a `mark.fea` file, which contains mark classes/groups, and
- write a `mark.fea` file, which contains mark classes/groups, and
per-anchor mark-to-base positioning lookups (GPOS lookup type 4)
- writing mark-to-ligature positioning lookups (GPOS lookup type 5).
- write mark-to-ligature positioning lookups (GPOS lookup type 5).
This requires anchor names to be suffixed with an ordinal (`1ST`, `2ND`,
`3RD`, etc). For example – if a mark with an `_above` anchor is to be
attached to a ligature, the ligature’s anchor names would be `above1ST`,
`above2ND`, etc – depending on the amount of ligature elements.

#### Optional functionality:

- writing `mkmk.fea`, for mark-to-mark positioning (GPOS lookup type 6)
- writing `abvm.fea`/`blwm.fea` files, as used in Indic scripts (anchor pairs
- write `mkmk.fea`, for mark-to-mark positioning (GPOS lookup type 6)
- write `abvm.fea`/`blwm.fea` files, as used in Indic scripts (anchor pairs
are `abvm`, `_abvm`, and `blwm`, `_blwm`, respectively)
- writing mark classes into a separate file (in case classes need to be
- write mark classes into a separate file (in case classes need to be
shared across multiple lookup types)
- trimming casing tags (`UC`, `LC`, or `SC`)
- trim casing tags (`UC`, `LC`, or `SC`)

Trimming tags is a somewhat specific feature, but it is quite essential:
In a UFO, anchors can be used to build composite glyphs – for example
Expand All @@ -99,16 +116,16 @@ Combining marks must be members of a `COMBINING_MARKS` reference group.
```zsh

# write a basic mark feature
python markFeatureWriter.py font.ufo
markFeatureWriter font.ufo

# write mark and mkmk feature files
python markFeatureWriter.py -m font.ufo
markFeatureWriter -m font.ufo

# trim casing tags
python markFeatureWriter.py -t font.ufo
markFeatureWriter -t font.ufo

# further usage information
python markFeatureWriter.py -h
markFeatureWriter -h

```

Expand All @@ -123,31 +140,31 @@ feature kern{
} kern;
```

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)), or that mark groups can be shared across `mark`/`mkmk` features. Also, the (sometimes volatile) GPOS feature data can be re-generated periodically without affecting the overall structure of the feature tree.
The benefit of this approach is that different feature flags can be used ([example](https://github.com/adobe-fonts/source-serif/blob/main/familyGPOS.fea#L12-L13)), or that mark groups can be shared across `mark`/`mkmk` features. Also, the (sometimes volatile) GPOS feature data can be re-generated periodically without affecting the overall structure of the feature tree.


----

## [utilities (folder `/utilities`)](/utilities)

* `flKernExport.py`
* `flKernExport`
FLS5 script to export class kerning to UFO. Superseded by [vfb3ufo](https://github.com/LucasFonts/vfbLib).


## [other modules (folder `/vintage`)](/vintage)

Other modules are FontLab scripts which were used in pre-UFO days in a FLS5 environment. Those modules are not in active development.

* `AdobeFontLabUtils.py`
* `AdobeFontLabUtils`
Support module for FontLab scripts. Defines commonly used functions and globals.

* `BezChar.py`
* `BezChar`
This module converts between a FontLab glyph and a bez file data string. Used
by the OutlineCheck and AutoHint scripts, to convert FL glyphs to bez programs
as needed by C libraries that do the hard work.

* `WriteFeaturesKernFDK.py`
* `WriteFeaturesKernFDK`
Former kern feature writer.

* `WriteFeaturesMarkFDK.py`
* `WriteFeaturesMarkFDK`
Former mark feature writer.
Loading