Crimson icon indicating copy to clipboard operation
Crimson copied to clipboard

Switch to Feature File format for OpenType features

Open katef opened this issue 9 years ago • 5 comments

I want to have better control over specifying features; FontForge's GUI presents a relatively low-level interface for what's going on. It's much saner to use Adobe's Feature File format to encode these as higher-level constructs, and keep that as the canonical source. FontForge can then load this data. Here's a nice description: http://ansuz.sooke.bc.ca/entry/131

This will also make features like #26 aalt far simpler to encode:

feature aalt {
     feature salt;
     feature smcp;
     substitute Q by Q.alt01; # e.g. some glyph not in salt
} aalt;

I'll switch over in a few steps:

  1. Export the current features (which will come out "as-is" — that is, an explicit listing of every substitution);
  2. Then re-factor that into some more human readable (i.e. group together sets of glyphs)
  3. Re-import those to FontForge

The GUI can be used to export feature files, but only one lookup at a time. So it's more convenient to use Font Forge's scripting interface, with GenerateFeatureFile thus:

#!/home/kate/bin/fontforge
Open($1);
GenerateFeatureFile($1:r+".fea");
Quit(0);

katef avatar Dec 20 '15 16:12 katef

Bold seems to be missing substitutions for a lot of characters for c2sc, for which substitutions are present for smcp. That's a bug, but I'll fix it as part of normalising the character classes for feature files. It's nice that these files make this sort of omission clear.

katef avatar Dec 24 '15 06:12 katef

An update on where I am with this: Currently the .fea files are looking decent for substitutions. FontForge merges these just fine, and I'm considering .fea canonical for that information, now.

However FontForge seems to zero-out the kerns when merging in feature files, which is unfortunate because I expected "merge" to be a union of data, rather than a replacement. So it may be that we'd need to export the kernings, too.

@skosch Can Igino Marini provide kerns in .fea format? Did you just give him your .sfd files? It'd be nice if his canonical output is more legible than I'd get from dumping it from FontForge's low-level representation. I presume they'd be grouped into related glyphs, for instance.

katef avatar Jan 06 '16 17:01 katef

Some discussion on fontforge/fontforge#2603.

katef avatar Jan 06 '16 17:01 katef

Good question. I just checked my old emails and alas, Igino only sent me .vfb and .otf files. I'll email him right now.

skosch avatar Jan 06 '16 19:01 skosch

Kerning delivered in 520f689, from personal communication of Igino Marini's .fea files.

katef avatar Jan 08 '16 15:01 katef