|
@@ -22,8 +22,8 @@ if (typeof PDFJS === 'undefined') {
|
|
|
(typeof window !== 'undefined' ? window : this).PDFJS = {};
|
|
|
}
|
|
|
|
|
|
-PDFJS.version = '1.0.864';
|
|
|
-PDFJS.build = '88d5fa0';
|
|
|
+PDFJS.version = '1.0.867';
|
|
|
+PDFJS.build = '1858fbf';
|
|
|
|
|
|
(function pdfjsWrapper() {
|
|
|
// Use strict in our context only - users might not want it
|
|
@@ -2496,7 +2496,7 @@ var WorkerTransport = (function WorkerTransportClosure() {
|
|
|
this.commonObjs.resolve(id, error);
|
|
|
break;
|
|
|
} else {
|
|
|
- font = new FontFace(exportedData);
|
|
|
+ font = new FontFaceObject(exportedData);
|
|
|
}
|
|
|
|
|
|
FontLoader.bind(
|
|
@@ -6001,6 +6001,10 @@ var FontLoader = {
|
|
|
if (styleElement) {
|
|
|
styleElement.parentNode.removeChild(styleElement);
|
|
|
}
|
|
|
+ this.nativeFontFaces.forEach(function(nativeFontFace) {
|
|
|
+ document.fonts.delete(nativeFontFace);
|
|
|
+ });
|
|
|
+ this.nativeFontFaces.length = 0;
|
|
|
},
|
|
|
get loadTestFont() {
|
|
|
// This is a CFF font with 1 glyph for '.' that fills its entire width and
|
|
@@ -6057,10 +6061,21 @@ var FontLoader = {
|
|
|
return false;
|
|
|
})(),
|
|
|
|
|
|
+ nativeFontFaces: [],
|
|
|
+
|
|
|
+ isFontLoadingAPISupported: !isWorker && !!document.fonts,
|
|
|
+
|
|
|
+ addNativeFontFace: function fontLoader_addNativeFontFace(nativeFontFace) {
|
|
|
+ this.nativeFontFaces.push(nativeFontFace);
|
|
|
+ document.fonts.add(nativeFontFace);
|
|
|
+ },
|
|
|
+
|
|
|
bind: function fontLoaderBind(fonts, callback) {
|
|
|
assert(!isWorker, 'bind() shall be called from main thread');
|
|
|
|
|
|
- var rules = [], fontsToLoad = [];
|
|
|
+ var rules = [];
|
|
|
+ var fontsToLoad = [];
|
|
|
+ var fontLoadPromises = [];
|
|
|
for (var i = 0, ii = fonts.length; i < ii; i++) {
|
|
|
var font = fonts[i];
|
|
|
|
|
@@ -6071,15 +6086,26 @@ var FontLoader = {
|
|
|
}
|
|
|
font.attached = true;
|
|
|
|
|
|
- var rule = font.bindDOM();
|
|
|
- if (rule) {
|
|
|
- rules.push(rule);
|
|
|
- fontsToLoad.push(font);
|
|
|
+ if (this.isFontLoadingAPISupported) {
|
|
|
+ var nativeFontFace = font.createNativeFontFace();
|
|
|
+ if (nativeFontFace) {
|
|
|
+ fontLoadPromises.push(nativeFontFace.loaded);
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ var rule = font.bindDOM();
|
|
|
+ if (rule) {
|
|
|
+ rules.push(rule);
|
|
|
+ fontsToLoad.push(font);
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
|
|
|
var request = FontLoader.queueLoadingCallback(callback);
|
|
|
- if (rules.length > 0 && !this.isSyncFontLoadingSupported) {
|
|
|
+ if (this.isFontLoadingAPISupported) {
|
|
|
+ Promise.all(fontsToLoad).then(function() {
|
|
|
+ request.complete();
|
|
|
+ });
|
|
|
+ } else if (rules.length > 0 && !this.isSyncFontLoadingSupported) {
|
|
|
FontLoader.prepareFontLoadEvent(rules, fontsToLoad, request);
|
|
|
} else {
|
|
|
request.complete();
|
|
@@ -6214,8 +6240,8 @@ var FontLoader = {
|
|
|
}
|
|
|
};
|
|
|
|
|
|
-var FontFace = (function FontFaceClosure() {
|
|
|
- function FontFace(name, file, properties) {
|
|
|
+var FontFaceObject = (function FontFaceObjectClosure() {
|
|
|
+ function FontFaceObject(name, file, properties) {
|
|
|
this.compiledGlyphs = {};
|
|
|
if (arguments.length === 1) {
|
|
|
// importing translated data
|
|
@@ -6226,8 +6252,29 @@ var FontFace = (function FontFaceClosure() {
|
|
|
return;
|
|
|
}
|
|
|
}
|
|
|
- FontFace.prototype = {
|
|
|
- bindDOM: function FontFace_bindDOM() {
|
|
|
+ FontFaceObject.prototype = {
|
|
|
+ createNativeFontFace: function FontFaceObject_createNativeFontFace() {
|
|
|
+ if (!this.data) {
|
|
|
+ return null;
|
|
|
+ }
|
|
|
+
|
|
|
+ if (PDFJS.disableFontFace) {
|
|
|
+ this.disableFontFace = true;
|
|
|
+ return null;
|
|
|
+ }
|
|
|
+
|
|
|
+ var nativeFontFace = new FontFace(this.loadedName, this.data);
|
|
|
+
|
|
|
+ FontLoader.addNativeFontFace(nativeFontFace);
|
|
|
+
|
|
|
+ if (PDFJS.pdfBug && 'FontInspector' in globalScope &&
|
|
|
+ globalScope['FontInspector'].enabled) {
|
|
|
+ globalScope['FontInspector'].fontAdded(this);
|
|
|
+ }
|
|
|
+ return nativeFontFace;
|
|
|
+ },
|
|
|
+
|
|
|
+ bindDOM: function FontFaceObject_bindDOM() {
|
|
|
if (!this.data) {
|
|
|
return null;
|
|
|
}
|
|
@@ -6254,7 +6301,7 @@ var FontFace = (function FontFaceClosure() {
|
|
|
return rule;
|
|
|
},
|
|
|
|
|
|
- getPathGenerator: function (objs, character) {
|
|
|
+ getPathGenerator: function FontLoader_getPathGenerator(objs, character) {
|
|
|
if (!(character in this.compiledGlyphs)) {
|
|
|
var js = objs.get(this.loadedName + '_path_' + character);
|
|
|
/*jshint -W054 */
|
|
@@ -6263,7 +6310,7 @@ var FontFace = (function FontFaceClosure() {
|
|
|
return this.compiledGlyphs[character];
|
|
|
}
|
|
|
};
|
|
|
- return FontFace;
|
|
|
+ return FontFaceObject;
|
|
|
})();
|
|
|
|
|
|
|