Created
March 28, 2018 08:20
-
-
Save josemmo/52ff7aecbd31368be5a972367171b174 to your computer and use it in GitHub Desktop.
This file contains 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
// Fuentes instaladas | |
fp_sources.fonts = {}; | |
var fonts2Check = ['Arial', 'Arial Black', 'Arial Rounded MT Bold', 'Book Antiqua', 'Bookman Old Style', 'Calibri']; | |
var defaultFont = 'Comic Sans MS, Comic Sans, cursive'; | |
var defaultText = 'mmmmmmmmmmambo'; | |
var defaultWidth = 611; | |
for (var i=0; i<fonts2Check.length; i++) { | |
var fontName = fonts2Check[i]; | |
var el = document.createElement('div'); | |
el.style.cssText = 'position:absolute;' + | |
'left:0; top:0; z-index:-99999;' + | |
'opacity:0; font-size:60px;' + | |
'font-family:' + fontName + ', ' + | |
defaultFont; | |
el.innerHTML = defaultText; | |
document.body.appendChild(el); | |
var actualWidth = el.offsetWidth; | |
var installed = (actualWidth != defaultWidth); | |
fp_sources.fonts[fontName] = installed; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment