Skip to content

Instantly share code, notes, and snippets.

@siamkreative
Created April 8, 2016 02:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save siamkreative/1c4607bc90c94b4b9f70531e1eccd9ef to your computer and use it in GitHub Desktop.
Save siamkreative/1c4607bc90c94b4b9f70531e1eccd9ef to your computer and use it in GitHub Desktop.
Web Safe Font Combinations. Based on http://www.w3schools.com/cssref/css_websafe_fonts.asp
jQuery(document).ready(function ($) {
var select = $('#taed-font-family');
var fontTypes = [];
var fontsOptions = '';
$.getJSON('/websafefonts.json', function (json) {
$.each(json.fonts, function (type, fontArr) {
fontTypes.push(type);
$.each(fontArr, function (index, font) {
fontsOptions += '<option value="' + font + '" class="fonttype" data-type="' + type + '">' + font + '</option>'
});
});
select.append(fontsOptions);
});
});
{
"lastUpdated": 1457672759,
"count": 13,
"source": "http://www.w3schools.com/cssref/css_websafe_fonts.asp",
"fonts": {
"serif": [
"Georgia, serif",
"'Palatino Linotype', 'Book Antiqua', Palatino, serif",
"'Times New Roman', Times, serif"
],
"sansserif": [
"Arial, Helvetica, sans-serif",
"'Arial Black', Gadget, sans-serif",
"'Comic Sans MS', cursive, sans-serif",
"Impact, Charcoal, sans-serif",
"'Lucida Sans Unicode', 'Lucida Grande', sans-serif",
"Tahoma, Geneva, sans-serif",
"'Trebuchet MS', Helvetica, sans-serif",
"Verdana, Geneva, sans-serif"
],
"monospace": [
"'Courier New', Courier, monospace",
"'Lucida Console', Monaco, monospace"
]
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment