Class based kerning 101

spiral's picture

I'm a complete newbie at opentype features. Trying to learn as much as I can, but there doesn't seem to be that much information on the web for beginners.

I'm looking for an explanation of the logic and basic syntax of class-based kerning. Something in the style of this wonderful article about substitution features, but for kerning. I would also love any resources on specifically doing this with fontforge, but I can figure out this easier if I understand what's going on in the background (tables? subtables? what?)

Any pointers will be very much appreciated

JanekZ's picture

Make a new font.
Go to Element/Font info
Choose Lookups/GPOS
and Add Lookup


Choose Pair position (kerning)

In window Kerning format choose Use a matrix of kerning classes

In fields First character I put D and O, and in Second character C G O Q. FontForge set the kerning to -110, I changed it to 10.

In Kerning Metrics window I wrote OQ

You can change the kern value moving the green line between chosen letters

In window Kerning by classes you can see the result

In window Font information/Lookups/GPOS you can right-click the lookup and choose Save Feature File (or only choosen lookup)

Saved

The important part of this file looks like this:

lookup kernHorizontalKerninginLatinloo {
  lookupflag 0;
    @kc0_first_1 = [\D \O ];
    @kc0_second_1 = [\C \G \O \Q ];
    pos @kc0_first_1 @kc0_second_1 22;
} kernHorizontalKerninginLatinloo;

feature kern {

  script DFLT;
     language dflt ;
      lookup kernHorizontalKerninginLatinloo;

  script latn;
     language dflt ;
      lookup kernHorizontalKerninginLatinloo;
} kern;

As you can see there is one class -left=first- with /D/O and one class -right=second- with /C/G/O/Q and the kern value between them is set to 22.

Theunis de Jong's picture

Wow, Janek, is that FontForge!? (Scratching head -- perhaps I should check it again. The interface looks more than a bit improved over the butt-ugly version I tried a couple of years ago.)

JanekZ's picture

It is :) Most powerful tho little buggy
don't know how it looks under mac, here for win: http://typophile.com/node/84219

Té Rowan's picture

Could be the FontForge for Windows they were talking about a while back with how XP-like the chrome is.

spiral's picture

thank you thank you thank you thank you!

spiral's picture

Some maybe basic questions: Do I create a new subtable for each class combination? or can I just add to the same one?

JanekZ's picture

One lookup for all classes you want to kern. You can create the second lookup for Greek script and the third for Cyryllic script. See Brill font by John Hudson as the recent and elaborated example.

raphaelb's picture

Here is a video memo I made for myself, maybe it can be useful!

Syndicate content Syndicate content