foliojs / fontkit

An advanced font engine for Node and the browser
1.48k stars 219 forks source link

Augment AATMorxProcessor to allow for features to be disabled (instead of only enabled) #206

Closed issacgerges closed 5 years ago

issacgerges commented 5 years ago

In a recent Chromium upgrade, ligatures were disabled when letterspacing was non-zero. In order to match this behavior, we needed to add the ability to disable default AAT morx features.

I've added a test for this case and validated it does allow us to disable ligatures with non-zero letterspacing but I'm not a font expert and want to validate this won't introduce any issues.

Here's a snippet

let glyphRun;
if (characterSpacing === 0) {
   glyphRun = fontkitFont.layout(text);
} else {
   glyphRun = fontkitFont.layout(text, { liga: false });
}

and the resulting output

image

issacgerges commented 5 years ago

Thanks for merging @devongovett. When do ya'll normally run releases? I can also look into what might need to be done to support this on OpenType (or if it works already)

issacgerges commented 5 years ago

Looks good! Should we also support this for OpenType?

Looks like that is already working