[webkit-dev] Printer font is different from screen font

Darin Adler darin at apple.com
Fri Jul 30 11:27:41 PDT 2010

On Jul 30, 2010, at 2:10 AM, Shinichiro Hamaji wrote:

> I've noticed WebKit uses slightly different font size for printing on Mac.

We should discuss specifics instead of this broad issue. There’s a good chance this is something that has been misdiagnosed.

> My colleague told me Mac's font API has a feature to select the best font for printing.

Your colleague may be talking about the -[NSFont printerFont] method. That method is used to select a font that is supported for printing. It is not optimizing for printing, but rather must be used to guarantee that WebKit doesn’t try to use a font for printing that is incompatible with the printing machinery.

The documentation for this is at <http://developer.apple.com/mac/library/documentation/Cocoa/Reference/ApplicationKit/Classes/NSFont_Class/Reference/Reference.html#//apple_ref/occ/instm/NSFont/printerFont>.

> This feature isn't good for a team in Google because they want exactly same results between screen and printing.

We’ll have to discuss a specific example.

You could test this by modifying your copy of WebKit to turn bypass the calls to the printerFont method in FontCacheMac.mm, FontMac.mm, and SimpleFontDataMac.mm. If you get your improved results from that we can continue the discussion. I think it’s more likely you will find that printing doesn’t work any more.

Before we start discussing adding features and modes to control this behavior you should do the experiment to see if this would do something helpful.

    -- Darin

More information about the webkit-dev mailing list