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

Detecting if web fonts are disable in Firefox.

This commit is contained in:
Yury Delendik 2012-11-30 16:59:51 -06:00
parent 223ad0c117
commit 5dc87a7fca
4 changed files with 49 additions and 0 deletions

View file

@ -882,6 +882,19 @@ var PDFView = {
return support;
},
get supportsDocumentFonts() {
var support = true;
//#if !(FIREFOX || MOZCENTRAL)
//#else
// support = FirefoxCom.requestSync('supportsDocumentFonts');
//#endif
Object.defineProperty(this, 'supportsDocumentFonts', { value: support,
enumerable: true,
configurable: true,
writable: false });
return support;
},
initPassiveLoading: function pdfViewInitPassiveLoading() {
if (!PDFView.loadingBar) {
PDFView.loadingBar = new ProgressBar('#loadingBar', {});
@ -2035,6 +2048,10 @@ var PageView = function pageView(container, pdfPage, id, scale,
if (outputScale.scaled) {
ctx.scale(outputScale.sx, outputScale.sy);
}
//#if (FIREFOX || MOZCENTRAL)
// // Checking if document fonts are used only once
// var checkIfDocumentFontsUsed = !PDFView.pdfDocument.embeddedFontsUsed;
//#endif
// Rendering area
@ -2047,6 +2064,14 @@ var PageView = function pageView(container, pdfPage, id, scale,
delete self.loadingIconDiv;
}
//#if (FIREFOX || MOZCENTRAL)
// if (checkIfDocumentFontsUsed && PDFView.pdfDocument.embeddedFontsUsed &&
// !PDFView.supportsDocumentFonts) {
// console.error(mozL10n.get('web_fonts_disabled', null,
// 'Web fonts are disabled: unable to use embedded PDF fonts.'));
// PDFView.fallback();
// }
//#endif
if (error) {
PDFView.error(mozL10n.get('rendering_error', null,
'An error occurred while rendering the page.'), error);