Newfangled works with independent agencies to create lead development web platforms for their clients.

Newfangled works with independent agencies to create lead development web platforms for their clients.

Web Typography: Struggles and Solutions

at 9:00 am

We recently worked on a project with a familiar stumbling block: the font didn't look the same on all browsers. During the long road to figuring out why and how to fix it, I found a bunch of tips, tricks and tools that will hopefully help you on your typographic journeys.  

This particular project was using an @font-face embedded font. I used FontSquirrel's kit generator which saved a ton of time creating a flexible, cross browser kit. If you're not using an embedded font, try the Font Stack Builder at Code Style - it has a handy tool for determining platform compatibility for each chosen font and classic family stack combinations that you can easily drop into your CSS.

The problem we wrestled with was a particularly thorny one: the font was too bold on certain browser/machine combinations. Three developers over three days (with approximately 3,000,000 Google searches) yielded the magic CSS, which we applied to the body:

-webkit-font-smoothing: antialiased;

It boiled down to this: the font smoothing on a Mac running OSX 10.6 was going nuts in Firefox and making the font roughly double the weight that it was intended. This one browser specific bit of styling tamed the rogue pixels and rendered the font as the client intended.

Another trick picked up during the furious Google-fu sessions was an opacity hack that is also Mac specific, courtesy of Dave Bond. This font weight problem is caused by the same font smoothing setting, but generally only appears when light text is placed on a dark background. Again, one small bit of CSS applied to the div in which the too bold text lives is the fix:

opacity: .90;

After we conquered this one, we thought we were in the clear. Enter hosted web fonts via TypeKit. Too bold fonts couldn't be subdued no matter what we tried. This issue turns out to be technically not solvable, but knowing this before spending hours of frustration is almost as good as a solution. In an effort to match the behavior of each browser, TypeKit serves up different versions of fonts based on user-agent strings - they offer screen shots showing the different renderings. Here's an example our Steve Brock created to show the variability of Myriad Pro:

Myriad Pro TypeKit Samples

Hopefully, you can use some of these solutions and save yourself some head meets desk moments. Have fun with fonts!





Comments

Jonathan | October 6, 2011 1:48 PM
Thanks for sharing your findings. I love @font-face, it has really made the web a lot better. Slowly, each browser seems to be improving the aliasing of these fonts. On Windows, fonts look great in IE9, Safari and Firefox. Google Chrome is lagging in this area though - fonts still look rough. I also find that while @font-face fonts work well in medium to large sizes, they are unreliable in small sizes. Whatever the case, I'm happy how things are progressing!
Jonathan P | April 3, 2013 6:15 AM
Thanks so much, was searching for a solution and yours did the trick.

↑ top