googlefonts / googlefonts/ufo2ft

why enum every class-glyph, glyph-class kerning pairs?

Open
#355 1 comment 1 reaction 0 assignees View on GitHub
Dominant language
Python
Stars
176
Forks
48
PR merge metrics
No merged PRs in 30d

Description

see https://adobe-type-tools.github.io/afdko/OpenTypeFeatureFileSpecification.html#6.b.ii

in this example there is a glyph-class pair and an glyph-glyph exception, there is no reason to enumerate.

Compiling this with FDK results in a warning: `Pair positioning has conflicting statements in standalone lookup 'kern_ltr'; choosing the first value: A B`

ufo2fdk has a method to determine if [a higher level pair is possible ](https://github.com/robotools/ufo2fdk/blob/master/Lib/ufo2fdk/kernFeatureWriter.py#L196) which is solving this issue.

```python
import defcon
font = defcon.Font()
font.newGlyph("A")
font.newGlyph("B")
font.newGlyph("C")

font.groups["public.kern2.test"] = ["B", "C"]
font.groups["public.kern1.test"] = ["B", "C"]

font.kerning['A', 'public.kern2.test'] = -100
font.kerning['A', 'B'] = 100

def ufo2fdk():
from ufo2fdk.kernFeatureWriter import KernFeatureWriter

w = KernFeatureWriter(font)
print(w.write())

def ufo2ft():
from ufo2ft.featureWriters.kernFeatureWriter import KernFeatureWriter, ast

feaFile = ast.FeatureFile()
w = KernFeatureWriter()
w.write(font, feaFile)
print(feaFile)

ufo2ft()
```

```
@kern1.test = [B C];
@kern2.test = [B C];

lookup kern_ltr {
lookupflag IgnoreMarks;
pos A B 100;
enum pos A @kern2.test -100;
} kern_ltr;

feature kern {
lookup kern_ltr;
} kern;
```

Contributor guide

No contributing guide indexed for this repository

Research direction

Start in ufo2ft.featureWriters.kernFeatureWriter.KernFeatureWriter and reproduce the issue with the provided defcon font and kerning groups. Compare its output with the linked ufo2fdk KernFeatureWriter logic; done means the generated feature code handles the glyph-glyph exception without the conflicting pair-positioning warning.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.