skosch / Crimson

The Crimson Text typeface
SIL Open Font License 1.1
510 stars 56 forks source link

Switch to Feature File format for OpenType features #29

Open katef opened 8 years ago

katef commented 8 years ago

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 commented 8 years ago

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 commented 8 years ago

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 commented 8 years ago

Some discussion on fontforge/fontforge#2603.

skosch commented 8 years ago

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

katef commented 8 years ago

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