Use a style tag with an ID instead of keeping a reference to it.
This commit is contained in:
parent
b6077c7398
commit
4e39685753
17
src/fonts.js
17
src/fonts.js
@ -20,9 +20,6 @@ var kPDFGlyphSpaceUnits = 1000;
|
|||||||
// Until hinting is fully supported this constant can be used
|
// Until hinting is fully supported this constant can be used
|
||||||
var kHintingEnabled = false;
|
var kHintingEnabled = false;
|
||||||
|
|
||||||
// A reference to a reusable style sheet.
|
|
||||||
var styleSheet;
|
|
||||||
|
|
||||||
var FontFlags = {
|
var FontFlags = {
|
||||||
FixedPitch: 1,
|
FixedPitch: 1,
|
||||||
Serif: 2,
|
Serif: 2,
|
||||||
@ -2377,14 +2374,14 @@ var Font = (function FontClosure() {
|
|||||||
window.btoa(data) + ');');
|
window.btoa(data) + ');');
|
||||||
var rule = "@font-face { font-family:'" + fontName + "';src:" + url + '}';
|
var rule = "@font-face { font-family:'" + fontName + "';src:" + url + '}';
|
||||||
|
|
||||||
|
var styleElement = document.getElementById('PDFJS_FONT_STYLE_TAG');
|
||||||
if(!styleSheet) {
|
if (!styleElement) {
|
||||||
var styleElement = document.createElement('style');
|
styleElement = document.createElement('style');
|
||||||
document.documentElement.getElementsByTagName('head')[0].appendChild(
|
document.documentElement.getElementsByTagName('head')[0].appendChild(
|
||||||
styleElement);
|
styleElement);
|
||||||
|
|
||||||
styleSheet = styleElement.sheet;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var styleSheet = styleElement.sheet;
|
||||||
styleSheet.insertRule(rule, styleSheet.cssRules.length);
|
styleSheet.insertRule(rule, styleSheet.cssRules.length);
|
||||||
|
|
||||||
if (PDFJS.pdfBug && FontInspector.enabled)
|
if (PDFJS.pdfBug && FontInspector.enabled)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user