kern-dump icon indicating copy to clipboard operation
kern-dump copied to clipboard

Is skipping ValueFormat1 == 0 in class kerning correct?

Open justvanrossum opened this issue 8 years ago • 12 comments

In line 250 of getKerningPairsFromOTF.py I see this:

                            elif valueFormat == 0:
                                # valueFormat zero is caused by a value of <0 0 0 0> on a class-class pair; skip these
                                continue

Is this really correct? If valueFormat == 0, no kerning data from the entire subtable is read at all, which makes me wonder what the use of such a subtable is. (I'm looking at a font with a PairPosFormat2 subtable with ValueFormat1 == 0, and I can't quite figure out why it's there and how it should behave.)

justvanrossum avatar Apr 19 '17 20:04 justvanrossum

I wonder if this represents a class-class pair with an explicit zero kerning value and one (or several) non-zero exceptions.

frankrolf avatar Apr 19 '17 20:04 frankrolf

It's possible that ValueFormat2 is nonzero, which means second glyph in pairs is adjusted but no first glyph.

behdad avatar Apr 20 '17 00:04 behdad

That's not the case here, ValueFormat2 is also 0.

justvanrossum avatar Apr 20 '17 06:04 justvanrossum

Then yes, that's a degenerate subtable. Is Coverage empty as well?

behdad avatar Apr 20 '17 06:04 behdad

No, Coverage is not empty, and both ClassDefs are filled, too. It was compiled by AFDKO.

If I do not ignore that subtable (but take those values as 0) I don't get the correct kerning out of the font, so that suggests that getKerningPairsFromOTF.py is doing the right thing. But then, why did AFDKO put it in there...

I may not pursue this further, though, as I have something that seems to works well now. This issue can be labeled "just curious" :)

justvanrossum avatar Apr 20 '17 07:04 justvanrossum

Then that subtable will act as a stopper. Anything on the coverage gets a zero there and next subtables will NOT be search for those glyphs as the first in a kern pair.

behdad avatar Apr 20 '17 07:04 behdad

Ok, but then there is after all something wrong with either the font or getKerningPairsFromOTF.py or both.

justvanrossum avatar Apr 20 '17 07:04 justvanrossum

Not arguing with that :).

behdad avatar Apr 20 '17 07:04 behdad

Just, would it be possible to send over the font? I am curious now!

frankrolf avatar Apr 20 '17 15:04 frankrolf

Emailed you.

justvanrossum avatar Apr 20 '17 15:04 justvanrossum

I also like to see the font. I read the code and found a few different issues. Filing new issue now.

behdad avatar Apr 20 '17 18:04 behdad

For reference: https://github.com/adobe-type-tools/kern-dump/issues/2

behdad avatar Apr 27 '17 23:04 behdad