From ad3e937816144cf7cfdac6221620d8a98241db9d Mon Sep 17 00:00:00 2001 From: Jonas Jenwald Date: Thu, 16 Aug 2018 20:34:37 +0200 Subject: [PATCH] Replace the `Font.loading` property with, the already existing, `Font.missingFile` property The `Font.loading` property is only ever used *once* in the code, whereas `Font.missingFile` is more widely used. Furthermore the name `loading` feels, at least to me, slight less clear than `missingFile`. Finally, note that these two properties are the inverse of each other. --- src/core/fonts.js | 5 +---- src/display/font_loader.js | 2 +- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/src/core/fonts.js b/src/core/fonts.js index a5bfc019a..febbf21c7 100644 --- a/src/core/fonts.js +++ b/src/core/fonts.js @@ -589,8 +589,6 @@ var Font = (function FontClosure() { this.toUnicode = properties.toUnicode; this.encoding = properties.baseEncoding; this.seacMap = properties.seacMap; - - this.loading = true; } Font.getFontID = (function () { @@ -1261,7 +1259,6 @@ var Font = (function FontClosure() { }); } this.loadedName = fontName.split('-')[0]; - this.loading = false; this.fontType = getFontType(type, subtype); }, @@ -2944,7 +2941,7 @@ var ErrorFont = (function ErrorFontClosure() { function ErrorFont(error) { this.error = error; this.loadedName = 'g_font_error'; - this.loading = false; + this.missingFile = true; } ErrorFont.prototype = { diff --git a/src/display/font_loader.js b/src/display/font_loader.js index 5556bc708..26e569ce7 100644 --- a/src/display/font_loader.js +++ b/src/display/font_loader.js @@ -120,7 +120,7 @@ if (typeof PDFJSDev === 'undefined' || !PDFJSDev.test('MOZCENTRAL')) { // Add the font to the DOM only once or skip if the font // is already loaded. - if (font.attached || font.loading === false) { + if (font.attached || font.missingFile) { continue; } font.attached = true;