Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Add the ability for a module to choose a strategy to check if a font …

…has loaded.

For now this is used by the Google Web Fonts module to use a specific strategy
when on a webkit user agent.
  • Loading branch information...
commit fd40992fdd88f85b933e35d623a828bda84b095a 1 parent 11c2360
@jeremiele jeremiele authored
View
14 src/core/checkstrategyfactory.js
@@ -0,0 +1,14 @@
+/**
+ * @constructor
+ */
+webfont.CheckStrategyFactory = function(ctor) {
+ this.ctor_ = ctor || webfont.DefaultCheckStrategy;
+};
+
+webfont.CheckStrategyFactory.prototype.get = function(sizingElementCreator,
+ activeCallback, inactiveCallback, fontSizer, fontFamily, fontDescription,
+ fontTestString) {
+ return new this.ctor_(sizingElementCreator, activeCallback,
+ inactiveCallback, fontSizer, fontFamily, fontDescription,
+ fontTestString);
+};
View
65 src/core/defaultcheckstrategy.js
@@ -0,0 +1,65 @@
+/**
+ * @constructor
+ */
+webfont.DefaultCheckStrategy = function(sizingElementCreator, activeCallback,
+ inactiveCallback, fontSizer, fontFamily, fontDescription, opt_fontTestString) {
+ this.sizingElementCreator_ = sizingElementCreator;
+ this.activeCallback_ = activeCallback;
+ this.inactiveCallback_ = inactiveCallback;
+ this.fontSizer_ = fontSizer;
+ this.fontFamily_ = fontFamily;
+ this.fontDescription_ = fontDescription;
+ this.fontTestString_ = opt_fontTestString
+ || webfont.FontWatchRunner.DEFAULT_TEST_STRING;
+};
+
+webfont.DefaultCheckStrategy.prototype.setUp = function() {
+ this.originalSizeA_ = this.getStackSize_(webfont.FontWatchRunner.SANS_STACK);
+ this.originalSizeB_ = this.getStackSize_(webfont.FontWatchRunner.SERIF_STACK);
+ this.lastObservedSizeA_ = this.originalSizeA_;
+ this.lastObservedSizeB_ = this.originalSizeB_;
+ this.requestedFontA_ = this.sizingElementCreator_.createSizingElement(
+ this.fontFamily_, webfont.FontWatchRunner.SANS_STACK,
+ this.fontDescription_, this.fontTestString_);
+ this.requestedFontB_ = this.sizingElementCreator_.createSizingElement(
+ this.fontFamily_, webfont.FontWatchRunner.SERIF_STACK,
+ this.fontDescription_, this.fontTestString_);
+};
+
+webfont.DefaultCheckStrategy.prototype.tearDown = function() {
+ this.sizingElementCreator_.deleteSizingElement(this.requestedFontA_);
+ this.sizingElementCreator_.deleteSizingElement(this.requestedFontB_);
+};
+
+webfont.DefaultCheckStrategy.prototype.isLoaded = function() {
+ var sizeA = this.fontSizer_.getWidth(this.requestedFontA_);
+ var sizeB = this.fontSizer_.getWidth(this.requestedFontB_);
+
+ if ((this.originalSizeA_ != sizeA || this.originalSizeB_ != sizeB) &&
+ this.lastObservedSizeA_ == sizeA && this.lastObservedSizeB_ == sizeB) {
+ return true;
+ }
+ this.lastObservedSizeA_ = sizeA;
+ this.lastObservedSizeB_ = sizeB;
+ return false;
+};
+
+webfont.DefaultCheckStrategy.prototype.getActiveCallback = function() {
+ return webfont.bind(this, function() {
+ this.activeCallback_(this.fontFamily_, this.fontDescription_);
+ });
+};
+
+webfont.DefaultCheckStrategy.prototype.getTimeoutCallback = function() {
+ return webfont.bind(this, function() {
+ this.inactiveCallback_(this.fontFamily_, this.fontDescription_);
+ });
+};
+
+webfont.DefaultCheckStrategy.prototype.getStackSize_ = function(stack) {
+ var stackElement = this.sizingElementCreator_.createSizingElement('',
+ stack, this.fontDescription_, this.fontTestString_);
+ var size = this.fontSizer_.getWidth(stackElement);
+ this.sizingElementCreator_.deleteSizingElement(stackElement);
+ return size;
+};
View
18 src/core/font.js
@@ -29,6 +29,8 @@ webfont.WebFont.prototype.load = function(configuration) {
webfont.WebFont.prototype.isModuleSupportingUserAgent_ = function(module, eventDispatcher,
fontWatcher, support) {
+ var checkStrategyFactory = new webfont.CheckStrategyFactory(
+ module.getCheckStrategyCtor ? module.getCheckStrategyCtor() : null);
if (!support) {
var allModulesLoaded = --this.moduleLoading_ == 0;
@@ -40,26 +42,28 @@ webfont.WebFont.prototype.isModuleSupportingUserAgent_ = function(module, eventD
eventDispatcher.dispatchLoading();
}
}
- fontWatcher.watch([], {}, {}, allModulesLoaded);
+ fontWatcher.watch([], {}, {}, checkStrategyFactory, allModulesLoaded);
return;
}
module.load(webfont.bind(this, this.onModuleReady_, eventDispatcher,
- fontWatcher));
+ fontWatcher, checkStrategyFactory));
};
webfont.WebFont.prototype.onModuleReady_ = function(eventDispatcher, fontWatcher,
- fontFamilies, opt_fontDescriptions, opt_fontTestStrings) {
+ checkStrategyFactory, fontFamilies, opt_fontDescriptions,
+ opt_fontTestStrings) {
var allModulesLoaded = --this.moduleLoading_ == 0;
if (allModulesLoaded) {
eventDispatcher.dispatchLoading();
}
this.asyncCall_(webfont.bind(this, function(_fontWatcher, _fontFamilies,
- _fontDescriptions, _fontTestStrings, _allModulesLoaded) {
+ _fontDescriptions, _fontTestStrings, _checkStrategyFactory,
+ _allModulesLoaded) {
_fontWatcher.watch(_fontFamilies, _fontDescriptions || {},
- _fontTestStrings || {}, _allModulesLoaded);
+ _fontTestStrings || {}, _checkStrategyFactory, _allModulesLoaded);
}, fontWatcher, fontFamilies, opt_fontDescriptions, opt_fontTestStrings,
- allModulesLoaded));
+ checkStrategyFactory, allModulesLoaded));
};
webfont.WebFont.prototype.load_ = function(eventDispatcher, configuration) {
@@ -68,7 +72,7 @@ webfont.WebFont.prototype.load_ = function(eventDispatcher, configuration) {
this.moduleFailedLoading_ = this.moduleLoading_ = modules.length;
- var fontWatcher = new webfont.FontWatcher(this.userAgent_, this.domHelper_,
+ var fontWatcher = new webfont.FontWatcher(this.domHelper_,
eventDispatcher, {
getWidth: function(elem) {
return elem.offsetWidth;
View
15 src/core/fontwatcher.js
@@ -1,15 +1,13 @@
/**
* @constructor
- * @param {webfont.UserAgent} userAgent
* @param {webfont.DomHelper} domHelper
* @param {webfont.EventDispatcher} eventDispatcher
* @param {Object.<string, function(Object): number>} fontSizer
* @param {function(function(), number=)} asyncCall
* @param {function(): number} getTime
*/
-webfont.FontWatcher = function(userAgent, domHelper, eventDispatcher, fontSizer,
+webfont.FontWatcher = function(domHelper, eventDispatcher, fontSizer,
asyncCall, getTime) {
- this.userAgent_ = userAgent;
this.domHelper_ = domHelper;
this.eventDispatcher_ = eventDispatcher;
this.fontSizer_ = fontSizer;
@@ -36,7 +34,7 @@ webfont.FontWatcher.DEFAULT_VARIATION = 'n4';
* @param {boolean} last True if this is the last set of families to watch.
*/
webfont.FontWatcher.prototype.watch = function(fontFamilies, fontDescriptions,
- fontTestStrings, last) {
+ fontTestStrings, checkStrategyFactory, last) {
var length = fontFamilies.length;
for (var i = 0; i < length; i++) {
@@ -51,6 +49,8 @@ webfont.FontWatcher.prototype.watch = function(fontFamilies, fontDescriptions,
this.last_ = last;
}
+ var sizingElementCreator = new webfont.SizingElementCreator(this.domHelper_);
+
for (var i = 0; i < length; i++) {
var fontFamily = fontFamilies[i];
var descriptions = fontDescriptions[fontFamily];
@@ -63,9 +63,10 @@ webfont.FontWatcher.prototype.watch = function(fontFamilies, fontDescriptions,
var activeCallback = webfont.bind(this, this.fontActive_);
var inactiveCallback = webfont.bind(this, this.fontInactive_)
- new webfont.FontWatchRunner(activeCallback, inactiveCallback,
- this.userAgent_, this.domHelper_, this.fontSizer_, this.asyncCall_,
- this.getTime_, fontFamily, fontDescription, fontTestString);
+ new webfont.FontWatchRunner(this.asyncCall_, this.getTime_,
+ checkStrategyFactory.get(sizingElementCreator, activeCallback,
+ inactiveCallback, this.fontSizer_, fontFamily, fontDescription,
+ fontTestString));
}
}
};
View
146 src/core/fontwatchrunner.js
@@ -1,40 +1,14 @@
/**
* @constructor
- * @param {function(string, string)} activeCallback
- * @param {function(string, string)} inactiveCallback
- * @param {webfont.DomHelper} domHelper
- * @param {Object.<string, function(Object): number>} fontSizer
* @param {function(function(), number=)} asyncCall
* @param {function(): number} getTime
- * @param {string} fontFamily
- * @param {string} fontDescription
- * @param {string=} opt_fontTestString
+ * @param {Object} strategy
*/
-webfont.FontWatchRunner = function(activeCallback, inactiveCallback, userAgent,
- domHelper, fontSizer, asyncCall, getTime, fontFamily, fontDescription,
- opt_fontTestString) {
- this.activeCallback_ = activeCallback;
- this.inactiveCallback_ = inactiveCallback;
- this.userAgent_ = userAgent;
- this.domHelper_ = domHelper;
- this.fontSizer_ = fontSizer;
+webfont.FontWatchRunner = function(asyncCall, getTime, strategy) {
this.asyncCall_ = asyncCall;
this.getTime_ = getTime;
- this.nameHelper_ = new webfont.CssFontFamilyName();
- this.fvd_ = new webfont.FontVariationDescription();
- this.fontFamily_ = fontFamily;
- this.fontDescription_ = fontDescription;
- this.fontTestString_ = opt_fontTestString || webfont.FontWatchRunner.DEFAULT_TEST_STRING;
- this.webKitLastResortFontSizes_ = (this.userAgent_.getEngine() == "AppleWebKit") ?
- this.setUpWebKitLastResortFontSizes_() : null;
- this.originalSizeA_ = this.getDefaultFontSize_(
- webfont.FontWatchRunner.DEFAULT_FONTS_A);
- this.originalSizeB_ = this.getDefaultFontSize_(
- webfont.FontWatchRunner.DEFAULT_FONTS_B);
- this.requestedFontA_ = this.createHiddenElementWithFont_(
- webfont.FontWatchRunner.DEFAULT_FONTS_A);
- this.requestedFontB_ = this.createHiddenElementWithFont_(
- webfont.FontWatchRunner.DEFAULT_FONTS_B);
+ this.strategy_ = strategy;
+ this.strategy_.setUp();
this.started_ = getTime();
this.check_();
};
@@ -48,7 +22,7 @@ webfont.FontWatchRunner = function(activeCallback, inactiveCallback, userAgent,
* @type {string}
* @const
*/
-webfont.FontWatchRunner.DEFAULT_FONTS_A = "arial,'URW Gothic L',sans-serif";
+webfont.FontWatchRunner.SANS_STACK = "arial,'URW Gothic L',sans-serif";
/**
* A set of serif fonts and a generic family that cover most platforms. We
@@ -61,7 +35,7 @@ webfont.FontWatchRunner.DEFAULT_FONTS_A = "arial,'URW Gothic L',sans-serif";
* @type {string}
* @const
*/
-webfont.FontWatchRunner.DEFAULT_FONTS_B = "Georgia,'Century Schoolbook L',serif";
+webfont.FontWatchRunner.SERIF_STACK = "Georgia,'Century Schoolbook L',serif";
/**
* Default test string. Characters are chosen so that their widths vary a lot
@@ -73,68 +47,13 @@ webfont.FontWatchRunner.DEFAULT_FONTS_B = "Georgia,'Century Schoolbook L',serif"
webfont.FontWatchRunner.DEFAULT_TEST_STRING = 'BESs';
/**
- * While loading a web font webkit applies a last resort fallback font to the
- * element on which the web font is applied.
- * See file: WebKit/Source/WebCore/css/CSSFontFaceSource.cpp.
- * Looking at the different implementation for the different platforms,
- * the last resort fallback font is different. This code uses the default
- * OS/browsers values.
- */
-webfont.FontWatchRunner.prototype.setUpWebKitLastResortFontSizes_ = function() {
- var lastResortFonts = ["'Times New Roman'",
- "'Lucida Sans Unicode'", "'Courier New'", "Tahoma", "Arial",
- "'Microsoft Sans Serif'", "Times", "'Lucida Console'", "Sans", "Serif",
- "Monospace"];
- var lastResortFontSizes = lastResortFonts.length;
- var webKitLastResortFontSizes = {};
- var element = this.createHiddenElementWithFont_(lastResortFonts[0], true);
-
- webKitLastResortFontSizes[this.fontSizer_.getWidth(element)] = true;
- for (var i = 1; i < lastResortFontSizes; i++) {
- var font = lastResortFonts[i];
- this.domHelper_.setStyle(element, this.computeStyleString_(font, true));
- webKitLastResortFontSizes[this.fontSizer_.getWidth(element)] = true;
- }
- this.domHelper_.removeElement(element);
- return webKitLastResortFontSizes;
-};
-
-/**
- * Checks the size of the two spans against their original sizes during each
- * async loop. If the size of one of the spans is different than the original
- * size, then we know that the font is rendering and finish with the active
- * callback. If we wait more than 5 seconds and nothing has changed, we finish
- * with the inactive callback.
- *
- * Because of an odd Webkit quirk, we wait to observe the new width twice
- * in a row before finishing with the active callback. Sometimes, Webkit will
- * render the spans with a changed width for one iteration even though the font
- * is broken. This only happens for one async loop, so waiting for 2 consistent
- * measurements allows us to work around the quirk.
- *
* @private
*/
webfont.FontWatchRunner.prototype.check_ = function() {
- var sizeA = this.fontSizer_.getWidth(this.requestedFontA_);
- var sizeB = this.fontSizer_.getWidth(this.requestedFontB_);
-
- if ((this.originalSizeA_ != sizeA || this.originalSizeB_ != sizeB) &&
- (this.webKitLastResortFontSizes_ == null ||
- (!this.webKitLastResortFontSizes_[sizeA] &&
- !this.webKitLastResortFontSizes_[sizeB]))) {
- this.finish_(this.activeCallback_);
+ if (this.strategy_.isLoaded()) {
+ this.finish_(this.strategy_.getActiveCallback());
} else if (this.getTime_() - this.started_ >= 5000) {
-
- // In order to handle the fact that a font could be the same size as the
- // default browser font on a webkit browser, mark the font as active
- // after 5 seconds if the latest 2 sizes are in webKitLastResortFontSizes_.
- if (this.webKitLastResortFontSizes_
- && this.webKitLastResortFontSizes_[sizeA]
- && this.webKitLastResortFontSizes_[sizeB]) {
- this.finish_(this.activeCallback_);
- } else {
- this.finish_(this.inactiveCallback_);
- }
+ this.finish_(this.strategy_.getTimeoutCallback());
} else {
this.asyncCheck_();
}
@@ -153,50 +72,9 @@ webfont.FontWatchRunner.prototype.asyncCheck_ = function() {
/**
* @private
- * @param {function(string, string)} callback
+ * @param {function()} callback
*/
webfont.FontWatchRunner.prototype.finish_ = function(callback) {
- this.domHelper_.removeElement(this.requestedFontA_);
- this.domHelper_.removeElement(this.requestedFontB_);
- callback(this.fontFamily_, this.fontDescription_);
-};
-
-/**
- * @private
- * @param {string} defaultFonts
- */
-webfont.FontWatchRunner.prototype.getDefaultFontSize_ = function(defaultFonts) {
- var defaultFont = this.createHiddenElementWithFont_(defaultFonts, true);
- var size = this.fontSizer_.getWidth(defaultFont);
-
- this.domHelper_.removeElement(defaultFont);
- return size;
-};
-
-/**
- * @private
- * @param {string} defaultFonts
- * @param {boolean=} opt_withoutFontFamily
- */
-webfont.FontWatchRunner.prototype.createHiddenElementWithFont_ = function(
- defaultFonts, opt_withoutFontFamily) {
- var styleString = this.computeStyleString_(defaultFonts,
- opt_withoutFontFamily);
- var span = this.domHelper_.createElement('span', { 'style': styleString },
- this.fontTestString_);
-
- this.domHelper_.insertInto('body', span);
- return span;
-};
-
-webfont.FontWatchRunner.prototype.computeStyleString_ = function(defaultFonts,
- opt_withoutFontFamily) {
- var variationCss = this.fvd_.expand(this.fontDescription_);
- var styleString = "position:absolute;top:-999px;left:-999px;" +
- "font-size:300px;width:auto;height:auto;line-height:normal;margin:0;" +
- "padding:0;font-variant:normal;font-family:"
- + (opt_withoutFontFamily ? "" :
- this.nameHelper_.quote(this.fontFamily_) + ",")
- + defaultFonts + ";" + variationCss;
- return styleString;
+ this.strategy_.tearDown();
+ callback();
};
View
86 src/core/lastresortwebkitcheckstrategy.js
@@ -0,0 +1,86 @@
+/**
+ * @constructor
+ */
+webfont.LastResortWebKitCheckStrategy = function(sizingElementCreator, activeCallback,
+ inactiveCallback, fontSizer, fontFamily, fontDescription, opt_fontTestString) {
+ this.sizingElementCreator_ = sizingElementCreator;
+ this.activeCallback_ = activeCallback;
+ this.inactiveCallback_ = inactiveCallback;
+ this.fontSizer_ = fontSizer;
+ this.fontFamily_ = fontFamily;
+ this.fontDescription_ = fontDescription;
+ this.fontTestString_ = opt_fontTestString
+ || webfont.FontWatchRunner.DEFAULT_TEST_STRING;
+};
+
+webfont.LastResortWebKitCheckStrategy.prototype.setUp = function() {
+ this.originalSizeA_ = this.getStackSize_(webfont.FontWatchRunner.SANS_STACK);
+ this.originalSizeB_ = this.getStackSize_(webfont.FontWatchRunner.SERIF_STACK);
+ this.webKitLastResortFontSizes_ = this.setUpWebKitLastResortFontSizes_();
+ this.requestedFontA_ = this.sizingElementCreator_.createSizingElement(
+ this.fontFamily_, webfont.FontWatchRunner.SANS_STACK,
+ this.fontDescription_, this.fontTestString_);
+ this.requestedFontB_ = this.sizingElementCreator_.createSizingElement(
+ this.fontFamily_, webfont.FontWatchRunner.SERIF_STACK,
+ this.fontDescription_, this.fontTestString_);
+};
+
+webfont.LastResortWebKitCheckStrategy.prototype.tearDown = function() {
+ this.sizingElementCreator_.deleteSizingElement(this.requestedFontA_);
+ this.sizingElementCreator_.deleteSizingElement(this.requestedFontB_);
+};
+
+webfont.LastResortWebKitCheckStrategy.prototype.isLoaded = function() {
+ var sizeA = this.fontSizer_.getWidth(this.requestedFontA_);
+ var sizeB = this.fontSizer_.getWidth(this.requestedFontB_);
+ return ((this.originalSizeA_ != sizeA || this.originalSizeB_ != sizeB)
+ && (!this.webKitLastResortFontSizes_[sizeA]
+ && !this.webKitLastResortFontSizes_[sizeB]));
+};
+
+webfont.LastResortWebKitCheckStrategy.prototype.getActiveCallback = function() {
+ return webfont.bind(this, function() {
+ this.activeCallback_(this.fontFamily_, this.fontDescription_);
+ });
+};
+
+webfont.LastResortWebKitCheckStrategy.prototype.getTimeoutCallback = function() {
+ return this.getActiveCallback();
+};
+
+webfont.LastResortWebKitCheckStrategy.prototype.getStackSize_ = function(stack) {
+ var stackElement = this.sizingElementCreator_.createSizingElement('',
+ stack, this.fontDescription_, this.fontTestString_);
+ var size = this.fontSizer_.getWidth(stackElement);
+ this.sizingElementCreator_.deleteSizingElement(stackElement);
+ return size;
+};
+
+/**
+ * While loading a web font webkit applies a last resort fallback font to the
+ * element on which the web font is applied.
+ * See file: WebKit/Source/WebCore/css/CSSFontFaceSource.cpp.
+ * Looking at the different implementation for the different platforms,
+ * the last resort fallback font is different. This code uses the default
+ * OS/browsers values.
+ */
+webfont.LastResortWebKitCheckStrategy.prototype.setUpWebKitLastResortFontSizes_ = function() {
+ var lastResortFonts = ["Times New Roman",
+ "Lucida Sans Unicode", "Courier New", "Tahoma", "Arial",
+ "Microsoft Sans Serif", "Times", "Lucida Console", "Sans", "Serif",
+ "Monospace"];
+ var lastResortFontSizes = lastResortFonts.length;
+ var webKitLastResortFontSizes = {};
+ var element = this.sizingElementCreator_.createSizingElement(lastResortFonts[0],
+ '', this.fontDescription_, this.fontTestString_);
+
+ webKitLastResortFontSizes[this.fontSizer_.getWidth(element)] = true;
+ for (var i = 1; i < lastResortFontSizes; i++) {
+ var font = lastResortFonts[i];
+ this.sizingElementCreator_.updateSizingElementStyle(element, font, '',
+ this.fontDescription_);
+ webKitLastResortFontSizes[this.fontSizer_.getWidth(element)] = true;
+ }
+ this.sizingElementCreator_.deleteSizingElement(element);
+ return webKitLastResortFontSizes;
+};
View
49 src/core/sizingelementcreator.js
@@ -0,0 +1,49 @@
+/**
+ * @constructor
+ */
+webfont.SizingElementCreator = function(domHelper) {
+ this.domHelper_ = domHelper;
+ this.fvd_ = new webfont.FontVariationDescription();
+ this.nameHelper_ = new webfont.CssFontFamilyName();
+};
+
+webfont.SizingElementCreator.prototype.createSizingElement = function(
+ fontFamily, fontFamilyStack, fontDescription, fontTestString) {
+ var styleString = this.computeSizingElementStyle_(fontFamily,
+ fontFamilyStack, fontDescription);
+ var span = this.domHelper_.createElement('span', { 'style': styleString },
+ fontTestString);
+
+ this.domHelper_.insertInto('body', span);
+ return span;
+};
+
+webfont.SizingElementCreator.prototype.deleteSizingElement = function(element) {
+ this.domHelper_.removeElement(element);
+};
+
+/**
+ * @return {string} The style string for a sizing element.
+ */
+webfont.SizingElementCreator.prototype.computeSizingElementStyle_ = function(
+ fontFamily, fontFamilyStack, fontDescription) {
+ var variationCss = this.fvd_.expand(fontDescription);
+ var fontFamilyStringBuilder = [];
+ if (fontFamily.length > 0) {
+ fontFamilyStringBuilder.push(this.nameHelper_.quote(fontFamily));
+ }
+ if (fontFamilyStack.length > 0) {
+ fontFamilyStringBuilder.push(fontFamilyStack);
+ }
+ var styleString = "position:absolute;top:-999px;left:-999px;" +
+ "font-size:300px;width:auto;height:auto;line-height:normal;margin:0;" +
+ "padding:0;font-variant:normal;font-family:"
+ + fontFamilyStringBuilder.join(",") + ";" + variationCss;
+ return styleString;
+};
+
+webfont.SizingElementCreator.prototype.updateSizingElementStyle = function(
+ element, fontFamily, fontFamilyStack, fontDescription) {
+ this.domHelper_.setStyle(element, this.computeSizingElementStyle_(fontFamily,
+ fontFamilyStack, fontDescription));
+};
View
7 src/google/googlefontapi.js
@@ -41,6 +41,13 @@ webfont.GoogleFontApi.prototype.insertLink_ = function(onReady) {
fontApiParser.getFontTestStrings());
};
+webfont.GoogleFontApi.prototype.getCheckStrategyCtor = function() {
+ if (this.userAgent_.getEngine() == "AppleWebKit") {
+ return webfont.LastResortWebKitCheckStrategy;
+ }
+ return webfont.DefaultCheckStrategy;
+};
+
window['WebFont'].addModule(webfont.GoogleFontApi.NAME, function(configuration) {
var userAgentParser = new webfont.UserAgentParser(navigator.userAgent, document);
var userAgent = userAgentParser.parse();
View
4 src/modules.yml
@@ -5,6 +5,10 @@ core:
- core/useragentparser.js
- core/eventdispatcher.js
- core/fontmoduleloader.js
+ - core/sizingelementcreator.js
+ - core/defaultcheckstrategy.js
+ - core/lastresortwebkitcheckstrategy.js
+ - core/checkstrategyfactory.js
- core/fontwatcher.js
- core/fontwatchrunner.js
- core/font.js
Please sign in to comment.
Something went wrong with that request. Please try again.