Skip to content

Instantly share code, notes, and snippets.

@ardell
Created February 27, 2012 20:49
Show Gist options
  • Save ardell/1926928 to your computer and use it in GitHub Desktop.
Save ardell/1926928 to your computer and use it in GitHub Desktop.
Font Profiler
// Do this to find out the font style usage on a given page
var styles = { 300: { 'normal': 0, 'italic': 0}, 400: { 'normal': 0, 'italic': 0}, 500: { 'normal': 0, 'italic': 0}, 700: { 'normal': 0, 'italic': 0} };
jQuery('body *').each(function(i, e) { var $e = jQuery(e); var weight = $e.css('font-weight'); if (weight == 'normal') weight = 400; if (weight == 'bold') weight = 700; var style = $e.css('font-style'); styles[weight][style] += 1; });
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment