Suppose we have a complex script where the kerning rules go in a dist feature (let's say Sinhala, since that's what I'm working on). ufo2ft adds the lookup to the dist feature of the script and also to the kern feature of the DFLT script:
So far so good. However, if I am using manual lookups with # Automatic Code Start, and I have set a languagesystem sinh dflt languagesystem (because it's a Sinhala font) and I haven't added languagesystem DFLT dflt; (because I don't have any DFLT rules), then very strange things happen. We get a feature file like this:
The feature compiler then adds the kern_ltr lookup to bothkern and dist in the DFLT script (but not the contextual positioning), and only adds the contextual positioning (no kerning lookups) to sinh script. This is very much related to https://github.com/fonttools/fonttools/issues/2183, and reflects undefined behavior in the AFDKO spec.
The fix is, if ufo2ft is going to add random DFLT script rules to my feature file, it needs to add a languagesystem DFLT dflt statement if there isn't one already. (Or better, just don't add the random DFLT rules if there isn't a DFLT languagesystem.)
Suppose we have a complex script where the kerning rules go in a
dist
feature (let's say Sinhala, since that's what I'm working on). ufo2ft adds the lookup to thedist
feature of the script and also to thekern
feature of the DFLT script:So far so good. However, if I am using manual lookups with
# Automatic Code Start
, and I have set alanguagesystem sinh dflt
languagesystem (because it's a Sinhala font) and I haven't addedlanguagesystem DFLT dflt;
(because I don't have any DFLT rules), then very strange things happen. We get a feature file like this:The feature compiler then adds the
kern_ltr
lookup to bothkern
anddist
in the DFLT script (but not the contextual positioning), and only adds the contextual positioning (no kerning lookups) tosinh
script. This is very much related to https://github.com/fonttools/fonttools/issues/2183, and reflects undefined behavior in the AFDKO spec.The fix is, if ufo2ft is going to add random
DFLT
script rules to my feature file, it needs to add alanguagesystem DFLT dflt
statement if there isn't one already. (Or better, just don't add the randomDFLT
rules if there isn't aDFLT
languagesystem.)