From 86f0aa9e5526a287bcafeb23066a334ff171059b Mon Sep 17 00:00:00 2001 From: dorian smiley Date: Mon, 20 Nov 2017 19:34:53 -0800 Subject: [PATCH 1/3] ignore project files --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index e3fbd98..854f6d4 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ build node_modules +/.idea From 4d2eb3e12cdeb5b3482d8b52a057a913bf3b89c3 Mon Sep 17 00:00:00 2001 From: dorian smiley Date: Mon, 20 Nov 2017 19:35:50 -0800 Subject: [PATCH 2/3] ignore pack lock --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index 854f6d4..872a632 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ build node_modules /.idea +/package-lock.json From 49d743d5017df99b01c87df2e9bac815348b523e Mon Sep 17 00:00:00 2001 From: dorian smiley Date: Mon, 20 Nov 2017 19:37:36 -0800 Subject: [PATCH 3/3] replace use of document.fonts.load with check document.fonts.load was failing to return. I think it may have to do with the resolution of promises but check works perfectly. --- src/observer.js | 24 ++++++++++-------------- 1 file changed, 10 insertions(+), 14 deletions(-) diff --git a/src/observer.js b/src/observer.js index a2201d0..46e6657 100644 --- a/src/observer.js +++ b/src/observer.js @@ -88,9 +88,9 @@ goog.scope(function () { var match = /AppleWebKit\/([0-9]+)(?:\.([0-9]+))/.exec(Observer.getUserAgent()); Observer.HAS_WEBKIT_FALLBACK_BUG = !!match && - (parseInt(match[1], 10) < 536 || - (parseInt(match[1], 10) === 536 && - parseInt(match[2], 10) <= 11)); + (parseInt(match[1], 10) < 536 || + (parseInt(match[1], 10) === 536 && + parseInt(match[2], 10) <= 11)); } return Observer.HAS_WEBKIT_FALLBACK_BUG; }; @@ -197,15 +197,11 @@ goog.scope(function () { if (now - start >= timeoutValue) { reject(); } else { - document.fonts.load(that.getStyle('"' + that['family'] + '"'), testString).then(function (fonts) { - if (fonts.length >= 1) { - resolve(); - } else { - setTimeout(check, 25); - } - }, function () { - reject(); - }); + if(document.fonts.check(that.getStyle('"' + that['family'] + '"'))){ + resolve(); + } else { + setTimeout(check, 25); + } } }; check(); @@ -271,8 +267,8 @@ goog.scope(function () { // values are set to one of the last resort fonts. if (((widthA == fallbackWidthA && widthB == fallbackWidthA && widthC == fallbackWidthA) || - (widthA == fallbackWidthB && widthB == fallbackWidthB && widthC == fallbackWidthB) || - (widthA == fallbackWidthC && widthB == fallbackWidthC && widthC == fallbackWidthC))) { + (widthA == fallbackWidthB && widthB == fallbackWidthB && widthC == fallbackWidthB) || + (widthA == fallbackWidthC && widthB == fallbackWidthC && widthC == fallbackWidthC))) { // The width we got matches some of the known last resort fonts, so let's assume we're dealing with the last resort font. return; }