Sha256: d6253ea7621549f114c2d93e0a3086d8785151f108307ad88eaafe4f24eb7ca7

Contents?: true

Size: 1.65 KB

Versions: 18

Compression:

Stored size: 1.65 KB

Contents

goog.provide('webfont.modules.google.GoogleFontApi');

goog.require('webfont.modules.google.FontApiUrlBuilder');
goog.require('webfont.modules.google.FontApiParser');
goog.require('webfont.FontWatchRunner');
goog.require('webfont.StyleSheetWaiter');

/**
 * @constructor
 * @implements {webfont.FontModule}
 */
webfont.modules.google.GoogleFontApi = function(domHelper, configuration) {
  this.domHelper_ = domHelper;
  this.configuration_ = configuration;
};

/**
 * @const
 * @type {string}
 */
webfont.modules.google.GoogleFontApi.NAME = 'google';

goog.scope(function () {
  var GoogleFontApi = webfont.modules.google.GoogleFontApi,
      FontWatchRunner = webfont.FontWatchRunner,
      StyleSheetWaiter = webfont.StyleSheetWaiter,
      FontApiUrlBuilder = webfont.modules.google.FontApiUrlBuilder,
      FontApiParser = webfont.modules.google.FontApiParser;

  GoogleFontApi.METRICS_COMPATIBLE_FONTS = {
    "Arimo": true,
    "Cousine": true,
    "Tinos": true
  };

  GoogleFontApi.prototype.load = function(onReady) {
    var waiter = new StyleSheetWaiter();
    var domHelper = this.domHelper_;
    var fontApiUrlBuilder = new FontApiUrlBuilder(
        this.configuration_['api'],
        this.configuration_['text']
    );
    var fontFamilies = this.configuration_['families'];
    fontApiUrlBuilder.setFontFamilies(fontFamilies);

    var fontApiParser = new FontApiParser(fontFamilies);
    fontApiParser.parse();

    domHelper.loadStylesheet(fontApiUrlBuilder.build(), waiter.startWaitingLoad());
    waiter.waitWhileNeededThen(function() {
      onReady(fontApiParser.getFonts(), fontApiParser.getFontTestStrings(), GoogleFontApi.METRICS_COMPATIBLE_FONTS);
    });
  };
});

Version data entries

18 entries across 18 versions & 3 rubygems

Version Path
jekyll-theme-hydejack-7.5.2 assets/bower_components/webfontloader/src/modules/google/googlefontapi.js
jekyll-theme-hydejack-7.5.1 assets/bower_components/webfontloader/src/modules/google/googlefontapi.js
jekyll-theme-hydejack-7.5.0 assets/bower_components/webfontloader/src/modules/google/googlefontapi.js
jekyll-theme-hydejack-7.4.2 assets/bower_components/webfontloader/src/modules/google/googlefontapi.js
jekyll-theme-hydejack-7.4.1 assets/bower_components/webfontloader/src/modules/google/googlefontapi.js
jekyll-theme-hydejack-7.4.0 assets/bower_components/webfontloader/src/modules/google/googlefontapi.js
jekyll-theme-hydejack-7.3.0 assets/bower_components/webfontloader/src/modules/google/googlefontapi.js
jekyll-theme-hydejack-7.2.0 assets/bower_components/webfontloader/src/modules/google/googlefontapi.js
jekyll-theme-hydejack-7.1.1 assets/bower_components/webfontloader/src/modules/google/googlefontapi.js
jekyll-theme-hydejack-7.1.0 assets/bower_components/webfontloader/src/modules/google/googlefontapi.js
jekyll-theme-hydejack-7.0.1 assets/bower_components/webfontloader/src/modules/google/googlefontapi.js
jekyll-theme-hydejack-7.0.0 assets/bower_components/webfontloader/src/modules/google/googlefontapi.js
jekyll-theme-hydejack-7.0.0.pre.beta.1 assets/bower_components/webfontloader/src/modules/google/googlefontapi.js
jekyll-theme-hydejack-7.0.0.pre.beta.0 assets/bower_components/webfontloader/src/modules/google/googlefontapi.js
jekyll-theme-hydejack-6.6.1 assets/bower_components/webfontloader/src/modules/google/googlefontapi.js
jekyll-theme-hydejack-6.6.0 assets/bower_components/webfontloader/src/modules/google/googlefontapi.js
jekyll-theme-chalk-0.1.1 _assets/yarn/webfontloader/src/modules/google/googlefontapi.js
webfontloader-1.6.28 src/modules/google/googlefontapi.js