Page 1 of 1

Problems with manual kerning

Posted: Fri Apr 11, 2008 7:36 am
by elpres
Hi all,

right now i’m working on a programm that does some manual typesetting on a pretty low level, i.e. it handles fonts as vector shapes and places them manually with no help from the OS (Windows in this case). The feature i’m trying to get right at this moment is kerning, and while it seems to work most of the time, there are some artifacts with Cambria. For example, he ’d’ and the ’e’ are too close, and ’tt’ or ’ty’ overlap. So i’ve taken a look into its kerning pairs table and found more than one entry for ’de’, the first one being -6 (at a font size of 40), which is the one used simply because it’s found first. Later on there are some entries with -3 and a couple more with -6, 6 entries total. Typically, i’d expect one kerning value per pair of characters. Is the fact that Cambria has more of them some kind of a glitch in the font, or, if not, which one should i choose? Any help on getting the right kerning values would be greatly appreciated.

Posted: Fri Apr 11, 2008 8:23 am
by William
I do not know the answer to your question but decided to try to find out.

I have not found answer thus far yet have found the following web page at the Microsoft Typography webspace and mention it now in case it might be of use.

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

I am wondering whether perhaps the Cambria font was designed for use on an Apple Macintosh and perhaps uses the Apple extensions to kerning which the above-referenced Microsoft page mentions.

William Overington

11 April 2008

Posted: Fri Apr 11, 2008 8:35 am
by William
I searched for kern apple at http://www.yahoo.com and found the following.

http://developer.apple.com/textfonts/TT ... 6kern.html

I have not studied it in detail, yet I did notice the following in the Mac OS-specific information section, which section is near the end of the document.
Fonts targeted for the Mac OS only should use the new format; fonts targeted for both the Mac OS and Windows should use the old format.
I hope that this helps.

William Overington

11 April 2008

Posted: Fri Apr 11, 2008 9:09 am
by elpres
Thanks for the links, I'll take a look. Cambria is one of the fonts Microsoft released with Windows Vista, so it is probably not specifically targeted for Mac OS. I'd rather expect that it would work best with the Windows API, which i am using. If it helps, i can explain the details of my rendering pipeline, maybe there is a bug in there.

Re: Problems with manual kerning

Posted: Fri Apr 11, 2008 10:33 am
by Erwin Denissen
elpres wrote:Is the fact that Cambria has more of them some kind of a glitch in the font, or, if not, which one should i choose?
This is a bug that I reported to Microsoft's Typography group back in May 2007. Actually I know of 3 Vista fonts that contain duplicate kerning pairs in the kern table. Maybe SP1 will contains updates of these fonts.
elpres wrote:Any help on getting the right kerning values would be greatly appreciated.
There is no guideline about this, so try to find out how Windows rasterizer copes with it.

Posted: Fri Apr 11, 2008 12:32 pm
by William
elpres wrote:Thanks for the links, I'll take a look. Cambria is one of the fonts Microsoft released with Windows Vista, so it is probably not specifically targeted for Mac OS. I'd rather expect that it would work best with the Windows API, which i am using.
Thank you for the further information. It looks like I was following a, well, not wrong, but an "inappropriate to this specific situation" route when I wondered about whether the font was something to do with the Apple extension to the kern table.

When you mentioned fonts and Vista, I remembered something and found this post.

viewtopic.php?t=1780

The licensing of the fonts is mentioned specifically on the Microsoft web page and it appears to me (I am not a lawyer!) to be quite generous to people using computers using the Windows operating system.

I have only done a little about kerning myself. In case it is of any use in trying with your program and analysing what is going on in your program I mention my Kern Deco fonts. As I made the fonts myself I know exactly what is in them as regards kerning. The kerning is very noticeable.

The kerning is in some of the uppercase character pairs. There is some documentation and examples with the fonts and maybe the large size of the kerns might perhaps show obviously in your program.

viewtopic.php?t=1823

There are 18 posts in the thread at the moment, yet the regular font is linked from the first post in the thread and, in fact, version 0.052 is now supplied by that link: the changes are that there are three new kerning pairs, namely PS, FS and JS, each at -512 font units.

In case it might help in testing, I mention that my Whiteboard Venetian typeface has regular, italic, bold and bold italic fonts and each has just one kerning pair, namely qu, set at -128 font units.

viewtopic.php?t=1989

I have tried looking at which kerning pairs Cambria displays in FontCreator and there was unpacking of a .TTC file and I ended up looking at a file CAMBRIA_0.ttf and could not find any kerning pairs for any of the de, tt, or ty pairs which you mention in your first post in this thread, though there are a lot of kerning pairs in the font so maybe I missed them.

William Overington

11 April 2008

Posted: Mon Apr 14, 2008 8:52 am
by elpres
Erwin, nice to know that you can confirm the bug in Cambria, instead of me missing something in the implementation. I've made a screenshot of a text string rendered with (from top to bottom) Calibri (another Vista font), Cambria and Arial, where the problems in Cambria are quite clear:

Image

From how the other two fonts are rendered and how the kerning worked with Cambria's capital letters i'd assume that i'm doing it right. The actual proccess is rather straight forward and there's not much room to make a mistake.

I've also dumped the kerning tables for Arial and Cambria, if somebody wants to take a look. The latter has 9812 pairs, but a lot of duplicates, e.g. 20 times 'AC', all with the same kerning amount.

Thanks for your help.

Posted: Mon Apr 14, 2008 9:31 am
by Bhikkhu Pesala
de are too tightly kerned, but tty are correctly kerned IMO. That is one of the ligatures available in my fonts.

Posted: Mon Apr 14, 2008 9:35 am
by Erwin Denissen
I don't have time to look into this further, but I don't think there is a tt kerning pair, so I suspect you fail to process the kern table. You could try ttfdump from Microsoft to get the kerning pairs.