Apple, Blog, CSS, Graphics

Calibri & Lucida Grande - the winning combination

If like me you’re fed up of using Arial and Verdana as the body typeface on web sites, why not experiment with two very beautiful typefaces present on OS X and Vista.

Calibri

Calibri comes bundled as standard with Windows Vista and Office bundles post-2006 and should therefore be present on a large portion of visitors machines.

Link: http://en.wikipedia.org/wiki/Calibri

Lucida Grande

Lucida Grande is another humanist sans-serif typeface and has been included with Apple’s OS since X. It is especially popular among web designers who have seen the light and use Macs, and incredibly envied by those on Windows machines.

Link: http://en.wikipedia.org/wiki/Lucida_Grande

Although Lucida Grande produces absolutely gorgeous body text (especially with Apple’s lovely text rendering engine), Calibri edges it slightly as my favourite of the two because it works just as well as header type, check out this logo I recently designed using Calibri as an example:

Logotype for World of Pools

So, how do we take advantage of these two gorgeous-but-underused typefaces? It’s simple, just add the following to your stylesheet:

body{ font-family: Calibri, 'Lucida Grande', Arial, Verdana, sans-serif }

By specifying Arial and Verdana we are also allowing those users that don’t have Calibri or Lucida Grande on their system to see the text rendered in Arial or Verdana, instead of their default typeface (more than likely Times New Roman, which just isn’t pretty at small sizes).

Problems with this method

I’ll be the first to admit that this solution is far from trouble-free. The most difficult thing to account for is the different sizes, ratios and kerning of the two typefaces. They don’t just differ slightly, they differ a lot. This can lead to problems such as orphans appearing in navigation menus, overlapping elements, all sorts basically. Always test your designs on both Windows and Mac with each of the typefaces turned on and off at different points to test each possible outcome, and try and tweak the font-sizes to cater for all.

Hacking the WP-Imagefit Plugin

It’s actually surprisingly easy to make work with non-hAtom-based themes (i.e. the Default theme).

How do I do it then?

First things first, ensure your posts are wrapped in a block element that has a class, for instance the Default theme wraps each post in a <div class="post">.

Open wp-imagefit.php and on line 20, change:

jQuery('.hentry').imagefit();\n to jQuery('.post').imagefit();\n

Obviously replace .post with the class you used in your HTML. I’ve only tested this on a custom theme and the Default theme but it seems to work fine for me.

Hope it helps other people.

Alternatively, if you’d rather edit your theme than the plugin, simply edit your theme templates to wrap each post in a <div class="hentry">

Sidenote to plugin author

Excellent plugin, thank you for making it. At some point you could rewrite this so that the plugin automatically injects a <div class="imagefit"> around each entry in the loop, then call that class in the jQuery instead. Limiting this to hAtom only themes seems unneccesary to me.

Link: http://wordpress.org/extend/plugins/wp-imagefit/