webfontloader 1.2.0 → 1.2.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (74) hide show
  1. data/CHANGELOG +9 -0
  2. data/Gemfile +2 -8
  3. data/README.md +31 -32
  4. data/Rakefile +2 -33
  5. data/docs/EVENTS.md +10 -1
  6. data/docs/MODULES.md +4 -3
  7. data/lib/webfontloader.rb +1 -1
  8. data/spec/ascender/ascenderscript_spec.js +43 -0
  9. data/spec/core/cssclassname_spec.js +42 -0
  10. data/spec/core/cssfontfamilyname_spec.js +38 -0
  11. data/spec/core/domhelper_spec.js +158 -0
  12. data/spec/core/eventdispatcher_spec.js +209 -0
  13. data/spec/core/font_spec.js +218 -0
  14. data/spec/core/fontmoduleloader_spec.js +55 -0
  15. data/spec/core/fontruler_spec.js +33 -0
  16. data/spec/core/fontvariationdescription_spec.js +67 -0
  17. data/spec/core/fontwatcher_spec.js +204 -0
  18. data/spec/core/fontwatchrunner_spec.js +398 -0
  19. data/spec/core/size_spec.js +17 -0
  20. data/spec/core/useragentparser_spec.js +921 -0
  21. data/spec/custom/customcss_spec.js +36 -0
  22. data/spec/fontdeck/fontdeckscript_spec.js +111 -0
  23. data/spec/fonts/LICENSE.txt +93 -0
  24. data/spec/fonts/nullfont.css +1 -0
  25. data/spec/fonts/nullfont1.css +1 -0
  26. data/spec/fonts/nullfont2.css +1 -0
  27. data/spec/fonts/nullfont3.css +1 -0
  28. data/spec/fonts/sourcesans.eot +0 -0
  29. data/spec/fonts/sourcesans.otf +0 -0
  30. data/spec/fonts/sourcesans.svg +2523 -0
  31. data/spec/fonts/sourcesans.ttf +0 -0
  32. data/spec/fonts/sourcesans.woff +0 -0
  33. data/spec/fonts/sourcesansa.css +1 -0
  34. data/spec/fonts/sourcesansb.css +1 -0
  35. data/spec/google/fontapiparser_spec.js +348 -0
  36. data/spec/google/fontapiurlbuilder_spec.js +40 -0
  37. data/spec/google/googlefontapi_spec.js +123 -0
  38. data/spec/google/lastresortwebkitfontwatchrunner_spec.js +145 -0
  39. data/spec/index.html +95 -0
  40. data/spec/monotype/monotypescript_spec.js +49 -0
  41. data/spec/typekit/typekitscript_spec.js +93 -0
  42. data/src/core/domhelper.js +6 -3
  43. data/src/core/fontruler.js +1 -1
  44. data/src/core/fontwatcher.js +5 -0
  45. data/src/core/fontwatchrunner.js +7 -4
  46. data/src/monotype/monotype_script.js +4 -3
  47. data/tools/jasmine-phantomjs/jasmine-phantomjs.js +26 -0
  48. data/tools/jasmine-phantomjs/terminal-reporter.js +177 -0
  49. data/tools/jasmine/MIT.LICENSE +20 -0
  50. data/tools/jasmine/jasmine-html.js +681 -0
  51. data/tools/jasmine/jasmine.css +82 -0
  52. data/tools/jasmine/jasmine.js +2600 -0
  53. data/webfontloader.gemspec +46 -25
  54. metadata +77 -42
  55. data/src-test/ascender/ascender_script_test.js +0 -51
  56. data/src-test/core/cssclassnametest.js +0 -42
  57. data/src-test/core/cssfontfamilynametest.js +0 -54
  58. data/src-test/core/domhelpertest.js +0 -151
  59. data/src-test/core/eventdispatchertest.js +0 -275
  60. data/src-test/core/fontmoduleloadertest.js +0 -30
  61. data/src-test/core/fonttest.js +0 -121
  62. data/src-test/core/fontvariationdescriptiontest.js +0 -76
  63. data/src-test/core/fontwatchertest.js +0 -287
  64. data/src-test/core/fontwatchrunnertest.js +0 -454
  65. data/src-test/core/useragenttest.js +0 -755
  66. data/src-test/custom/customcsstest.js +0 -35
  67. data/src-test/fontdeck/fontdeck_script_test.js +0 -116
  68. data/src-test/google/fontapiparsertest.js +0 -252
  69. data/src-test/google/fontapiurlbuildertest.js +0 -71
  70. data/src-test/google/googlefontapitest.js +0 -185
  71. data/src-test/google/lastresortwebkitfontwatchrunnertest.js +0 -204
  72. data/src-test/monotype/monotype_script_test.js +0 -304
  73. data/src-test/typekit/typekit_script_test.js +0 -195
  74. data/tools/jstestdriver/JsTestDriver-1.2.1.jar +0 -0
@@ -0,0 +1,145 @@
1
+ describe('LastResortWebKitFontWatchRunner', function () {
2
+ var LastResortWebKitFontWatchRunner = webfont.LastResortWebKitFontWatchRunner,
3
+ Size = webfont.Size,
4
+ DomHelper = webfont.DomHelper,
5
+ domHelper = new DomHelper(window),
6
+ fontFamily = 'My Family',
7
+ fontDescription = 'n4';
8
+
9
+ var timesToCheckSizeBeforeChange = 0,
10
+ TARGET_SIZE = new Size(3, 3),
11
+ FALLBACK_SIZE_A = new Size(1, 1),
12
+ FALLBACK_SIZE_B = new Size(2, 2),
13
+ LAST_RESORT_SIZE = new Size(4, 4),
14
+
15
+ setupSizes = [FALLBACK_SIZE_A, FALLBACK_SIZE_B, LAST_RESORT_SIZE],
16
+ actualSizes = [],
17
+ fakeGetSizeCount = 0,
18
+ setupFinished = false,
19
+ fakeFontSizer = {
20
+ getSize: function (el) {
21
+ var result = null;
22
+
23
+ if (setupFinished) {
24
+ // If you are getting an exception here your tests does not specify enough
25
+ // size data to run properly.
26
+ if (fakeGetSizeCount >= actualSizes.length) {
27
+ throw 'Invalid test data';
28
+ }
29
+ result = actualSizes[fakeGetSizeCount];
30
+ fakeGetSizeCount += 1;
31
+ } else {
32
+ result = setupSizes[Math.min(fakeGetSizeCount, setupSizes.length - 1)];
33
+ fakeGetSizeCount += 1;
34
+ }
35
+ return result;
36
+ }
37
+ },
38
+ timesToGetTimeBeforeTimeout = 10,
39
+ fakeGetTime = function () {
40
+ if (timesToGetTimeBeforeTimeout <= 0) {
41
+ return 6000;
42
+ } else {
43
+ timesToGetTimeBeforeTimeout -= 1;
44
+ return 1;
45
+ }
46
+ },
47
+ asyncCount = 0,
48
+ fakeAsyncCall = function (func, timeout) {
49
+ asyncCount += 1;
50
+ func();
51
+ },
52
+ setupFinished = false,
53
+ originalStartMethod = null,
54
+ activeCallback = null,
55
+ inactiveCallback = null;
56
+
57
+ beforeEach(function () {
58
+ actualSizes = [];
59
+ setupFinished = false;
60
+ fakeGetSizeCount = 0;
61
+
62
+ asyncCount = 0;
63
+ timesToGetTimeBeforeTimeout = 10;
64
+ activeCallback = jasmine.createSpy('activeCallback');
65
+ inactiveCallback = jasmine.createSpy('inactiveCallback');
66
+
67
+ originalStartMethod = LastResortWebKitFontWatchRunner.prototype.start;
68
+
69
+ LastResortWebKitFontWatchRunner.prototype.start = function () {
70
+ setupFinished = true;
71
+ fakeGetSizeCount = 0;
72
+ originalStartMethod.apply(this);
73
+ };
74
+ });
75
+
76
+ afterEach(function () {
77
+ LastResortWebKitFontWatchRunner.prototype.start = originalStartMethod;
78
+ });
79
+
80
+ it('should ignore fallback size and call active', function () {
81
+ actualSizes = [
82
+ LAST_RESORT_SIZE, LAST_RESORT_SIZE,
83
+ TARGET_SIZE, TARGET_SIZE
84
+ ];
85
+
86
+ var fontWatchRunner = new LastResortWebKitFontWatchRunner(activeCallback, inactiveCallback,
87
+ domHelper, fakeFontSizer, fakeAsyncCall, fakeGetTime, fontFamily, fontDescription, true);
88
+
89
+ fontWatchRunner.start();
90
+
91
+ expect(asyncCount).toEqual(1);
92
+ expect(activeCallback).toHaveBeenCalledWith('My Family', 'n4');
93
+ });
94
+
95
+ it('should consider last resort font as having identical metrics and call active', function () {
96
+ actualSizes = [
97
+ LAST_RESORT_SIZE, LAST_RESORT_SIZE,
98
+ LAST_RESORT_SIZE, LAST_RESORT_SIZE
99
+ ];
100
+
101
+ timesToGetTimeBeforeTimeout = 2;
102
+
103
+ var fontWatchRunner = new LastResortWebKitFontWatchRunner(activeCallback, inactiveCallback,
104
+ domHelper, fakeFontSizer, fakeAsyncCall, fakeGetTime, 'Arimo', fontDescription, true);
105
+
106
+ fontWatchRunner.start();
107
+
108
+ expect(asyncCount).toEqual(1);
109
+ expect(activeCallback).toHaveBeenCalledWith('Arimo', 'n4');
110
+ });
111
+
112
+ it('should fail to load font and call inactive', function () {
113
+ actualSizes = [
114
+ LAST_RESORT_SIZE, LAST_RESORT_SIZE,
115
+ LAST_RESORT_SIZE, LAST_RESORT_SIZE,
116
+ FALLBACK_SIZE_A, FALLBACK_SIZE_B
117
+ ];
118
+
119
+ timesToGetTimeBeforeTimeout = 3;
120
+
121
+ var fontWatchRunner = new LastResortWebKitFontWatchRunner(activeCallback, inactiveCallback,
122
+ domHelper, fakeFontSizer, fakeAsyncCall, fakeGetTime, fontFamily, fontDescription, true);
123
+
124
+ fontWatchRunner.start();
125
+
126
+ expect(asyncCount).toEqual(2);
127
+ expect(inactiveCallback).toHaveBeenCalledWith('My Family', 'n4');
128
+ });
129
+
130
+ it('should call inactive when we are loading a metric incompatible font', function () {
131
+ actualSizes = [
132
+ LAST_RESORT_SIZE, LAST_RESORT_SIZE,
133
+ LAST_RESORT_SIZE, LAST_RESORT_SIZE
134
+ ];
135
+
136
+ timesToGetTimeBeforeTimeout = 2;
137
+
138
+ var fontWatchRunner = new LastResortWebKitFontWatchRunner(activeCallback, inactiveCallback,
139
+ domHelper, fakeFontSizer, fakeAsyncCall, fakeGetTime, fontFamily, fontDescription, true);
140
+
141
+ fontWatchRunner.start();
142
+ expect(asyncCount).toEqual(1);
143
+ expect(inactiveCallback).toHaveBeenCalledWith('My Family', 'n4');
144
+ });
145
+ });
data/spec/index.html ADDED
@@ -0,0 +1,95 @@
1
+ <!doctype html>
2
+ <html>
3
+ <head>
4
+ <title>Webfontloader tests</title>
5
+ <link rel="stylesheet" href="../tools/jasmine/jasmine.css">
6
+
7
+ <link rel="stylesheet" href="fonts/nullfont.css">
8
+ <link rel="stylesheet" href="fonts/nullfont1.css">
9
+ <link rel="stylesheet" href="fonts/nullfont2.css">
10
+ <link rel="stylesheet" href="fonts/nullfont3.css">
11
+ <link rel="stylesheet" href="fonts/sourcesansa.css">
12
+ </head>
13
+ <body>
14
+ <script src="../tools/jasmine/jasmine.js"></script>
15
+ <script src="../tools/jasmine/jasmine-html.js"></script>
16
+ <script src="../tools/jasmine-phantomjs/terminal-reporter.js"></script>
17
+
18
+ <script src="../src/core/namespace.js"></script>
19
+ <script src="../src/core/domhelper.js"></script>
20
+ <script src="../src/core/cssclassname.js"></script>
21
+ <script src="../src/core/cssfontfamilyname.js"></script>
22
+ <script src="../src/core/fontvariationdescription.js"></script>
23
+ <script src="../src/core/browserinfo.js"></script>
24
+ <script src="../src/core/useragent.js"></script>
25
+ <script src="../src/core/useragentparser.js"></script>
26
+ <script src="../src/core/fontmoduleloader.js"></script>
27
+ <script src="../src/core/eventdispatcher.js"></script>
28
+ <script src="../src/core/size.js"></script>
29
+ <script src="../src/core/fontruler.js"></script>
30
+ <script src="../src/core/fontwatchrunner.js"></script>
31
+ <script src="../src/core/fontwatcher.js"></script>
32
+ <script src="../src/core/font.js"></script>
33
+ <script src="../src/core/initialize.js"></script>
34
+ <script src="../src/google/fontapiparser.js"></script>
35
+ <script src="../src/google/fontapiurlbuilder.js"></script>
36
+ <script src="../src/google/googlefontapi.js"></script>
37
+ <script src="../src/google/lastresortwebkitfontwatchrunner.js"></script>
38
+ <script src="../src/custom/customcss.js"></script>
39
+ <script src="../src/ascender/ascender_script.js"></script>
40
+ <script src="../src/fontdeck/fontdeck_script.js"></script>
41
+ <script src="../src/monotype/monotype_script.js"></script>
42
+ <script src="../src/typekit/typekit_script.js"></script>
43
+
44
+ <script src="../spec/core/domhelper_spec.js"></script>
45
+ <script src="../spec/core/cssclassname_spec.js"></script>
46
+ <script src="../spec/core/cssfontfamilyname_spec.js"></script>
47
+ <script src="../spec/core/fontvariationdescription_spec.js"></script>
48
+ <script src="../spec/core/useragentparser_spec.js"></script>
49
+ <script src="../spec/core/fontmoduleloader_spec.js"></script>
50
+ <script src="../spec/core/eventdispatcher_spec.js"></script>
51
+ <script src="../spec/core/size_spec.js"></script>
52
+ <script src="../spec/core/fontruler_spec.js"></script>
53
+ <script src="../spec/core/fontwatchrunner_spec.js"></script>
54
+ <script src="../spec/core/fontwatcher_spec.js"></script>
55
+ <script src="../spec/core/font_spec.js"></script>
56
+ <script src="../spec/google/fontapiparser_spec.js"></script>
57
+ <script src="../spec/google/fontapiurlbuilder_spec.js"></script>
58
+ <script src="../spec/google/googlefontapi_spec.js"></script>
59
+ <script src="../spec/google/lastresortwebkitfontwatchrunner_spec.js"></script>
60
+ <script src="../spec/custom/customcss_spec.js"></script>
61
+ <script src="../spec/ascender/ascenderscript_spec.js"></script>
62
+ <script src="../spec/fontdeck/fontdeckscript_spec.js"></script>
63
+ <script src="../spec/monotype/monotypescript_spec.js"></script>
64
+ <script src="../spec/typekit/typekitscript_spec.js"></script>
65
+
66
+ <script>
67
+ (function () {
68
+ var env = jasmine.getEnv();
69
+
70
+ env.updateInterval = 1000;
71
+
72
+ var htmlReporter = new jasmine.HtmlReporter(),
73
+ terminalReporter = new jasmine.TerminalReporter({
74
+ verbosity: 3,
75
+ color: true
76
+ });
77
+
78
+ env.addReporter(terminalReporter);
79
+ env.addReporter(htmlReporter);
80
+ env.specFilter = function (spec) {
81
+ return htmlReporter.specFilter(spec);
82
+ };
83
+
84
+ var currentOnload = window.onload;
85
+
86
+ window.onload = function () {
87
+ if (currentOnload) {
88
+ currentOnload();
89
+ }
90
+ env.execute();
91
+ };
92
+ }());
93
+ </script>
94
+ </body>
95
+ </html>
@@ -0,0 +1,49 @@
1
+ describe('MonotypeScript', function () {
2
+ var MonotypeScript = webfont.MonotypeScript,
3
+ BrowserInfo = webfont.BrowserInfo,
4
+ UserAgent = webfont.UserAgent;
5
+
6
+ var configuration = {
7
+ projectId: '01e2ff27-25bf-4801-a23e-73d328e6c7cc',
8
+ api: 'http://fast.fonts.com/jsapidev'
9
+ };
10
+
11
+ var fakeDomHelper = null,
12
+ global = null,
13
+ script = {},
14
+ monotype = null,
15
+ load = null,
16
+ useragent = null,
17
+ support = null;
18
+
19
+ beforeEach(function () {
20
+ global = {};
21
+
22
+ fakeDomHelper = {
23
+ createElement: jasmine.createSpy('createElement').andReturn(script),
24
+ insertInto: jasmine.createSpy('insertInto'),
25
+ getLoadWindow: jasmine.createSpy('getLoadWindow').andReturn(global),
26
+ getProtocol: jasmine.createSpy('getProtocol').andReturn('http:')
27
+ };
28
+ support = jasmine.createSpy('support');
29
+ load = jasmine.createSpy('load');
30
+ useragent = new UserAgent('Firefox', '3.6', 'Gecko', '1.9.3', 'Macintosh', '10.6', undefined, new BrowserInfo(true, false));
31
+
32
+ monotype = new MonotypeScript(useragent, fakeDomHelper, configuration);
33
+ monotype.supportUserAgent(useragent, support);
34
+ monotype.load(load);
35
+
36
+ global[MonotypeScript.HOOK + configuration.projectId] = function () {
37
+ return ['aachen bold', 'kid print regular'];
38
+ };
39
+
40
+ script.onload();
41
+ });
42
+
43
+ it('should create a script element', function () {
44
+ expect(support).toHaveBeenCalled();
45
+ expect(fakeDomHelper.createElement).toHaveBeenCalledWith('script');
46
+ expect(script.src).toEqual('http://fast.fonts.com/jsapidev/01e2ff27-25bf-4801-a23e-73d328e6c7cc.js');
47
+ expect(load).toHaveBeenCalledWith([undefined, undefined], {});
48
+ });
49
+ });
@@ -0,0 +1,93 @@
1
+ describe('TypekitScript', function () {
2
+ var TypekitScript = webfont.TypekitScript;
3
+
4
+ var configuration = {
5
+ id: 'abc'
6
+ };
7
+
8
+ var fakeDomHelper = null,
9
+ global = {},
10
+ load = null,
11
+ support = null;
12
+
13
+ beforeEach(function () {
14
+ global = {};
15
+
16
+ support = jasmine.createSpy('support');
17
+
18
+ load = jasmine.createSpy('load');
19
+
20
+ fakeDomHelper = {
21
+ insertInto: jasmine.createSpy('insertInto'),
22
+ createScriptSrc: jasmine.createSpy('createScriptSrc'),
23
+ getLoadWindow: jasmine.createSpy('getLoadWindow').andReturn(global),
24
+ getProtocol: jasmine.createSpy('getProtocol').andReturn('http:')
25
+ };
26
+ });
27
+
28
+ it('support load and life cycle', function () {
29
+ var typekit = new TypekitScript(fakeDomHelper, configuration);
30
+
31
+ typekit.supportUserAgent('useragent', support);
32
+
33
+ expect(fakeDomHelper.insertInto.calls[0].args[0]).toEqual('head');
34
+ expect(fakeDomHelper.createScriptSrc).toHaveBeenCalledWith('http://use.typekit.com/abc.js');
35
+ expect(support).not.toHaveBeenCalled();
36
+
37
+ expect(global.__webfonttypekitmodule__).not.toBeNull();
38
+ expect(global.__webfonttypekitmodule__['abc']).not.toBeNull();
39
+
40
+ global.__webfonttypekitmodule__['abc'](function (ua, config, init) {
41
+ expect(ua).toEqual('useragent');
42
+ expect(config).toEqual(configuration);
43
+ expect(init).not.toBeNull();
44
+ init(true, ['Font1', 'Font2'], {});
45
+ });
46
+
47
+ expect(support).toHaveBeenCalled();
48
+
49
+ typekit.load(load);
50
+
51
+ expect(load).toHaveBeenCalledWith(['Font1', 'Font2'], { 'Font1': undefined, 'Font2': undefined });
52
+ });
53
+
54
+ it('should load with variations', function () {
55
+ var typekit = new TypekitScript(fakeDomHelper, configuration);
56
+
57
+ typekit.supportUserAgent('useragent', support);
58
+
59
+ global.__webfonttypekitmodule__['abc'](function (ua, config, init) {
60
+ init(true, ['Font1', 'Font2'], {
61
+ 'Font1': ['n7', 'i7']
62
+ });
63
+ });
64
+
65
+ expect(support).toHaveBeenCalled();
66
+
67
+ typekit.load(load);
68
+
69
+ expect(load).toHaveBeenCalledWith(['Font1', 'Font2'], { 'Font1': ['n7', 'i7'], 'Font2': undefined });
70
+ });
71
+
72
+ it('should load through the alternative API', function () {
73
+ var typekit = new TypekitScript(fakeDomHelper, { id: 'abc', api: '/test' });
74
+
75
+ typekit.supportUserAgent('useragent', support);
76
+ expect(fakeDomHelper.insertInto.calls[0].args[0]).toEqual('head');
77
+ expect(fakeDomHelper.createScriptSrc).toHaveBeenCalledWith('/test/abc.js');
78
+ });
79
+
80
+ it('should not load without a kit id', function () {
81
+ var typekit = new TypekitScript(fakeDomHelper, { id: null });
82
+
83
+ typekit.supportUserAgent('useragent', support);
84
+
85
+ expect(fakeDomHelper.insertInto).not.toHaveBeenCalled();
86
+ expect(fakeDomHelper.createScriptSrc).not.toHaveBeenCalled();
87
+ expect(support).toHaveBeenCalled();
88
+
89
+ typekit.load(load);
90
+
91
+ expect(load).toHaveBeenCalledWith([], {});
92
+ });
93
+ });
@@ -136,7 +136,9 @@ webfont.DomHelper.prototype.appendClassName = function(e, name) {
136
136
  }
137
137
  }
138
138
  classes.push(name);
139
- e.className = classes.join(' ').replace(/^\s+/, '');
139
+ e.className = classes.join(' ')
140
+ .replace(/\s+/g, ' ')
141
+ .replace(/^\s+|\s+$/, '');
140
142
  };
141
143
 
142
144
  /**
@@ -152,8 +154,9 @@ webfont.DomHelper.prototype.removeClassName = function(e, name) {
152
154
  remainingClasses.push(classes[i]);
153
155
  }
154
156
  }
155
- e.className = remainingClasses.join(' ').replace(/^\s+/, '')
156
- .replace(/\s+$/, '');
157
+ e.className = remainingClasses.join(' ')
158
+ .replace(/\s+/g, ' ')
159
+ .replace(/^\s+|\s+$/, '');
157
160
  };
158
161
 
159
162
  /**
@@ -41,7 +41,7 @@ webfont.FontRuler.prototype.computeStyleString_ = function(fontFamily, opt_fontD
41
41
  var variationCss = opt_fontDescription ? this.fvd_.expand(opt_fontDescription) : '';
42
42
  var styleString = "position:absolute;top:-999px;left:-999px;" +
43
43
  "font-size:300px;width:auto;height:auto;line-height:normal;margin:0;" +
44
- "padding:0;font-variant:normal;font-family:" +
44
+ "padding:0;font-variant:normal;white-space:nowrap;font-family:" +
45
45
  this.nameHelper_.quote(fontFamily) + ";" + variationCss;
46
46
  return styleString;
47
47
  };
@@ -45,6 +45,11 @@ webfont.FontWatcher.prototype.watch = function(fontFamilies, fontDescriptions,
45
45
  fontTestStrings, fontWatchRunnerCtor, last) {
46
46
  var length = fontFamilies.length;
47
47
 
48
+ if (length === 0) {
49
+ this.eventDispatcher_.dispatchInactive();
50
+ return;
51
+ }
52
+
48
53
  for (var i = 0; i < length; i++) {
49
54
  var fontFamily = fontFamilies[i];
50
55
  if (!fontDescriptions[fontFamily]) {
@@ -28,10 +28,8 @@ webfont.FontWatchRunner = function(activeCallback, inactiveCallback, domHelper,
28
28
 
29
29
  this.metricCompatibleFonts_ = opt_metricCompatibleFonts || null;
30
30
 
31
- this.fontRulerA_ = new webfont.FontRuler(this.domHelper_, this.fontSizer_, this.fontTestString_);
32
- this.fontRulerA_.insert();
33
- this.fontRulerB_ = new webfont.FontRuler(this.domHelper_, this.fontSizer_, this.fontTestString_);
34
- this.fontRulerB_.insert();
31
+ this.fontRulerA_ = null;
32
+ this.fontRulerB_ = null;
35
33
 
36
34
  this.setupLastResortSizes_();
37
35
  };
@@ -82,6 +80,11 @@ webfont.FontWatchRunner.prototype.setupLastResortSizes_ = function() {
82
80
  };
83
81
 
84
82
  webfont.FontWatchRunner.prototype.start = function() {
83
+ this.fontRulerA_ = new webfont.FontRuler(this.domHelper_, this.fontSizer_, this.fontTestString_);
84
+ this.fontRulerA_.insert();
85
+ this.fontRulerB_ = new webfont.FontRuler(this.domHelper_, this.fontSizer_, this.fontTestString_);
86
+ this.fontRulerB_.insert();
87
+
85
88
  this.started_ = this.getTime_();
86
89
 
87
90
  this.fontRulerA_.setFont(this.fontFamily_ + ',' + webfont.FontWatchRunner.LastResortFonts.SERIF, this.fontDescription_);