Created
August 10, 2011 18:29
-
-
Save pavenuto/1137710 to your computer and use it in GitHub Desktop.
Script to add letter spacing, line height controls to the Typekit type tester
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var $tester = $('#type-tester'), | |
$textarea = $tester.find("textarea"), | |
$letter_spacing = $("<input />", { | |
className: 'letter-spacing', | |
type: 'text', | |
id: "#ls", | |
value: "0.00" | |
}), | |
$ls_div = $("<div />",{ | |
text: "Tracking", | |
}), | |
$line_height = $("<input />", { | |
className: 'line-height', | |
type: 'text', | |
id: "#lh", | |
value: "1" | |
}), | |
$lh_div = $("<div />",{ | |
text: "Leading", | |
}); | |
if ($tester.length){ | |
$('<style type="text/css">#type-tester textarea { text-rendering: optimizeLegibility; }</style>').appendTo('head'); | |
$letter_spacing | |
.appendTo($ls_div) | |
.bind('keyup', function(){ | |
$textarea.css('letterSpacing', $(this).val() + 'em'); | |
}); | |
$ls_div.prependTo($tester); | |
$line_height | |
.appendTo($lh_div) | |
.bind('keyup', function(){ | |
$textarea.css('lineHeight', $(this).val() + 'em'); | |
}); | |
$lh_div.prependTo($tester); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment