unified-font-object / ufo-spec

The official Unified Font Object specification source files.
http://unifiedfontobject.org
175 stars 30 forks source link

What is the interaction of kerning.plist and features.fea? #174

Closed ctrlcctrlv closed 3 years ago

ctrlcctrlv commented 3 years ago

How do I handle this?

Does kerning.plist add to any defined kern pos rules in features.fea, or does it replace the pairs?

The UFO3 spec isn't clear enough.

It is important to note that the features file may contain data that is a duplicate of or data that is in conflict with the data in kerning.plist, groups.plist and fontinfo.plist. Synchronization between the files is not a requirement of this specification. Synchronization is up to the user and application developers.

I have no idea what this means. It's well known that in features.fea you can have two lookups...

feature RQD {
  lookup RQD_1 {
    pos a b -20;
  } RQD_1;
  lookup RQD_2 {
    pos a b -20;
  } RQD_2;
} RQD;

This will result in a kern of -40. It seems to me that features.fea ought to do the same, but I am very concerned about the idea that this is open ended??

BoldMonday commented 3 years ago

As a font editor user I expect in these cases the software to give me either a warning and let me decide what to do, or to let me define upfront what should be done. For example: some font editors have a setting in the preferences to update the kern feature when it is out of sync with the kerning table. This setting is invoked when a binary is compiled.

I would never expect the kerning table to be appended to an already existing kern feature. Either the feature remains as is, or will be overwritten completely.

justvanrossum commented 3 years ago

It's a completely separate feature. Kerning.plist compiles to "kern" (or "dist", depending in the script, with ufo2ft at least), doing positioning in arbitrary other features is no different than having a hand-coded kern feature together with another feature that does positioning. If both features are enabled during shaping/positioning, they will add up.

With ufo2ft, if the hand-coded .fea already contains a "kern" feature, then kerning.plist is ignored.

moyogo commented 3 years ago

With ufo2ft, if the hand-coded .fea already contains a "kern" feature, then kerning.plist is ignored.

Actually ufo2ft can also append feature code generated from kerning.plist when the kern feature writer is explicitly called with the "append" mode. The default mode is to skip adding generated feature code if the feature block is already present as you say, and since version 2.20.0 it can also inserts generated feature code before or after the feature block if it contains the insertion marker comment "# Automatic Code" at its top or bottom. Going forward, it's easier to append generated code using the insertion marker, as the append mode requires a ufo2ft specific lib key.

The UFO specs leaves it to the authoring tool to do the right thing or to let the user choose.

benkiel commented 3 years ago

Closing this as question has been answered. Re-open if more clarification is needed!