Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 14 additions & 1 deletion src/core/fontwatchrunner.js
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,19 @@ goog.scope(function () {
this.widthMatches_(b, FontWatchRunner.LastResortFonts.SANS_SERIF);
};

/**
* Returns true if both fonts don't match the Safari invalid font (question mark blocks) width
*
* @private
* @param {number} a
* @param {number} b
* @return {boolean}
*/
FontWatchRunner.prototype.isInvalidFont_ = function (a, b) {
var invalidwidth = 2412;
return invalidwidth == a || invalidwidth == b;
};

/**
* Returns true if the WebKit bug is present and both widths match a last resort font.
*
Expand Down Expand Up @@ -206,7 +219,7 @@ goog.scope(function () {
var widthA = this.fontRulerA_.getWidth();
var widthB = this.fontRulerB_.getWidth();

if (this.isFallbackFont_(widthA, widthB) || this.isLastResortFont_(widthA, widthB)) {
if (this.isFallbackFont_(widthA, widthB) || this.isLastResortFont_(widthA, widthB) || this.isInvalidFont_(widthA, widthB)) {
if (this.hasTimedOut_()) {
if (this.isLastResortFont_(widthA, widthB) && this.isMetricCompatibleFont_()) {
this.finish_(this.activeCallback_);
Expand Down