Detect if font-family is Honored
Detect if font-family is honored in the document via http://juicystudio.com/article/icon-fonts-user-defined-stylesheets.php
CSS
h1{font-family:"Times New Roman", Arial, sans-serif}
JavaScript
function checkFont(strFamily) {
var objDiv = document.createElement('div');
objDiv.style.fontFamily = strFamily;
objDiv.appendChild(document.createTextNode('FONT TEST'));
if (window.getComputedStyle) {
return window.getComputedStyle(objDiv, null).getPropertyValue('font-family') === strFamily;
}
return objDiv.currentStyle.fontFamily === strFamily;
}
var bHonoured = checkFont('Times New Roman');
console.log(bHonoured);