views:

1466

answers:

7

Hi,

I love the way Mac OS beautifully renders fonts (not just browsers). I was wondering if we could somehow get the same rendering in browsers running on Windows?

Someone recommended sIFR but I guess that's useful when I need to use non-standard fonts?

-- Swap

+2  A: 

Not sure if this is a setup, but of course, Safari on Windows renders using the OS X rendering algorithm.

Brad Wilson
+1  A: 

Brad is right: use Safari if you want the Mac font rendering algorithm.

Jeff and Joel have both blogged about this before (not surprisingly, around the time that Safari was released for Windows), if you would like more details:

http://www.codinghorror.com/blog/archives/000885.html

Travis
+1  A: 

I'm assuming you would like to be ablt to use if globally, or at least in IE/Firefox, not just be installing Safari as other have suggested.

Back in the days wen Mac OS X was still in development, there was a plan to release the Cocoa framework for windows, to allow applications written to it to run natively on Windows with a recompile. I suspect that set of Cocoa windows libraries (Yellow Box wasn't it?) would have given you Mac OS X style font rendering but I don't think it was ever released (though you may be able to get very old beta versions of it from somewhere, and I have a feeling some of it was somehow part of WebObjects or something like that).

I suspect the windows version of Safari is using an internal version of the Cocoa libraries for Windows, whcih is why it has Mac OS X font rendering (though I believe recent nightly builds at least have the option to use Windows' native font rendering for those who were complaining about it looking out of place).

Anyway, long store short, unless you're going to write your own font renderer, I don't think there's any easy way to do it (other than using Safari)

Matt Sheppard
Font rendering on OS X isn't done by Cocoa, it's done by CoreGraphics. It's highly doubtful that Safari has any sort of "internal version of the Cocoa libraries" bundled, as that would require a Yellow Box implementation.
Kevin Ballard
+1  A: 

Someone recommended sIFR but I guess that's useful when I need to use non-standard fonts?

sIFR will not give you the intended effect. Like Windows's ClearType, Flash's anti-aliasing (which sIFR uses) optimizes towards the pixel grid, not towards accurate representation of the typeface.

You may be able to use Safari's bundled CoreGraphics library to do your font rendering, but you'd likely break Apple's license agreements (especially once you try to ship your app…).

Sören Kuklau
+5  A: 

Check out GDI++/FreeType (link, link). It's a highly configurable font-rendering replacement for Windows. With some configuration of hinting, anti-aliasing, etc, you should be able to approximate OSX style font rendering fairly close.

Factor Mystic
A: 

I'm writing a Java application doing some interesting things with fonts and working with some graphic designers, and they want the same kind of font rendering you're talking about. I was able to get pretty close by turning on fractional metrics aka sub-pixel glyph placement accuracy, and anti-aliasing, which are the key differences between Mac and Windows font rendering. Looks pretty good for larger TrueType fonts.

Here's the Java code I used. It's all done with their native font rendering engine (which I believe may be FreeType, not sure exactly).

g.setFont(new Font("Century Schoolbook", Font.PLAIN, 36));
g.setRenderingHint(RenderingHints.KEY_FRACTIONALMETRICS,
                   RenderingHints.VALUE_FRACTIONALMETRICS_ON);
g.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING,
                   RenderingHints.VALUE_TEXT_ANTIALIAS_ON);

Now if only I could figure out how to make OpenType CFF fonts work.

William
A: 

You could wait until IE9, which apparently has much better text rendering, using DirectX: http://blogs.msdn.com/ie/archive/2009/11/18/an-early-look-at-ie9-for-developers.aspx

e100