webfontloader 1.0.22 → 1.0.24

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/CHANGELOG CHANGED
@@ -1,3 +1,13 @@
1
+ v1.0.24 (January 9, 2012)
2
+ * Updated the standard test string from "BESs" to "BESbswy" for more width variability.
3
+ * Improved Google's custom FontWatchRunner implementation for Webkit to work around an issue where the browser reports the 400 weight's width when it is already loaded.
4
+
5
+ v1.0.23 (November 29, 2011)
6
+ * Made the FontWatchRunner implementation configurable on a module-by-module basis.
7
+ * Added a new .start() method to FontWatchRunner to actually kick off font loading detection.
8
+ * Added a different FontWatchRunner implementation that Google's module uses to work around a Webkit browser bug. This implementation won't trigger active early, but may trigger active much later, so it's not the default for all modules.
9
+ * Updated the implementation of Fontdeck's module to defer loading responsibility to their JS.
10
+
1
11
  v1.0.22 (July 1, 2011)
2
12
  * Fixed a bug in Webkit-based browsers with font detection where active would trigger without the font actually being active yet.
3
13
  * Increased the frequency of checking the widths of the font watcher spans.
@@ -17,7 +17,7 @@
17
17
  }
18
18
  WebFont.load({
19
19
  fontdeck: {
20
- id: '2282'
20
+ id: 2282
21
21
  },
22
22
  loading: function() {
23
23
  progress('loading');
data/lib/webfontloader.rb CHANGED
@@ -3,7 +3,7 @@ require 'yaml'
3
3
  require 'webfontloader/modules'
4
4
 
5
5
  module WebFontLoader
6
- VERSION = '1.0.22'
6
+ VERSION = '1.0.24'
7
7
 
8
8
  ProjectRoot = File.expand_path(File.dirname(__FILE__) + "/..")
9
9
 
@@ -25,9 +25,9 @@ webfont.DomHelper.prototype.createElement = function(elem, opt_attr,
25
25
  for (var attr in opt_attr) {
26
26
  // protect against native prototype augmentations
27
27
  if (opt_attr.hasOwnProperty(attr)) {
28
- if (attr == "style" && this.userAgent_.getName() == "MSIE") {
29
- domElement.style.cssText = opt_attr[attr];
30
- } else {
28
+ if (attr == "style") {
29
+ this.setStyle(domElement, opt_attr[attr]);
30
+ } else {
31
31
  domElement.setAttribute(attr, opt_attr[attr]);
32
32
  }
33
33
  }
@@ -164,3 +164,16 @@ webfont.DomHelper.prototype.hasClassName = function(e, name) {
164
164
  }
165
165
  return false;
166
166
  };
167
+
168
+ /**
169
+ * Sets the style attribute on an element.
170
+ * @param {Element} e The element.
171
+ * @param {string} styleString The style string.
172
+ */
173
+ webfont.DomHelper.prototype.setStyle = function(e, styleString) {
174
+ if (this.userAgent_.getName() == "MSIE") {
175
+ e.style.cssText = styleString;
176
+ } else {
177
+ e.setAttribute("style", styleString);
178
+ }
179
+ };
data/src/core/font.js CHANGED
@@ -29,6 +29,8 @@ webfont.WebFont.prototype.load = function(configuration) {
29
29
 
30
30
  webfont.WebFont.prototype.isModuleSupportingUserAgent_ = function(module, eventDispatcher,
31
31
  fontWatcher, support) {
32
+ var fontWatchRunnerCtor = module.getFontWatchRunnerCtor ?
33
+ module.getFontWatchRunnerCtor() : webfont.FontWatchRunner;
32
34
  if (!support) {
33
35
  var allModulesLoaded = --this.moduleLoading_ == 0;
34
36
 
@@ -40,26 +42,27 @@ webfont.WebFont.prototype.isModuleSupportingUserAgent_ = function(module, eventD
40
42
  eventDispatcher.dispatchLoading();
41
43
  }
42
44
  }
43
- fontWatcher.watch([], {}, {}, allModulesLoaded);
45
+ fontWatcher.watch([], {}, {}, fontWatchRunnerCtor, allModulesLoaded);
44
46
  return;
45
47
  }
46
48
  module.load(webfont.bind(this, this.onModuleReady_, eventDispatcher,
47
- fontWatcher));
49
+ fontWatcher, fontWatchRunnerCtor));
48
50
  };
49
51
 
50
52
  webfont.WebFont.prototype.onModuleReady_ = function(eventDispatcher, fontWatcher,
51
- fontFamilies, opt_fontDescriptions, opt_fontTestStrings) {
53
+ fontWatchRunnerCtor, fontFamilies, opt_fontDescriptions, opt_fontTestStrings) {
52
54
  var allModulesLoaded = --this.moduleLoading_ == 0;
53
55
 
54
56
  if (allModulesLoaded) {
55
57
  eventDispatcher.dispatchLoading();
56
58
  }
57
59
  this.asyncCall_(webfont.bind(this, function(_fontWatcher, _fontFamilies,
58
- _fontDescriptions, _fontTestStrings, _allModulesLoaded) {
59
- _fontWatcher.watch(_fontFamilies, _fontDescriptions || {},
60
- _fontTestStrings || {}, _allModulesLoaded);
61
- }, fontWatcher, fontFamilies, opt_fontDescriptions, opt_fontTestStrings,
62
- allModulesLoaded));
60
+ _fontDescriptions, _fontTestStrings, _fontWatchRunnerCtor,
61
+ _allModulesLoaded) {
62
+ _fontWatcher.watch(_fontFamilies, _fontDescriptions || {},
63
+ _fontTestStrings || {}, _fontWatchRunnerCtor, _allModulesLoaded);
64
+ }, fontWatcher, fontFamilies, opt_fontDescriptions, opt_fontTestStrings,
65
+ fontWatchRunnerCtor, allModulesLoaded));
63
66
  };
64
67
 
65
68
  webfont.WebFont.prototype.load_ = function(eventDispatcher, configuration) {
@@ -34,7 +34,7 @@ webfont.FontWatcher.DEFAULT_VARIATION = 'n4';
34
34
  * @param {boolean} last True if this is the last set of families to watch.
35
35
  */
36
36
  webfont.FontWatcher.prototype.watch = function(fontFamilies, fontDescriptions,
37
- fontTestStrings, last) {
37
+ fontTestStrings, fontWatchRunnerCtor, last) {
38
38
  var length = fontFamilies.length;
39
39
 
40
40
  for (var i = 0; i < length; i++) {
@@ -61,9 +61,11 @@ webfont.FontWatcher.prototype.watch = function(fontFamilies, fontDescriptions,
61
61
 
62
62
  var activeCallback = webfont.bind(this, this.fontActive_);
63
63
  var inactiveCallback = webfont.bind(this, this.fontInactive_)
64
- new webfont.FontWatchRunner(activeCallback, inactiveCallback,
65
- this.domHelper_, this.fontSizer_, this.asyncCall_, this.getTime_,
66
- fontFamily, fontDescription, fontTestString);
64
+ var fontWatchRunner = new fontWatchRunnerCtor(activeCallback,
65
+ inactiveCallback, this.domHelper_, this.fontSizer_, this.asyncCall_,
66
+ this.getTime_, fontFamily, fontDescription, fontTestString);
67
+
68
+ fontWatchRunner.start();
67
69
  }
68
70
  }
69
71
  };
@@ -33,8 +33,6 @@ webfont.FontWatchRunner = function(activeCallback, inactiveCallback, domHelper,
33
33
  webfont.FontWatchRunner.DEFAULT_FONTS_A);
34
34
  this.requestedFontB_ = this.createHiddenElementWithFont_(
35
35
  webfont.FontWatchRunner.DEFAULT_FONTS_B);
36
- this.started_ = getTime();
37
- this.check_();
38
36
  };
39
37
 
40
38
  /**
@@ -68,7 +66,12 @@ webfont.FontWatchRunner.DEFAULT_FONTS_B = "Georgia,'Century Schoolbook L',serif"
68
66
  * @type {string}
69
67
  * @const
70
68
  */
71
- webfont.FontWatchRunner.DEFAULT_TEST_STRING = 'BESs';
69
+ webfont.FontWatchRunner.DEFAULT_TEST_STRING = 'BESbswy';
70
+
71
+ webfont.FontWatchRunner.prototype.start = function() {
72
+ this.started_ = this.getTime_();
73
+ this.check_();
74
+ };
72
75
 
73
76
  /**
74
77
  * Checks the size of the two spans against their original sizes during each
@@ -141,15 +144,23 @@ webfont.FontWatchRunner.prototype.getDefaultFontSize_ = function(defaultFonts) {
141
144
  */
142
145
  webfont.FontWatchRunner.prototype.createHiddenElementWithFont_ = function(
143
146
  defaultFonts, opt_withoutFontFamily) {
144
- var variationCss = this.fvd_.expand(this.fontDescription_);
145
- var styleString = "position:absolute;top:-999px;left:-999px;" +
146
- "font-size:300px;width:auto;height:auto;line-height:normal;margin:0;" +
147
- "padding:0;font-variant:normal;font-family:" + (opt_withoutFontFamily ? "" :
148
- this.nameHelper_.quote(this.fontFamily_) + ",") +
149
- defaultFonts + ";" + variationCss;
147
+ var styleString = this.computeStyleString_(defaultFonts,
148
+ this.fontDescription_, opt_withoutFontFamily);
150
149
  var span = this.domHelper_.createElement('span', { 'style': styleString },
151
150
  this.fontTestString_);
152
151
 
153
152
  this.domHelper_.insertInto('body', span);
154
153
  return span;
155
154
  };
155
+
156
+ webfont.FontWatchRunner.prototype.computeStyleString_ = function(defaultFonts,
157
+ fontDescription, opt_withoutFontFamily) {
158
+ var variationCss = this.fvd_.expand(fontDescription);
159
+ var styleString = "position:absolute;top:-999px;left:-999px;" +
160
+ "font-size:300px;width:auto;height:auto;line-height:normal;margin:0;" +
161
+ "padding:0;font-variant:normal;font-family:"
162
+ + (opt_withoutFontFamily ? "" :
163
+ this.nameHelper_.quote(this.fontFamily_) + ",")
164
+ + defaultFonts + ";" + variationCss;
165
+ return styleString;
166
+ };
@@ -14,3 +14,17 @@ webfont.bind = function(context, func, opt_args) {
14
14
  return func.apply(context, args);
15
15
  };
16
16
  };
17
+
18
+ webfont.extendsClass = function(baseClass, subClass) {
19
+
20
+ // Avoid polluting the baseClass prototype object with methods from the
21
+ // subClass
22
+ /** @constructor */
23
+ function baseExtendClass() {};
24
+ baseExtendClass.prototype = baseClass.prototype;
25
+ subClass.prototype = new baseExtendClass();
26
+
27
+ subClass.prototype.constructor = subClass;
28
+ subClass.superCtor_ = baseClass;
29
+ subClass.super_ = baseClass.prototype;
30
+ };
@@ -12,16 +12,16 @@ webfont.FontdeckScript = function(global, domHelper, configuration) {
12
12
 
13
13
  webfont.FontdeckScript.NAME = 'fontdeck';
14
14
  webfont.FontdeckScript.HOOK = '__webfontfontdeckmodule__';
15
- webfont.FontdeckScript.API = 'http://fontdeck.com/api/v1/project-info?'
15
+ webfont.FontdeckScript.API = '//f.fontdeck.com/s/css/js/';
16
16
 
17
17
  webfont.FontdeckScript.prototype.getScriptSrc = function(projectId) {
18
+ var protocol = 'https:' == this.global_.location.protocol ? 'https:' : 'http:';
18
19
  var api = this.configuration_['api'] || webfont.FontdeckScript.API;
19
- return api + 'project=' + projectId + '&domain=' + document.location.hostname + '&callback=window.__webfontfontdeckmodule__[' + projectId + ']';
20
+ return protocol + api + this.global_.document.location.hostname + '/' + projectId + '.js';
20
21
  };
21
22
 
22
23
  webfont.FontdeckScript.prototype.supportUserAgent = function(userAgent, support) {
23
24
  var projectId = this.configuration_['id'];
24
- var families = this.configuration_['families'] || null;
25
25
  var self = this;
26
26
 
27
27
  if (projectId) {
@@ -30,20 +30,16 @@ webfont.FontdeckScript.prototype.supportUserAgent = function(userAgent, support)
30
30
  this.global_[webfont.FontdeckScript.HOOK] = {};
31
31
  }
32
32
 
33
- // The API will call this function with a link to the CSS
34
- // and a list of supported fonts.
35
- this.global_[webfont.FontdeckScript.HOOK][projectId] = function(data) {
36
- self.domHelper_.insertInto('head', self.domHelper_.createCssLink(data['css']));
37
- for (var i = 0, j = data['provides'].length; i < j; ++i) {
38
- var font = data['provides'][i];
39
- self.fontFamilies_.push(font['name']);
40
- self.fontVariations_[font['name']] = [self.fvd_.compact("font-weight:" + font['weight'] + ";font-style:" + font['style'])];
41
- }
42
- // If families were passed into load, then use them instead.
43
- if (families !== null) {
44
- self.fontFamilies_ = families;
45
- }
46
- support(true);
33
+ // Fontdeck will call this function to indicate support status
34
+ // and what fonts are provided.
35
+ this.global_[webfont.FontdeckScript.HOOK][projectId] = function(fontdeckSupports, data) {
36
+ for (var i = 0, j = data['fonts'].length; i<j; ++i) {
37
+ var font = data['fonts'][i];
38
+ // Add the FVDs
39
+ self.fontFamilies_.push(font['name']);
40
+ self.fontVariations_[font['name']] = [self.fvd_.compact("font-weight:" + font['weight'] + ";font-style:" + font['style'])];
41
+ }
42
+ support(fontdeckSupports);
47
43
  };
48
44
 
49
45
  // Call the Fontdeck API.
@@ -13,6 +13,13 @@ webfont.GoogleFontApi.prototype.supportUserAgent = function(userAgent, support)
13
13
  support(userAgent.isSupportingWebFont());
14
14
  };
15
15
 
16
+ webfont.GoogleFontApi.prototype.getFontWatchRunnerCtor = function() {
17
+ if (this.userAgent_.getEngine() == "AppleWebKit") {
18
+ return webfont.LastResortWebKitFontWatchRunner;
19
+ }
20
+ return webfont.FontWatchRunner;
21
+ };
22
+
16
23
  webfont.GoogleFontApi.prototype.load = function(onReady) {
17
24
  var domHelper = this.domHelper_;
18
25
  var nonBlockingIe = this.userAgent_.getName() == 'MSIE' &&
@@ -0,0 +1,89 @@
1
+ /**
2
+ * @constructor
3
+ */
4
+ webfont.LastResortWebKitFontWatchRunner = function(activeCallback,
5
+ inactiveCallback, domHelper, fontSizer, asyncCall, getTime, fontFamily,
6
+ fontDescription, opt_fontTestString) {
7
+ webfont.LastResortWebKitFontWatchRunner.superCtor_.call(this,
8
+ activeCallback, inactiveCallback, domHelper, fontSizer, asyncCall,
9
+ getTime, fontFamily, fontDescription, opt_fontTestString);
10
+ this.webKitLastResortFontSizes_ = this.setUpWebKitLastResortFontSizes_();
11
+ this.webKitLastResortSizeChange_ = false;
12
+ };
13
+ webfont.extendsClass(webfont.FontWatchRunner, webfont.LastResortWebKitFontWatchRunner);
14
+
15
+ webfont.LastResortWebKitFontWatchRunner.METRICS_COMPATIBLE_FONTS = {
16
+ "Arimo": true,
17
+ "Cousine": true,
18
+ "Tinos": true
19
+ };
20
+
21
+ /**
22
+ * While loading a web font webkit applies a last resort fallback font to the
23
+ * element on which the web font is applied.
24
+ * See file: WebKit/Source/WebCore/css/CSSFontFaceSource.cpp.
25
+ * Looking at the different implementation for the different platforms,
26
+ * the last resort fallback font is different. This code uses the default
27
+ * OS/browsers values.
28
+ */
29
+ webfont.LastResortWebKitFontWatchRunner.prototype
30
+ .setUpWebKitLastResortFontSizes_ = function() {
31
+ var lastResortFonts = ["Times New Roman",
32
+ "Lucida Sans Unicode", "Courier New", "Tahoma", "Arial",
33
+ "Microsoft Sans Serif", "Times", "Lucida Console", "Sans", "Serif",
34
+ "Monospace"];
35
+ var lastResortFontSizes = lastResortFonts.length;
36
+ var webKitLastResortFontSizes = {};
37
+ var element = this.createHiddenElementWithFont_(lastResortFonts[0], true);
38
+
39
+ webKitLastResortFontSizes[this.fontSizer_.getWidth(element)] = true;
40
+ for (var i = 1; i < lastResortFontSizes; i++) {
41
+ var font = lastResortFonts[i];
42
+ this.domHelper_.setStyle(element, this.computeStyleString_(font,
43
+ this.fontDescription_, true));
44
+ webKitLastResortFontSizes[this.fontSizer_.getWidth(element)] = true;
45
+
46
+ // Another WebKit quirk if the normal weight/style is loaded first,
47
+ // the size of the normal weight is returned when loading another weight.
48
+ if (this.fontDescription_[1] != '4') {
49
+ this.domHelper_.setStyle(element, this.computeStyleString_(font,
50
+ this.fontDescription_[0] + '4', true));
51
+ webKitLastResortFontSizes[this.fontSizer_.getWidth(element)] = true;
52
+ }
53
+ }
54
+ this.domHelper_.removeElement(element);
55
+ return webKitLastResortFontSizes;
56
+ };
57
+
58
+ webfont.LastResortWebKitFontWatchRunner.prototype.check_ = function() {
59
+ var sizeA = this.fontSizer_.getWidth(this.requestedFontA_);
60
+ var sizeB = this.fontSizer_.getWidth(this.requestedFontB_);
61
+
62
+ if (!this.webKitLastResortSizeChange_ && sizeA == sizeB &&
63
+ this.webKitLastResortFontSizes_[sizeA]) {
64
+ this.webKitLastResortFontSizes_ = {};
65
+ this.webKitLastResortFontSizes_[sizeA] = true;
66
+ this.webKitLastResortSizeChange_ = true;
67
+ }
68
+ if ((this.originalSizeA_ != sizeA || this.originalSizeB_ != sizeB) &&
69
+ (!this.webKitLastResortFontSizes_[sizeA] &&
70
+ !this.webKitLastResortFontSizes_[sizeB])) {
71
+ this.finish_(this.activeCallback_);
72
+ } else if (this.getTime_() - this.started_ >= 5000) {
73
+
74
+ // In order to handle the fact that a font could be the same size as the
75
+ // default browser font on a webkit browser, mark the font as active
76
+ // after 5 seconds if the latest 2 sizes are in webKitLastResortFontSizes_
77
+ // and the font name is known to be metrics compatible.
78
+ if (this.webKitLastResortFontSizes_[sizeA]
79
+ && this.webKitLastResortFontSizes_[sizeB] &&
80
+ webfont.LastResortWebKitFontWatchRunner.METRICS_COMPATIBLE_FONTS[
81
+ this.fontFamily_]) {
82
+ this.finish_(this.activeCallback_);
83
+ } else {
84
+ this.finish_(this.inactiveCallback_);
85
+ }
86
+ } else {
87
+ this.asyncCheck_();
88
+ }
89
+ };
data/src/modules.yml CHANGED
@@ -17,6 +17,7 @@ ascender:
17
17
  - ascender/ascender_script.js
18
18
 
19
19
  google:
20
+ - google/lastresortwebkitfontwatchrunner.js
20
21
  - google/fontapiurlbuilder.js
21
22
  - google/fontapiparser.js
22
23
  - google/googlefontapi.js
@@ -60,15 +60,19 @@ FontWatcherTest.prototype.setUp = function() {
60
60
  self.testStringCount_++;
61
61
  self.testStrings_[fontFamily] = opt_fontTestString;
62
62
  }
63
+ this.activeCallback_ = activeCallback;
64
+ this.inactiveCallback_ = inactiveCallback;
65
+ this.fontFamily_ = fontFamily;
66
+ this.fontDescription_ = fontDescription;
67
+ };
63
68
 
64
- if (self.fontWatchRunnerActiveFamilies_.indexOf(fontFamily) > -1) {
65
- activeCallback(fontFamily, fontDescription);
69
+ webfont.FontWatchRunner.prototype.start = function() {
70
+ if (self.fontWatchRunnerActiveFamilies_.indexOf(this.fontFamily_) > -1) {
71
+ this.activeCallback_(this.fontFamily_, this.fontDescription_);
66
72
  } else {
67
- inactiveCallback(fontFamily, fontDescription);
73
+ this.inactiveCallback_(this.fontFamily_, this.fontDescription_);
68
74
  }
69
-
70
75
  };
71
-
72
76
  };
73
77
 
74
78
  FontWatcherTest.prototype.tearDown = function() {
@@ -83,7 +87,7 @@ FontWatcherTest.prototype.testWatchOneFontNotLast = function() {
83
87
  var fontWatcher = new webfont.FontWatcher(this.fakeDomHelper_, this.fakeEventDispatcher_,
84
88
  this.fakeFontSizer_, this.fakeAsyncCall_, this.fakeGetTime_);
85
89
 
86
- fontWatcher.watch(fontFamilies, {}, {}, false);
90
+ fontWatcher.watch(fontFamilies, {}, {}, webfont.FontWatchRunner, false);
87
91
 
88
92
  assertEquals(0, this.fontInactiveEventCalled_);
89
93
  assertEquals(0, this.activeEventCalled_);
@@ -97,7 +101,7 @@ FontWatcherTest.prototype.testWatchOneFontActive = function() {
97
101
  var fontWatcher = new webfont.FontWatcher(this.fakeDomHelper_, this.fakeEventDispatcher_,
98
102
  this.fakeFontSizer_, this.fakeAsyncCall_, this.fakeGetTime_);
99
103
 
100
- fontWatcher.watch(fontFamilies, {}, {}, true);
104
+ fontWatcher.watch(fontFamilies, {}, {}, webfont.FontWatchRunner, true);
101
105
 
102
106
  assertEquals(1, this.fontLoadingEventCalled_);
103
107
  assertEquals(true, this.fontLoading_['fontFamily1 n4']);
@@ -115,7 +119,7 @@ FontWatcherTest.prototype.testWatchOneFontInactive = function() {
115
119
  var fontWatcher = new webfont.FontWatcher(this.fakeDomHelper_, this.fakeEventDispatcher_,
116
120
  this.fakeFontSizer_, this.fakeAsyncCall_, this.fakeGetTime_);
117
121
 
118
- fontWatcher.watch(fontFamilies, {}, {}, true);
122
+ fontWatcher.watch(fontFamilies, {}, {}, webfont.FontWatchRunner, true);
119
123
 
120
124
  assertEquals(1, this.fontLoadingEventCalled_);
121
125
  assertEquals(true, this.fontLoading_['fontFamily1 n4']);
@@ -133,7 +137,7 @@ FontWatcherTest.prototype.testWatchMultipleFontsActive = function() {
133
137
  var fontWatcher = new webfont.FontWatcher(this.fakeDomHelper_, this.fakeEventDispatcher_,
134
138
  this.fakeFontSizer_, this.fakeAsyncCall_, this.fakeGetTime_);
135
139
 
136
- fontWatcher.watch(fontFamilies, {}, {}, true);
140
+ fontWatcher.watch(fontFamilies, {}, {}, webfont.FontWatchRunner, true);
137
141
 
138
142
  assertEquals(3, this.fontLoadingEventCalled_);
139
143
  assertEquals(true, this.fontLoading_['fontFamily1 n4']);
@@ -155,7 +159,7 @@ FontWatcherTest.prototype.testWatchMultipleFontsInactive = function() {
155
159
  var fontWatcher = new webfont.FontWatcher(this.fakeDomHelper_, this.fakeEventDispatcher_,
156
160
  this.fakeFontSizer_, this.fakeAsyncCall_, this.fakeGetTime_);
157
161
 
158
- fontWatcher.watch(fontFamilies, {}, {}, true);
162
+ fontWatcher.watch(fontFamilies, {}, {}, webfont.FontWatchRunner, true);
159
163
 
160
164
  assertEquals(3, this.fontLoadingEventCalled_);
161
165
  assertEquals(true, this.fontLoading_['fontFamily1 n4']);
@@ -177,7 +181,7 @@ FontWatcherTest.prototype.testWatchMultipleFontsMixed = function() {
177
181
  var fontWatcher = new webfont.FontWatcher(this.fakeDomHelper_, this.fakeEventDispatcher_,
178
182
  this.fakeFontSizer_, this.fakeAsyncCall_, this.fakeGetTime_);
179
183
 
180
- fontWatcher.watch(fontFamilies, {}, {}, true);
184
+ fontWatcher.watch(fontFamilies, {}, {}, webfont.FontWatchRunner, true);
181
185
 
182
186
  assertEquals(3, this.fontLoadingEventCalled_);
183
187
  assertEquals(true, this.fontLoading_['fontFamily1 n4']);
@@ -205,7 +209,7 @@ FontWatcherTest.prototype.testWatchMultipleFontsWithDescriptions = function() {
205
209
  var fontWatcher = new webfont.FontWatcher(this.fakeDomHelper_, this.fakeEventDispatcher_,
206
210
  this.fakeFontSizer_, this.fakeAsyncCall_, this.fakeGetTime_);
207
211
 
208
- fontWatcher.watch(fontFamilies, fontDescriptions, {}, true);
212
+ fontWatcher.watch(fontFamilies, fontDescriptions, {}, webfont.FontWatchRunner, true);
209
213
 
210
214
  assertEquals(5, this.fontLoadingEventCalled_);
211
215
  assertEquals(true, this.fontLoading_['fontFamily1 i7']);
@@ -238,7 +242,8 @@ FontWatcherTest.prototype.testWatchMultipleFontsWithTestStrings = function() {
238
242
  var fontWatcher = new webfont.FontWatcher(this.fakeDomHelper_, this.fakeEventDispatcher_,
239
243
  this.fakeFontSizer_, this.fakeAsyncCall_, this.fakeGetTime_);
240
244
 
241
- fontWatcher.watch(fontFamilies, {}, fontTestStrings, true);
245
+ fontWatcher.watch(fontFamilies, {}, fontTestStrings, webfont.FontWatchRunner,
246
+ true);
242
247
 
243
248
  assertEquals(2, this.testStringCount_);
244
249
  assertEquals('testString1', this.testStrings_['fontFamily1']);
@@ -92,9 +92,12 @@ FontWatchRunnerTest.prototype.testWatchFontAlreadyLoaded = function() {
92
92
  this.timesToReportChangedWidth_ = 2;
93
93
  this.timesToGetTimeBeforeTimeout_ = 10;
94
94
 
95
- new webfont.FontWatchRunner(this.activeCallback_, this.inactiveCallback_,
96
- this.fakeDomHelper_, this.fakeFontSizer_, this.fakeAsyncCall_,
97
- this.fakeGetTime_, this.fontFamily_, this.fontDescription_);
95
+ var fontWatchRunner = new webfont.FontWatchRunner(this.activeCallback_,
96
+ this.inactiveCallback_, this.fakeDomHelper_, this.fakeFontSizer_,
97
+ this.fakeAsyncCall_, this.fakeGetTime_, this.fontFamily_,
98
+ this.fontDescription_);
99
+
100
+ fontWatchRunner.start();
98
101
 
99
102
  assertEquals(1, this.asyncCount_);
100
103
 
@@ -108,9 +111,12 @@ FontWatchRunnerTest.prototype.testWatchFontWaitForLoadActive = function() {
108
111
  this.timesToReportChangedWidth_ = 2;
109
112
  this.timesToGetTimeBeforeTimeout_ = 10;
110
113
 
111
- new webfont.FontWatchRunner(this.activeCallback_, this.inactiveCallback_,
112
- this.fakeDomHelper_, this.fakeFontSizer_, this.fakeAsyncCall_,
113
- this.fakeGetTime_, this.fontFamily_, this.fontDescription_);
114
+ var fontWatchRunner = new webfont.FontWatchRunner(this.activeCallback_,
115
+ this.inactiveCallback_, this.fakeDomHelper_, this.fakeFontSizer_,
116
+ this.fakeAsyncCall_, this.fakeGetTime_, this.fontFamily_,
117
+ this.fontDescription_);
118
+
119
+ fontWatchRunner.start();
114
120
 
115
121
  assertEquals(4, this.asyncCount_);
116
122
 
@@ -124,9 +130,12 @@ FontWatchRunnerTest.prototype.testWatchFontWaitForLoadInactive = function() {
124
130
  this.timesToReportChangedWidth_ = 2;
125
131
  this.timesToGetTimeBeforeTimeout_ = 5;
126
132
 
127
- new webfont.FontWatchRunner(this.activeCallback_, this.inactiveCallback_,
128
- this.fakeDomHelper_, this.fakeFontSizer_, this.fakeAsyncCall_,
129
- this.fakeGetTime_, this.fontFamily_, this.fontDescription_);
133
+ var fontWatchRunner = new webfont.FontWatchRunner(this.activeCallback_,
134
+ this.inactiveCallback_, this.fakeDomHelper_, this.fakeFontSizer_,
135
+ this.fakeAsyncCall_, this.fakeGetTime_, this.fontFamily_,
136
+ this.fontDescription_);
137
+
138
+ fontWatchRunner.start();
130
139
 
131
140
  assertEquals(4, this.asyncCount_);
132
141
 
@@ -148,9 +157,12 @@ FontWatchRunnerTest.prototype.testWatchFontWithInconsistentWidthIsStillInactive
148
157
  this.timesToReportChangedWidth_ = 1;
149
158
  this.timesToGetTimeBeforeTimeout_ = 10;
150
159
 
151
- new webfont.FontWatchRunner(this.activeCallback_, this.inactiveCallback_,
152
- this.fakeDomHelper_, this.fakeFontSizer_, this.fakeAsyncCall_,
153
- this.fakeGetTime_, this.fontFamily_, this.fontDescription_);
160
+ var fontWatchRunner = new webfont.FontWatchRunner(this.activeCallback_,
161
+ this.inactiveCallback_, this.fakeDomHelper_, this.fakeFontSizer_,
162
+ this.fakeAsyncCall_, this.fakeGetTime_, this.fontFamily_,
163
+ this.fontDescription_);
164
+
165
+ fontWatchRunner.start();
154
166
 
155
167
  assertEquals(9, this.asyncCount_);
156
168
 
@@ -164,30 +176,32 @@ FontWatchRunnerTest.prototype.testDomWithDefaultTestString = function() {
164
176
  this.timesToReportChangedWidth_ = 2;
165
177
  this.timesToGetTimeBeforeTimeout_ = 10;
166
178
 
167
- new webfont.FontWatchRunner(this.activeCallback_, this.inactiveCallback_,
168
- this.fakeDomHelper_, this.fakeFontSizer_, this.fakeAsyncCall_,
169
- this.fakeGetTime_, this.fontFamily_, this.fontDescription_);
179
+ var fontWatchRunner = new webfont.FontWatchRunner(this.activeCallback_,
180
+ this.inactiveCallback_, this.fakeDomHelper_, this.fakeFontSizer_,
181
+ this.fakeAsyncCall_, this.fakeGetTime_, this.fontFamily_,
182
+ this.fontDescription_);
183
+
184
+ fontWatchRunner.start();
170
185
 
171
186
  assertEquals(4, this.createElementCalled_);
172
187
  assertEquals('span', this.createdElements_[0]['name']);
173
188
  assertEquals(-1, this.createdElements_[0]['attrs']['style'].indexOf('fontFamily1'));
174
189
  assertNotEquals(-1, this.createdElements_[0]['attrs']['style'].indexOf(webfont.FontWatchRunner.DEFAULT_FONTS_A));
175
- assertEquals('BESs', this.createdElements_[0]['innerHtml']);
190
+ assertEquals('BESbswy', this.createdElements_[0]['innerHtml']);
176
191
  assertEquals('span', this.createdElements_[1]['name']);
177
192
  assertEquals(-1, this.createdElements_[1]['attrs']['style'].indexOf('fontFamily1'));
178
193
  assertNotEquals(-1, this.createdElements_[1]['attrs']['style'].indexOf(webfont.FontWatchRunner.DEFAULT_FONTS_B));
179
- assertEquals('BESs', this.createdElements_[1]['innerHtml']);
194
+ assertEquals('BESbswy', this.createdElements_[1]['innerHtml']);
180
195
  assertEquals('span', this.createdElements_[2]['name']);
181
196
  assertNotEquals(-1, this.createdElements_[2]['attrs']['style'].indexOf('fontFamily1'));
182
197
  assertNotEquals(-1, this.createdElements_[2]['attrs']['style'].indexOf(webfont.FontWatchRunner.DEFAULT_FONTS_A));
183
- assertEquals('BESs', this.createdElements_[2]['innerHtml']);
198
+ assertEquals('BESbswy', this.createdElements_[2]['innerHtml']);
184
199
  assertEquals('span', this.createdElements_[3]['name']);
185
200
  assertNotEquals(-1, this.createdElements_[3]['attrs']['style'].indexOf('fontFamily1'));
186
201
  assertNotEquals(-1, this.createdElements_[3]['attrs']['style'].indexOf(webfont.FontWatchRunner.DEFAULT_FONTS_B));
187
- assertEquals('BESs', this.createdElements_[3]['innerHtml']);
202
+ assertEquals('BESbswy', this.createdElements_[3]['innerHtml']);
188
203
  assertEquals(4, this.insertIntoCalled_);
189
204
  assertEquals(4, this.removeElementCalled_);
190
-
191
205
  };
192
206
 
193
207
  FontWatchRunnerTest.prototype.testDomWithNotDefaultTestString = function() {
@@ -195,9 +209,12 @@ FontWatchRunnerTest.prototype.testDomWithNotDefaultTestString = function() {
195
209
  this.timesToReportChangedWidth_ = 2;
196
210
  this.timesToGetTimeBeforeTimeout_ = 10;
197
211
 
198
- new webfont.FontWatchRunner(this.activeCallback_, this.inactiveCallback_,
199
- this.fakeDomHelper_, this.fakeFontSizer_, this.fakeAsyncCall_,
200
- this.fakeGetTime_, this.fontFamily_, this.fontDescription_, 'testString');
212
+ var fontWatchRunner = new webfont.FontWatchRunner(this.activeCallback_,
213
+ this.inactiveCallback_, this.fakeDomHelper_, this.fakeFontSizer_,
214
+ this.fakeAsyncCall_, this.fakeGetTime_, this.fontFamily_,
215
+ this.fontDescription_, 'testString');
216
+
217
+ fontWatchRunner.start();
201
218
 
202
219
  assertEquals(4, this.createElementCalled_);
203
220
  assertEquals('span', this.createdElements_[0]['name']);
@@ -5,10 +5,39 @@ FontdeckScriptTest.prototype.testSupportAndLoadLifecycle = function() {
5
5
  'id': '2282'
6
6
  };
7
7
  var apiResponse = {
8
- 'css':'http://fontdeck.com/s/css/uH5+KWQnibDTJRYggGJ9XZLTAgw/webfontloader/2282.css',
9
- 'provides':[
10
- {'font_size_adjust':null,'weight':'normal','style':'normal','name':'Fertigo Pro Regular'},
11
- {'font_size_adjust':'0.5','weight':'bold','style':'italic','name':'Bodoni Display Bold Italic'}
8
+ "domain" : "localhost",
9
+ "cssurl" : "http://f.fontdeck.com/s/css/03BmCXiV2AHwX/Rp+OBFTfD2oFs/localhost/2282.css",
10
+ "project" : 2282,
11
+ "cssbase" : "http://f.fontdeck.com/s/css/03BmCXiV2AHwX/Rp+OBFTfD2oFs",
12
+ "fonts" : [
13
+ {
14
+ "font_family" : "'Fertigo Pro Regular', Fertigo, Constantia, Palatino, serif",
15
+ "font_size_adjust" : 0.508,
16
+ "name" : "Fertigo Pro Regular",
17
+ "style" : "normal",
18
+ "weight" : "normal",
19
+ "font_urls" : {
20
+ "eot" : "http://f.fontdeck.com/f/1/SUlFR0tid0kAA2vb11Ly/IGWDK+wV8TMAfV0J1Ej1J1GFRT1bssqrn6a.eot",
21
+ "ttf" : "http://f.fontdeck.com/f/1/SUlFR0tid0kAA2vb11Ly/IGWDK+wV8TMAfV0J1Ej1J1GFRT1bssqrn6a.ttf",
22
+ "woff" : "http://f.fontdeck.com/f/1/SUlFR0tid0kAA2vb11Ly/IGWDK+wV8TMAfV0J1Ej1J1GFRT1bssqrn6a.woff",
23
+ "svg" : "http://f.fontdeck.com/f/1/SUlFR0tid0kAA2vb11Ly/IGWDK+wV8TMAfV0J1Ej1J1GFRT1bssqrn6a.svg#104"
24
+ },
25
+ "id" : 104
26
+ },
27
+ {
28
+ "font_family" : "'Bodoni Display Bold Italic', Georgia, 'Times New Roman', Times, serif",
29
+ "font_size_adjust" : 0.45,
30
+ "name" : "Bodoni Display Bold Italic",
31
+ "style" : "italic",
32
+ "weight" : "bold",
33
+ "font_urls" : {
34
+ "eot" : "http://f.fontdeck.com/f/1/azJEbTVyc1QAA11+CAE5C93+l/bAQx1ipRo6Maba19w3Yy5ng+qVWlfj.eot",
35
+ "ttf" : "http://f.fontdeck.com/f/1/azJEbTVyc1QAA11+CAE5C93+l/bAQx1ipRo6Maba19w3Yy5ng+qVWlfj.ttf",
36
+ "woff" : "http://f.fontdeck.com/f/1/azJEbTVyc1QAA11+CAE5C93+l/bAQx1ipRo6Maba19w3Yy5ng+qVWlfj.woff",
37
+ "svg" : "http://f.fontdeck.com/f/1/azJEbTVyc1QAA11+CAE5C93+l/bAQx1ipRo6Maba19w3Yy5ng+qVWlfj.svg#2256"
38
+ },
39
+ "id" : 2256
40
+ }
12
41
  ]
13
42
  };
14
43
  var insert = '';
@@ -19,13 +48,18 @@ FontdeckScriptTest.prototype.testSupportAndLoadLifecycle = function() {
19
48
  },
20
49
  createScriptSrc: function(srcLink) {
21
50
  src = srcLink;
51
+ }
52
+ };
53
+ var global = {
54
+ location: {
55
+ protocol: 'https:'
22
56
  },
23
- createCssLink: function(cssLink) {
24
- css = cssLink;
25
- return '<link href="' + css + '" type="text/css" />';
57
+ document: {
58
+ location: {
59
+ hostname: 'test-host-name'
60
+ }
26
61
  }
27
62
  };
28
- var global = {};
29
63
  var fontdeck = new webfont.FontdeckScript(global, fakeDomHelper, configuration);
30
64
 
31
65
  // supportUserAgent
@@ -34,16 +68,39 @@ FontdeckScriptTest.prototype.testSupportAndLoadLifecycle = function() {
34
68
 
35
69
  fontdeck.supportUserAgent(userAgent, function(support) { isSupport = support; });
36
70
  assertEquals('head', insert);
37
- assertEquals('http://fontdeck.com/api/v1/project-info?project=2282&domain=localhost&callback=window.__webfontfontdeckmodule__[2282]', src);
71
+ assertEquals('https://f.fontdeck.com/s/css/js/test-host-name/2282.js', src);
38
72
  assertEquals(null, isSupport);
39
73
 
40
74
  assertNotNull(global.__webfontfontdeckmodule__);
41
75
  assertNotNull(global.__webfontfontdeckmodule__['2282']);
42
76
 
43
77
  // Call the callback function passing in dummy API response.
44
- global.__webfontfontdeckmodule__['2282'](apiResponse);
78
+ global.__webfontfontdeckmodule__['2282'](true, apiResponse);
79
+
80
+ assertEquals(fontdeck.fontFamilies_, [apiResponse.fonts[0].name, apiResponse.fonts[1].name]);
81
+ assertEquals(fontdeck.fontVariations_[apiResponse.fonts[0].name], ['n4']);
82
+ assertEquals(fontdeck.fontVariations_[apiResponse.fonts[1].name], ['i7']);
83
+
84
+ assertEquals(true, isSupport);
85
+ };
86
+
87
+ FontdeckScriptTest.prototype.testNoProjectId = function() {
88
+ var configuration = {
89
+ 'id': null
90
+ };
91
+ var insert = '';
92
+ var src = '';
93
+ var fakeDomHelper = {};
94
+ var global = {};
95
+ var fontdeck = new webfont.FontdeckScript(global, fakeDomHelper, configuration);
96
+
97
+ // supportUserAgent
98
+ var userAgent = 'user agent';
99
+ var isSupport = null;
45
100
 
46
- assertEquals(fontdeck.fontFamilies_, [apiResponse.provides[0].name, apiResponse.provides[1].name]);
47
- assertEquals(fontdeck.fontVariations_[apiResponse.provides[0].name], ['n4']);
48
- assertEquals(fontdeck.fontVariations_[apiResponse.provides[1].name], ['i7']);
49
- };
101
+ fontdeck.supportUserAgent(userAgent, function(support) { isSupport = support; });
102
+
103
+ assertEquals(fontdeck.fontFamilies_, []);
104
+ assertEquals(fontdeck.fontVariations_, []);
105
+ assertEquals(true, isSupport);
106
+ }
@@ -0,0 +1,204 @@
1
+ var LastResortWebKitFontWatchRunnerTest =
2
+ TestCase('LastResortWebKitFontWatchRunnerTest');
3
+
4
+ LastResortWebKitFontWatchRunnerTest.prototype.setUp = function() {
5
+ var self = this;
6
+
7
+ this.fontFamily_ = 'fontFamily1';
8
+ this.fontDescription_ = 'n4';
9
+
10
+ this.fontActiveCalled_ = 0;
11
+ this.fontActive_ = {};
12
+ this.fontInactiveCalled_ = 0;
13
+ this.fontInactive_ = {};
14
+ this.activeCallback_ = function(fontFamily, fontDescription) {
15
+ self.fontActiveCalled_++;
16
+ self.fontActive_[fontFamily + ' ' + fontDescription] = true;
17
+ };
18
+ this.inactiveCallback_ = function(fontFamily, fontDescription) {
19
+ self.fontInactiveCalled_++;
20
+ self.fontInactive_[fontFamily + ' ' + fontDescription] = true;
21
+ };
22
+
23
+ this.createElementCalled_ = 0;
24
+ this.createdElements_ = [];
25
+ this.insertIntoCalled_ = 0;
26
+ this.removeElementCalled_ = 0;
27
+ this.setStyleCalled_ = 0;
28
+ this.fakeDomHelper_ = {
29
+ createElement: function(name, attrs, innerHtml) {
30
+ self.createElementCalled_++;
31
+ self.createdElements_.push({
32
+ 'name': name,
33
+ 'attrs': attrs,
34
+ 'innerHtml': innerHtml
35
+ });
36
+
37
+ var element = document.createElement(name);
38
+
39
+ for (var attr in attrs) {
40
+ element.setAttribute(attr, attrs[attr]);
41
+ }
42
+ element.innerHTML = innerHtml;
43
+ return element;
44
+ },
45
+ insertInto: function(name, el) {
46
+ self.insertIntoCalled_++;
47
+ },
48
+ removeElement: function(el) {
49
+ self.removeElementCalled_++;
50
+ },
51
+ setStyle: function(e, s) {
52
+ self.setStyleCalled_++;
53
+ }
54
+ };
55
+
56
+ this.timesToGetTimeBeforeTimeout_ = 10;
57
+ this.fakeGetTime_ = function() {
58
+ if (self.timesToGetTimeBeforeTimeout_ <= 0) {
59
+ return 6000;
60
+ } else {
61
+ self.timesToGetTimeBeforeTimeout_--;
62
+ return 1;
63
+ }
64
+ };
65
+
66
+ this.asyncCount_ = 0;
67
+ this.fakeAsyncCall_ = function(func, timeout) {
68
+ self.asyncCount_++;
69
+ func();
70
+ };
71
+ };
72
+
73
+ LastResortWebKitFontWatchRunnerTest.prototype.testLastResortFontIgnored =
74
+ function() {
75
+ var originalSizeCount = 2;
76
+ var lastResortFontsCount = 11;
77
+ var firstSize = 2;
78
+ var secondSize = 2;
79
+ var thirdSize = 2;
80
+
81
+ var fontWatchRunner = new webfont.LastResortWebKitFontWatchRunner(
82
+ this.activeCallback_,
83
+ this.inactiveCallback_,
84
+ this.fakeDomHelper_, {getWidth: function() {
85
+ if (originalSizeCount > 0) {
86
+ originalSizeCount--;
87
+ return 1;
88
+ }
89
+ if (lastResortFontsCount > 0) {
90
+ lastResortFontsCount--;
91
+ return 2;
92
+ }
93
+ if (firstSize > 0) {
94
+ firstSize--;
95
+ return 1;
96
+ }
97
+ if (secondSize > 0) {
98
+ secondSize--;
99
+ return 2;
100
+ }
101
+ if (thirdSize > 0) {
102
+ thirdSize--;
103
+ return 3;
104
+ }
105
+ }}, this.fakeAsyncCall_, this.fakeGetTime_, this.fontFamily_,
106
+ this.fontDescription_);
107
+
108
+ fontWatchRunner.start();
109
+
110
+ assertEquals(2, this.asyncCount_);
111
+
112
+ // When on webkit time out ends up activating the font.
113
+ assertEquals(1, this.fontActiveCalled_);
114
+ assertEquals(0, this.fontInactiveCalled_);
115
+ assertEquals(true, this.fontActive_['fontFamily1 n4']);
116
+ };
117
+
118
+ LastResortWebKitFontWatchRunnerTest.prototype.testLastResortFontActiveWhenSizeMatch
119
+ = function() {
120
+ this.timesToGetTimeBeforeTimeout_ = 3;
121
+ var originalSizeCount = 2;
122
+ var lastResortFontsCount = 11;
123
+ var firstSize = 2;
124
+
125
+ this.fontFamily_ = "Arimo";
126
+
127
+ var fontWatchRunner = new webfont.LastResortWebKitFontWatchRunner(
128
+ this.activeCallback_,
129
+ this.inactiveCallback_,
130
+ this.fakeDomHelper_, {getWidth: function() {
131
+ if (originalSizeCount > 0) {
132
+ originalSizeCount--;
133
+ return 1;
134
+ }
135
+ if (lastResortFontsCount > 0) {
136
+ lastResortFontsCount--;
137
+ return 2;
138
+ }
139
+ if (firstSize > 0) {
140
+ firstSize--;
141
+ return 1;
142
+ }
143
+ return 2;
144
+ }}, this.fakeAsyncCall_, this.fakeGetTime_, this.fontFamily_,
145
+ this.fontDescription_);
146
+
147
+ fontWatchRunner.start();
148
+
149
+ assertEquals(2, this.asyncCount_);
150
+
151
+ assertEquals(1, this.fontActiveCalled_);
152
+ assertEquals(0, this.fontInactiveCalled_);
153
+ assertEquals(true, this.fontActive_['Arimo n4']);
154
+ };
155
+
156
+ LastResortWebKitFontWatchRunnerTest.prototype.testLastResortFontInactiveWhenSizeNoMatch
157
+ = function() {
158
+ this.timesToGetTimeBeforeTimeout_ = 3;
159
+ var originalSizeCount = 2;
160
+ var lastResortFontsCount = 11;
161
+ var firstSize = 2;
162
+ var secondSize = 2;
163
+ var thirdSize = 2;
164
+
165
+ var fontWatchRunner = new webfont.LastResortWebKitFontWatchRunner(
166
+ this.activeCallback_,
167
+ this.inactiveCallback_,
168
+ this.fakeDomHelper_, {getWidth: function(elem) {
169
+ if (originalSizeCount > 0) {
170
+ originalSizeCount--;
171
+ return 1;
172
+ }
173
+ if (lastResortFontsCount > 0) {
174
+ lastResortFontsCount--;
175
+ return 2;
176
+ }
177
+ if (firstSize > 0) {
178
+ firstSize--;
179
+ return 1;
180
+ }
181
+ if (secondSize > 0) {
182
+ secondSize--;
183
+ return 2;
184
+ }
185
+ if (thirdSize == 2) {
186
+ thirdSize--;
187
+ return 2;
188
+ }
189
+ if (thirdSize == 1) {
190
+ thirdSize--;
191
+ return 4;
192
+ }
193
+ }}, this.fakeAsyncCall_, this.fakeGetTime_, this.fontFamily_,
194
+ this.fontDescription_);
195
+
196
+ fontWatchRunner.start();
197
+
198
+ assertEquals(2, this.asyncCount_);
199
+
200
+ // When on webkit time out ends up activating the font.
201
+ assertEquals(0, this.fontActiveCalled_);
202
+ assertEquals(1, this.fontInactiveCalled_);
203
+ assertEquals(true, this.fontInactive_['fontFamily1 n4']);
204
+ };
@@ -13,8 +13,8 @@ Gem::Specification.new do |s|
13
13
  ## If your rubyforge_project name is different, then edit it and comment out
14
14
  ## the sub! line in the Rakefile
15
15
  s.name = 'webfontloader'
16
- s.version = '1.0.22'
17
- s.date = '2011-07-01'
16
+ s.version = '1.0.24'
17
+ s.date = '2012-01-09'
18
18
 
19
19
  ## Make sure your summary is short. The description may be as long
20
20
  ## as you like.
@@ -117,6 +117,7 @@ DESC
117
117
  src-test/google/fontapiparsertest.js
118
118
  src-test/google/fontapiurlbuildertest.js
119
119
  src-test/google/googlefontapitest.js
120
+ src-test/google/lastresortwebkitfontwatchrunnertest.js
120
121
  src-test/monotype/monotype_script_test.js
121
122
  src-test/typekit/typekit_script_test.js
122
123
  src/ascender/ascender_script.js
@@ -140,6 +141,7 @@ DESC
140
141
  src/google/fontapiparser.js
141
142
  src/google/fontapiurlbuilder.js
142
143
  src/google/googlefontapi.js
144
+ src/google/lastresortwebkitfontwatchrunner.js
143
145
  src/modules.yml
144
146
  src/monotype/monotype_script.js
145
147
  src/typekit/typekit_script.js
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: webfontloader
3
3
  version: !ruby/object:Gem::Version
4
- hash: 59
4
+ hash: 39
5
5
  prerelease:
6
6
  segments:
7
7
  - 1
8
8
  - 0
9
- - 22
10
- version: 1.0.22
9
+ - 24
10
+ version: 1.0.24
11
11
  platform: ruby
12
12
  authors:
13
13
  - Ryan Carver
@@ -16,12 +16,11 @@ autorequire:
16
16
  bindir: bin
17
17
  cert_chain: []
18
18
 
19
- date: 2011-07-01 00:00:00 -07:00
19
+ date: 2012-01-09 00:00:00 -08:00
20
20
  default_executable:
21
21
  dependencies:
22
22
  - !ruby/object:Gem::Dependency
23
- type: :development
24
- requirement: &id001 !ruby/object:Gem::Requirement
23
+ version_requirements: &id001 !ruby/object:Gem::Requirement
25
24
  none: false
26
25
  requirements:
27
26
  - - ~>
@@ -32,12 +31,12 @@ dependencies:
32
31
  - 2
33
32
  - 1
34
33
  version: 1.2.1
35
- name: rack
36
34
  prerelease: false
37
- version_requirements: *id001
38
- - !ruby/object:Gem::Dependency
35
+ requirement: *id001
36
+ name: rack
39
37
  type: :development
40
- requirement: &id002 !ruby/object:Gem::Requirement
38
+ - !ruby/object:Gem::Dependency
39
+ version_requirements: &id002 !ruby/object:Gem::Requirement
41
40
  none: false
42
41
  requirements:
43
42
  - - ~>
@@ -47,12 +46,12 @@ dependencies:
47
46
  - 1
48
47
  - 0
49
48
  version: "1.0"
50
- name: sinatra
51
49
  prerelease: false
52
- version_requirements: *id002
53
- - !ruby/object:Gem::Dependency
50
+ requirement: *id002
51
+ name: sinatra
54
52
  type: :development
55
- requirement: &id003 !ruby/object:Gem::Requirement
53
+ - !ruby/object:Gem::Dependency
54
+ version_requirements: &id003 !ruby/object:Gem::Requirement
56
55
  none: false
57
56
  requirements:
58
57
  - - ~>
@@ -63,9 +62,10 @@ dependencies:
63
62
  - 1
64
63
  - 6
65
64
  version: 0.1.6
66
- name: vegas
67
65
  prerelease: false
68
- version_requirements: *id003
66
+ requirement: *id003
67
+ name: vegas
68
+ type: :development
69
69
  description: |
70
70
  WebFont Loader gives you added control when using linked fonts via
71
71
  `@font-face`. It provides a common interface to loading fonts regardless of
@@ -135,6 +135,7 @@ files:
135
135
  - src-test/google/fontapiparsertest.js
136
136
  - src-test/google/fontapiurlbuildertest.js
137
137
  - src-test/google/googlefontapitest.js
138
+ - src-test/google/lastresortwebkitfontwatchrunnertest.js
138
139
  - src-test/monotype/monotype_script_test.js
139
140
  - src-test/typekit/typekit_script_test.js
140
141
  - src/ascender/ascender_script.js
@@ -158,6 +159,7 @@ files:
158
159
  - src/google/fontapiparser.js
159
160
  - src/google/fontapiurlbuilder.js
160
161
  - src/google/googlefontapi.js
162
+ - src/google/lastresortwebkitfontwatchrunner.js
161
163
  - src/modules.yml
162
164
  - src/monotype/monotype_script.js
163
165
  - src/typekit/typekit_script.js
@@ -194,7 +196,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
194
196
  requirements: []
195
197
 
196
198
  rubyforge_project:
197
- rubygems_version: 1.6.2
199
+ rubygems_version: 1.5.2
198
200
  signing_key:
199
201
  specification_version: 2
200
202
  summary: WebFont Loader gives you added control when using linked fonts via @font-face.