Skip to content

Instantly share code, notes, and snippets.

@benschwarz
Created September 17, 2010 01:49
Show Gist options
  • Save benschwarz/583522 to your computer and use it in GitHub Desktop.
Save benschwarz/583522 to your computer and use it in GitHub Desktop.
// Add Modernizr test for font-smoothing
// A designer may wish to darken the colour of a given font when antialiasing is applied
// Examples of font-smoothing in action: http://bit.ly/bLeUg1
/*
Usage:
Add to your page
Use html.fontsmoothing h1 { color: xxx; } to make your colours darker
*/
Modernizr.addTest('fontsmoothing', function() {
var div = document.createElement('div');
if ('fontSmoothing' in div.style) return true;
var vendors = ['Webkit', 'Moz', 'ms', 'Khtml'];
for(var i in vendors) if (vendors[i] + 'FontSmoothing' in div.style) return true;
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment