[Pkg-javascript-commits] [pdf.js] 54/157: fontLoadPromises -> fontsToLoad
David Prévot
taffit at moszumanska.debian.org
Tue Aug 11 06:46:34 UTC 2015
This is an automated email from the git hooks/post-receive script.
taffit pushed a commit to branch master
in repository pdf.js.
commit f9dd7318f7f77c82b2d415c63b0f5875981a72f3
Author: Rob Wu <rob at robwu.nl>
Date: Fri Jul 3 22:32:56 2015 +0200
fontLoadPromises -> fontsToLoad
fontsToLoad is always an empty array, Promise.all should wait for
fontLoadPromises instead of fontsToLoad.
---
src/display/font_loader.js | 11 +++++++++--
1 file changed, 9 insertions(+), 2 deletions(-)
diff --git a/src/display/font_loader.js b/src/display/font_loader.js
index 76b4f24..b8dc046 100644
--- a/src/display/font_loader.js
+++ b/src/display/font_loader.js
@@ -119,6 +119,13 @@ var FontLoader = {
var rules = [];
var fontsToLoad = [];
var fontLoadPromises = [];
+ var getNativeFontPromise = function(nativeFontFace) {
+ // Return a promise that is always fulfilled, even when the font fails to
+ // load.
+ return nativeFontFace.loaded.catch(function(e) {
+ warn('Failed to load font "' + nativeFontFace.family + '": ' + e);
+ });
+ };
for (var i = 0, ii = fonts.length; i < ii; i++) {
var font = fonts[i];
@@ -132,7 +139,7 @@ var FontLoader = {
if (this.isFontLoadingAPISupported) {
var nativeFontFace = font.createNativeFontFace();
if (nativeFontFace) {
- fontLoadPromises.push(nativeFontFace.loaded);
+ fontLoadPromises.push(getNativeFontPromise(nativeFontFace));
}
} else {
var rule = font.bindDOM();
@@ -145,7 +152,7 @@ var FontLoader = {
var request = FontLoader.queueLoadingCallback(callback);
if (this.isFontLoadingAPISupported) {
- Promise.all(fontsToLoad).then(function() {
+ Promise.all(fontLoadPromises).then(function() {
request.complete();
});
} else if (rules.length > 0 && !this.isSyncFontLoadingSupported) {
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/pdf.js.git
More information about the Pkg-javascript-commits
mailing list