Store kern list in-file?

Post Reply
User avatar
colinmford
Posts: 7
Joined: 07 Jul 2021

Store kern list in-file?

Post by colinmford »

Hi Tim,

I've found some usefulness in editing the pair_frequencies.txt file, adding some pairs that are missing, or taking out some pairs we don't want kerned. It's great that the list is accessible to the user!

I have a few different pair_frequencies.txt files I've been trying out, and so to swap them out I find I have to do a lot of this: close Glyphs, rename text files, re-open Glyphs. Plus, I feel a little funny about messing around in the plugin files like that, seeing as the files will get overwritten if I need to update Kern On.

I was wondering if you could additionally look for a key in the font (or master's) user data to access a custom pair frequencies list? If missing, KernOn could use the text file in the plugin package, but if present it could use the provided list:

(psudo code)
```
Glyphs.font.userData["KernOnPairFrequencies"] = [
("KO", 123456),
("ON", 123455),
...
]

# Kern on would use pairs "KO", "ON", etc

del Glyphs.font.userData["KernOnPairFrequencies"]

# Kern on would use pairs in the default pair_frequencies.txt list: "in", "er", etc
```

What do you think?
User avatar
Tim Ahrens
Site Admin
Posts: 177
Joined: 11 Jul 2019

Re: Store kern list in-file?

Post by Tim Ahrens »

First, I’d be really curious to see which pairs you added and removed. As you can imagine, when I created that list, there were many tough calls, and I’d expect some users to have a different opinion. I am really open to adding more pairs permanently.

If you have custom pairs that are project-specific (again, I’d be genuinely curious to see which they are) then one option would be to add the pairs via user-set auto pairs. Just type the pairs one per line and press the auto segment. To “delete” auto pairs you could make them zero-value independent pairs. When the fonts are exported these zero-value pairs will simply be omitted, and this even prevents them from being unintentionally generated while the class kerning is generated, in case it is really crucial that the pairs are not kerned. Both these mechanisms store the pairs in the font.

Using user-set auto pairs and independent zero-pairs is not exactly the same as tweaking the initial (Unicode) pairs list, however. The latter allows you to enjoy Kern On’s application of OT features. The user-set auto and independent pairs are glyph pairs, so you ’d have to ensure all possible OT-derived pairs are also added or removed, and that’s not ideal. So, I see a case for allowing the user to remove or add custom Unicode pairs. It would be good to understand your use cases, though. Discussing this could be enlightening for all of us.
User avatar
SCarewe
Posts: 39
Joined: 23 Apr 2021

Re: Store kern list in-file?

Post by SCarewe »

Sorry to butt in here a little off-topic, but regarding missing pairs, one set that I always manually add (which is rather tedious, as KO forgets user-set autopairs when switching between masters if you don't let KO sleep in between) is *.numr–fraction and fraction–*.dnom. Those are currently still missing in the autokern list. Would it make sense to add them or is it just me who uses these autopairs?
User avatar
Tim Ahrens
Site Admin
Posts: 177
Joined: 11 Jul 2019

Re: Store kern list in-file?

Post by Tim Ahrens »

You are right, this is still on my list of things that need a more elegant solution. Right now, the pairs list is strictly Unicode pairs, and this list is extended by “applying” the OT features. I don’t want to assume any particular glyph naming scheme so we’d need to define the pairs like 1⁄ +numr or ⁄2 +dnom. I’ll try to implement something like that soon.
Post Reply