1
0
Fork 0
mirror of https://github.com/mozilla/pdf.js.git synced 2025-04-22 16:18:08 +02:00

Merge pull request #2425 from yurydelendik/detect-fonts-off

Detecting if web fonts are disabled in Firefox.
This commit is contained in:
Brendan Dahl 2012-12-06 13:30:07 -08:00
commit 0910c5e68e
4 changed files with 49 additions and 1 deletions

View file

@ -90,6 +90,13 @@ var PDFDocumentProxy = (function PDFDocumentProxyClosure() {
get fingerprint() {
return this.pdfInfo.fingerprint;
},
/**
* @return {boolean} true if embedded document fonts are in use. Will be
* set during rendering of the pages.
*/
get embeddedFontsUsed() {
return this.transport.embeddedFontsUsed;
},
/**
* @param {number} The page number to get. The first page is 1.
* @return {Promise} A promise that is resolved with a {PDFPageProxy}
@ -337,6 +344,9 @@ var PDFPageProxy = (function PDFPageProxyClosure() {
warn('Error during font loading: ' + obj.error);
continue;
}
if (!obj.coded) {
this.transport.embeddedFontsUsed = true;
}
fontObjs.push(obj);
}
@ -442,7 +452,7 @@ var WorkerTransport = (function WorkerTransportClosure() {
this.pageCache = [];
this.pagePromises = [];
this.fontsLoading = {};
this.embeddedFontsUsed = false;
// If worker support isn't disabled explicit and the browser has worker
// support, create a new web worker and test if it/the browser fullfills