Problems with manual kerning

Discussions about the development of TrueType and OpenType fonts.
Post Reply
elpres
Posts: 3
Joined: Fri Apr 11, 2008 7:30 am

Problems with manual kerning

Post 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.
William
Top Typographer
Top Typographer
Posts: 2038
Joined: Tue Sep 14, 2004 6:41 pm
Location: Worcestershire, England
Contact:

Post 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
William
Top Typographer
Top Typographer
Posts: 2038
Joined: Tue Sep 14, 2004 6:41 pm
Location: Worcestershire, England
Contact:

Post 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
elpres
Posts: 3
Joined: Fri Apr 11, 2008 7:30 am

Post 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.
Erwin Denissen
Moderator
Moderator
Posts: 11107
Joined: Fri Oct 04, 2002 12:41 am
Location: Bilthoven, The Netherlands
Contact:

Re: Problems with manual kerning

Post 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.
Erwin Denissen
High-Logic
Proven Font Technology
William
Top Typographer
Top Typographer
Posts: 2038
Joined: Tue Sep 14, 2004 6:41 pm
Location: Worcestershire, England
Contact:

Post 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
elpres
Posts: 3
Joined: Fri Apr 11, 2008 7:30 am

Post 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.
Bhikkhu Pesala
Top Typographer
Top Typographer
Posts: 9869
Joined: Tue Oct 29, 2002 5:28 am
Location: Seven Kings, London UK
Contact:

Post by Bhikkhu Pesala »

de are too tightly kerned, but tty are correctly kerned IMO. That is one of the ligatures available in my fonts.
My FontsReviews: MainTypeFont CreatorHelpFC15 + MT12.0 @ Win 10 64-bit build 19045.2486
Erwin Denissen
Moderator
Moderator
Posts: 11107
Joined: Fri Oct 04, 2002 12:41 am
Location: Bilthoven, The Netherlands
Contact:

Post 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.
Erwin Denissen
High-Logic
Proven Font Technology
Post Reply