Problems with KERN Tables

Get help with FontCreator here. Please do not post feature requests or bug reports here.
Post Reply
Bhikkhu Pesala
Top Typographer
Top Typographer
Posts: 8895
Joined: Tue Oct 29, 2002 5:28 am
Location: Seven Kings, London UK
Contact:

Problems with KERN Tables

Post by Bhikkhu Pesala » Mon Jun 09, 2014 3:23 pm

Class-based kerning is great, but it produces a lot of kerning pairs — nearly 4,000 in my Mandala font, and over 20,000 in Garava or Pali.

The problem is that FontCreator 8.0 doesn't export some ranges to the KERN Table. My old fonts produced with FC7.5 or earlier had kerning pairs for many glyphs in the Private Use Area, e.g. stacking fractions paired with " inch marks (straight quotes).

I can include them in my adjustment pair lookups, but they don't get exported to the KERN table, and so won't work in Serif products, which is where I do all of my work. There is no sign of GPOS kerning support in PagePlus any time soon.

If I open the *.otf exported from FC8 in FC7.5, I can add the kerning pairs, and export the font again. Then they work in PagePlus.

So, why can't I do it from FC8? Is there a maximum limit for kerning pairs in KERN tables? Why does FC8 limit the ranges exported? It also seems to be limited to two subtables.
Alt Frac pairs.png
Alt Frac pairs.png (37.04 KiB) Viewed 4628 times
My FontsReviews: MainTypeFont CreatorHelpFC13 Pro + MT10.0 @ Win10 1909 build 18363.1082

León Fridsma
Posts: 694
Joined: Mon Dec 07, 2009 10:26 am
Location: De Bilt, Netherlands
Contact:

Re: Problems with KERN Tables

Post by León Fridsma » Tue Jun 10, 2014 10:47 am

There's a physical limitation to what can be stored in the 'kern' table and currently FontCreator exports only a few predefined ranges from the Latin/Default OpenType Features if a kern feature is found:

$0000 - $024F
$0370 - $04FF
$1E00 - $206F

We could provide a user-editable file (in user data folder) that allows you to override these ranges that will be exported to the 'kern' table, but because the 'kern' feature is legacy we do not want to put too much effort in this. Also different applications support a different amount of kerning pairs defined, so even when you have valid ranges defined it's possible the font is not accepted by client applications. Do you happen to know (or are you able to find out?) where the limit for PagePlus is ?

Bhikkhu Pesala
Top Typographer
Top Typographer
Posts: 8895
Joined: Tue Oct 29, 2002 5:28 am
Location: Seven Kings, London UK
Contact:

Re: Problems with KERN Tables

Post by Bhikkhu Pesala » Tue Jun 10, 2014 10:57 am

After editing my Mandala font in FC7.5 to add a few alternate fraction pairs, there are 3020 pairs.

The fraction pairs work in PagePlus.

Is there some way to export an old style kerning pairs text file from FC8.0?
My FontsReviews: MainTypeFont CreatorHelpFC13 Pro + MT10.0 @ Win10 1909 build 18363.1082

León Fridsma
Posts: 694
Joined: Mon Dec 07, 2009 10:26 am
Location: De Bilt, Netherlands
Contact:

Re: Problems with KERN Tables

Post by León Fridsma » Tue Jun 10, 2014 11:43 am

Bhikkhu Pesala wrote:Is there some way to export an old style kerning pairs text file from FC8.0?
Unfortunately not

Erwin Denissen
Moderator
Moderator
Posts: 8967
Joined: Fri Oct 04, 2002 12:41 am
Location: Bilthoven, The Netherlands
Contact:

Re: Problems with KERN Tables

Post by Erwin Denissen » Tue Jun 10, 2014 12:27 pm

Bhikkhu Pesala wrote:Is there some way to export an old style kerning pairs text file from FC8.0?
No, but if this is useful for more people, then we will not hesitate to implement it. So can you please explain the need for this?
Erwin Denissen
High-Logic
Proven Font Technology

Bhikkhu Pesala
Top Typographer
Top Typographer
Posts: 8895
Joined: Tue Oct 29, 2002 5:28 am
Location: Seven Kings, London UK
Contact:

Re: Problems with KERN Tables

Post by Bhikkhu Pesala » Tue Jun 10, 2014 12:59 pm

To get my kerning pairs into my font:
  1. I exported the font from FC8.0 where I had built the kerning adjustment pairs
  2. I opened the *.otf in FC7.5 but pairs outside of the supported range were missing
  3. I exported the kerning text file from FC7.5
  4. I edited the kerning text file in Notepad to add a few of the missing pairs
  5. I imported that back into the font
  6. I exported the font from FC 7.5.
If I could export the full set of kerning pairs from FC8.0 as a text file, I could simply import that into FC7.5 without having to figure out which pairs were not included in the exported *.otf because they were not in the right range.

If I can edit the data file to change the range of glyphs exported, that might be easier, as long as the kern table's limit is big enough — 32K should be enough even for my large fonts.

Another question? Is there a way to clear all pair adjustments that are zero? Or less than a given value? Can Harmonize in the Autokern dialogue achieve this indirectly?
My FontsReviews: MainTypeFont CreatorHelpFC13 Pro + MT10.0 @ Win10 1909 build 18363.1082

Bhikkhu Pesala
Top Typographer
Top Typographer
Posts: 8895
Joined: Tue Oct 29, 2002 5:28 am
Location: Seven Kings, London UK
Contact:

Re: Problems with KERN Tables

Post by Bhikkhu Pesala » Wed Jun 11, 2014 4:32 pm

PagePlus seems to support all of the 15,000 kerning pairs that were exported from FC8.0, so that should not be the limiting issue.

It also seems to support all of the 27,000 pairs in Calibri. This screen shot shows a pair towards the end of the list in the Latin Extended Additional character set. The Documentation doesn't specify a limit.
Calibri.png
Calibri.png (6.24 KiB) Viewed 4592 times
If we can just edit the supported ranges, that should work. It would surely be more convenient than having to work with two versions of FontCreator.
My FontsReviews: MainTypeFont CreatorHelpFC13 Pro + MT10.0 @ Win10 1909 build 18363.1082

Erwin Denissen
Moderator
Moderator
Posts: 8967
Joined: Fri Oct 04, 2002 12:41 am
Location: Bilthoven, The Netherlands
Contact:

Re: Problems with KERN Tables

Post by Erwin Denissen » Thu Jun 12, 2014 2:51 pm

Bhikkhu Pesala wrote:The Documentation doesn't specify a limit.
The limit comes from the font specification.

http://www.microsoft.com/typography/otspec/kern.htm

A USHORT can hold an integer in this range: 0..65535

Since the kern table includes a header which stores the length of the whole kern table in a USHORT, the technical maximum number of kerning pairs is 10919. Calculated as follows:
This lenght filed holds all kern data, so it include the fixed header (10 bytes) along with the 4 fixed fields (8 bytes) of the format 0, so there are 65535 - 18 = 65517 bytes left for the actual kerning pairs. Each pair requires 6 bytes, so at most 65517/6= 10919.5 = 10919 pairs can be stored in the old kern table.

However since this length field is not very important, it is common to hope for the best and ignore that field. So then the limitation is 65535 kerning pairs, as the nPairs field is also a USHORT.
Bhikkhu Pesala wrote:It also seems to support all of the 27,000 pairs in Calibri. This screen shot shows a pair towards the end of the list in the Latin Extended Additional character set.
The Calibri font has 14148 kerning pairs in the old kern table and 34347 in the pair adjustment lookup. FontCreator 8 does export 13405 kerning pairs into the old kern table, so it does indeed miss some.

We've missed the subscript digits as well as the good old ligatures fl, fi, fll, etc.
Erwin Denissen
High-Logic
Proven Font Technology

Bhikkhu Pesala
Top Typographer
Top Typographer
Posts: 8895
Joined: Tue Oct 29, 2002 5:28 am
Location: Seven Kings, London UK
Contact:

Re: Problems with KERN Tables

Post by Bhikkhu Pesala » Thu Jun 12, 2014 3:32 pm

You have perhaps missed the fraction slash too.

Polytonic Greek, Latin Extended C and D are not much used, but might be wanted by some.

For me, the main problem is with Small Caps, Petite Caps, and other glyphs in the PUA.
My FontsReviews: MainTypeFont CreatorHelpFC13 Pro + MT10.0 @ Win10 1909 build 18363.1082

Erwin Denissen
Moderator
Moderator
Posts: 8967
Joined: Fri Oct 04, 2002 12:41 am
Location: Bilthoven, The Netherlands
Contact:

Re: Problems with KERN Tables

Post by Erwin Denissen » Thu Jun 12, 2014 3:43 pm

Alright, I've just removed all glyph range checking, and then we get the exact number of kern pairs for both Calibri and Candara, so maybe I've made things more complex than needed :oops:

I suggest we stop checking for specific ranges, and include all glyphs which have at least one mapping to a Unicode code point. And of course we have to stop as soon as we've found 65535 pairs!
Erwin Denissen
High-Logic
Proven Font Technology

Bhikkhu Pesala
Top Typographer
Top Typographer
Posts: 8895
Joined: Tue Oct 29, 2002 5:28 am
Location: Seven Kings, London UK
Contact:

Re: Problems with KERN Tables

Post by Bhikkhu Pesala » Thu Jun 12, 2014 3:52 pm

That's sounds like a better solution than offering options for users to define ranges.

If I ever get to the 64 K limit I will let you know :)
My FontsReviews: MainTypeFont CreatorHelpFC13 Pro + MT10.0 @ Win10 1909 build 18363.1082

Post Reply