Skip to content

Instantly share code, notes, and snippets.

@lebbe
Created October 30, 2013 10:01
Show Gist options
  • Save lebbe/7229985 to your computer and use it in GitHub Desktop.
Save lebbe/7229985 to your computer and use it in GitHub Desktop.
I was looking for a font on android supporting the ⌫ character. Did not find any. You can turn this code into a "font with ⌫"-detector, by measuring the width of the span ⌫ is inside.
$(function() {
var fonts = ["cursive", "monospace", "serif", "sans-serif", "fantasy", "default", "Arial", "Arial Black", "Arial Narrow", "Arial Rounded MT Bold", "Arial Unicode", "Bookman Old Style", "Bradley Hand ITC", "Century", "Century Gothic", "Comic Sans MS", "Courier", "Courier New", "Droid Sans", "Droid Serif", "Droid Sans Mono", "Georgia", "Gentium", "Impact", "King", "Lucida Console", "Lalit", "Modena", "Monotype Corsiva", "Papyrus", "Tahoma", "TeX", "Times", "Times New Roman", "Trebuchet MS", "Verdana", "Verona"];
var $testField = $('<span>&#9003;</span>');
for(var i = 0; i < fonts.length; i++) {
$clone = $testField.clone();
$clone.css({
'font-family': fonts[i]
});
$('body').append($clone);
$('body').append('<span style="font-family: ' + fonts[i] +'">' + fonts[i] + ": " + $clone.width() + '</span>');
$('body').append('<br>');
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment