Author Topic: Collapsing class kerning more precisely  (Read 6181 times)

Ray Larabie

  • Hero Member
  • *****
  • Posts: 90
    • Typodermic Fonts
    • Email
Collapsing class kerning more precisely
« on: 2010-02-03, 22:08:32 »
I have FLS set to automatically collapse the class kerning table to 2048 kerns. I can choose a codepage, fine but how can I get more control over what kerns get higher priority? In some of my fonts, kerns in the A-Z, a-z, commas and quotes are being cut off while base quotes, ellipsis, emdashes and accented letters get collapased kerns. I'd like to be able to specify the bare minimum, top priority kerns that need to be collapsed before lower priority kerns. This is especially a problem with web embedding because browsers don't support class kerning.

What's the best way to accomplish this? Should I create a custom encoding table containing my high priority kerns, collapsing those, then collapse another table with lower priority kerns? Can I rearrange an existing encoding table to put higher priority kerns closer to the top?

The way I've been doing it: I make a copy of the font and remove all low priority glyphs. I collapse kerning, save metrics, import the collapsed kerning back into the main font, then collapse kerning to fill up the 2048.
Ray Larabie
Typodermic Fonts Inc.


  • Beta: FontLab Studio Win
  • Hero Member
  • ***
  • Posts: 296
    • LucasFonts
Re: Collapsing class kerning more precisely
« Reply #1 on: 2010-02-04, 10:24:51 »
Hi Ray,

I'd say you want to filter, not collapse your kerning. The word collapse sounds like transfering flat kerning into classes with the "compact" button. When a card house collapses, you don't lose cards. This is not my native language, is my understanding correct?

I collected and analyzed languages for over a decade, and have a filter programmed where you can set priority for one or more languages (or prioritize by amount of speakers), you can slide priority between real life occurrence and kern amount, you can select quote styles to keep or delete, and of course the maximum amount of pairs to keep in the font. So that only the most important pairs (for your settings) remain.
The filter runs on one of my PCs, but unfortunately is not an installable product (yet). A bug to fix, things to add. Newspapers often have low kern amount limits. Less kerns is shorter production time.
If I only knew how to kick my programmer into picking up this project again... How much demand would there be?

Ray Larabie

  • Hero Member
  • *****
  • Posts: 90
    • Typodermic Fonts
    • Email
Re: Collapsing class kerning more precisely
« Reply #2 on: 2010-03-09, 23:58:12 »
I'm sorry, expand is the term used n Fontlab, not collapse.

That sounds interesting: a smarter way of expanding class kerning. I think there may be some demand now but when all web browsers eventually support class based kerning it will be less irrelevant. Judging by the amount of response to my question, I think demand might be low but at least you'll have one customer.

Fontlab coders: if you were trying to expand kerning but simply restricted it to specific glyphs, what would be the best way to do it?
Ray Larabie
Typodermic Fonts Inc.


  • Beta: FontLab Studio Mac
  • Hero Member
  • ***
  • Posts: 203
  • FLS 5.14 build 4868; Mac OSX 10.10.1
    • Dezcom Typefaces
Re: Collapsing class kerning more precisely
« Reply #3 on: 2010-05-15, 18:25:14 »
Does the browser get in the act or is this something only the font controls?

Arno Enslin

  • Hero Member
  • *****
  • Posts: 116
Re: Collapsing class kerning more precisely
« Reply #4 on: 2010-05-18, 06:12:51 »
@ Ray

You could make a test for finding out, which pairs have priority. You can limit the maximum number of pairs to less than 2048, 100 pairs for example. Then you build class kerning, that results in 110 expanded kerning pairs. 100 of them are combinations of letters. And ten are combinations of letters and point, comma et cetera.

Additionally you could create your own codepage, which you select in the font window and in the drop down menu "generate only pairs with glyphs in following codepage".


I assume, that those pairs with the most extreme values have priority; this would make sense.

Edited 2:

I did not check, if it works, but in this way you could create your own codepage:

1. Remove all characters from your font, that shall not be in your codepage. Every character should have an Unicode value, even if it is a value that belongs to the private use area.

2. Generate the font.

3. Decompile the cmap-table with TTX.

4. Open the decompiled cmap-table in a powerfull text editor like UltraEdit. (A file with character names and Unicode values.)

5. Search and replace with regular expressions and create a syntax like this one:

Code: [Select]
0x2E 0x002E %FULL STOP
0x2F 0x002F %SOLIDUS
0x30 0x0030 %DIGIT ZERO
0x31 0x0031 %DIGIT ONE
0x32 0x0032 %DIGIT TWO
0x33 0x0033 %DIGIT THREE

6. Save the file with the extension ".cpg" in the FontLab folder, in which the codepages are stored. On Windows this is "FontLab-installation-folder\codepage".

7. (End and) restart FontLab.


If you want to change the unicode later, that should not be a problem. TTX also can decompile the kern-table. And the kern-table can merged into a font with different unicode values. You must not change the character names only.

I strongly recommend TTX. With the help of batch files it is very easy to use. Alternatively you may give OTMaster a try, but I think, that the prices of DTL products are elitary and I like free open source products, projects, which everyone is allowed to improve. I am for my part very contented with TTX.
« Last Edit: 2010-05-18, 11:24:14 by Arno Enslin »