Browse Source

Check for stylesheet presence (font.js)

If doc doesn't have a stylesheet, create one.
Artur Adib 14 years ago
parent
commit
de253dcbe3
  1. 4
      fonts.js

4
fonts.js

@ -1291,6 +1291,10 @@ var Font = (function Font() { @@ -1291,6 +1291,10 @@ var Font = (function Font() {
window.btoa(data) + ');');
var rule = "@font-face { font-family:'" + fontName + "';src:" + url + '}';
var styleSheet = document.styleSheets[0];
if (!styleSheet) {
document.documentElement.firstChild.appendChild( document.createElement('style') );
styleSheet = document.styleSheets[0];
}
styleSheet.insertRule(rule, styleSheet.cssRules.length);
return rule;

Loading…
Cancel
Save