Page 1 of 1

Experiments with Kerning Pairs

Posted: Wed May 28, 2014 7:20 am
by David Webber
This is a follow up to the recent kerning pairs thread, but I have some new evidence, and new bafflement.

I have developed a font over quite a long period. It has 100 kerning pairs as reported in the caption of Font Creator's kerning pairs window, and the list looks about that long. [I've experimented over the history of the font and forget how most of them got there, but I'll concentrate here on 3 pairs which I added last week.] In the preview toolbar:
preview-toolbar.png
preview-toolbar.png (4.47 KiB) Viewed 3121 times
Some results:

1. Of these only the AV one is rendered in the Font Creator test window.

2. If I switch on font-kerning in Word 2007, then, of these, it too only renders AV.

3. So I experimented with my own program using Windows GDI functions. (Non-programmers please see technical note appended.) Drawn large enough on the screen the AV kerning is rendered, but the others aren't.

Further experiment:

I've just discovered a new (to me) Windows function 'GetKerningPairs()' with which, having loaded a font, you can ask which symbols constitute kerning pairs, and by how much their spacing is altered.

With my font, loaded (for the screen) at a size where capitals are 24 pixels high, there aren't any. But loaded (for printing) such that capitals are 296 pixels high, it reports 909 kerning pairs! Many of them, it appears, involve symbols which are not even in the font! However, they do include AV, and *don't* include the other two shown above!

Conclusion:

So despite the weirdness of the GetKerningPairs() function, it appears that two of the three cases illustrated above, the kerning is not being exported. But it is shown in the Font-Creator preview toolbar.

Questions:

Is there some special coding behind the preview toolbar window?

Is it possible that Font Creator does not export some kerning pairs?


Dave

---------------------------
Appendix on programming Windows:

"GDI" (the Graphics Drawing Interface) is the traditional Windows library for drawing things, including text, where it is nowadays updated to use strings of Unicode characters, encoded in UTF-16. To use it, you first create a 'device context' (DC) for the screen or printer, then load a font into the DC (at the desired size), and then use library functions with names like TextOut(), ExtTextOut(), and DrawText() to output the text. After loading the font, you can also use the GetKerningPairs() function on the DC to find out which pairs should kern.

Although "GDI" is the most traditional and fundamental library of Windows functions which include text output, there are at least three others ('GDI plus', 'DirectWirite', and 'Uniscribe') which Microsoft have come up at various stages with since. I haven't experimented with them; it would probably only muddy the waters further!
-------------------------

Re: Experiments with Kerning Pairs

Posted: Wed May 28, 2014 10:40 am
by Erwin Denissen
David Webber wrote:With my font, loaded (for the screen) at a size where capitals are 24 pixels high, there aren't any. But loaded (for printing) such that capitals are 296 pixels high, it reports 909 kerning pairs! Many of them, it appears, involve symbols which are not even in the font! However, they do include AV, and *don't* include the other two shown above!
Arial has 909 kerning pairs, so I suspect Windows returned the kerning pairs for Arial instead of the ones as available in your font.

FontCreator will not export all kerning pairs, but this depends on settings, and code points. Can you please send the font file to me, so I can provide correct answers to all your kerning related questions?

Re: Experiments with Kerning Pairs

Posted: Wed May 28, 2014 2:46 pm
by David Webber
Erwin Denissen wrote:
David Webber wrote:With my font, loaded (for the screen) at a size where capitals are 24 pixels high, there aren't any. But loaded (for printing) such that capitals are 296 pixels high, it reports 909 kerning pairs! Many of them, it appears, involve symbols which are not even in the font! However, they do include AV, and *don't* include the other two shown above!
Arial has 909 kerning pairs, so I suspect Windows returned the kerning pairs for Arial instead of the ones as available in your font.

FontCreator will not export all kerning pairs, but this depends on settings, and code points. Can you please send the font file to me, so I can provide correct answers to all your kerning related questions?
Hmm - 909 sounds like a bit of a coincidence! A one in a thousand chance?

But thanks, I've sent a link to the font in a message composed on the forum messaging service.

Dave

Re: Experiments with Kerning Pairs

Posted: Fri May 30, 2014 10:18 am
by Erwin Denissen
Thank you for sending us the font file. It contains numerous glyphs I've never seen before.
David Webber wrote:Hmm - 909 sounds like a bit of a coincidence! A one in a thousand chance?
Since your font has 100 kerning pairs, and the API gives you 909, those must come from another font; most likely Arial. What O.S. do you have?

I've tested the font, and can confirm it contains 100 kerning pairs. The Test dialog (which uses the kerning information from the OpenType layout feature tables) fails to process the first kerning pair (Delta seven), so I suspect Windows (Uniscribe) refuses to display it. Word 2007 uses the old kern table, and fails to show the second kerning pair (Latin capital A with Music natural sign $266E).

Fortunately the Test WOFF (which uses OpenType Layout Features) does show all kerning pairs, so I'm convinced the font is exported correctly.

Re: Experiments with Kerning Pairs

Posted: Tue Jun 03, 2014 11:44 am
by Erwin Denissen
Also worth mentioning is the fact Microsoft Office versions prior to 2007 used a non-Unicode version of the GetKerningPairs GDI function, which has known bug not returning correct pairs and returning some non-existing ones. Office 2007 uses the Unicode-based version which returns correct kerning pairs, unless it is in pre-Word2007 compatibility mode (e.g. opening old document created in Office 2003).

And due to backward compatibility reasons Office 2007 applications may treat punctuation and other neutral characters a little different. Notepad on the other hand should process OpenType layout kerning better.

I would like to know your results with other more recent versions of Office and other word processing software.