webfontloader 1.4.0 → 1.4.1

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.
Files changed (44) hide show
  1. data/CHANGELOG +4 -0
  2. data/lib/webfontloader.rb +1 -1
  3. data/spec/ascender/ascenderscript_spec.js +24 -1
  4. data/spec/core/eventdispatcher_spec.js +15 -11
  5. data/spec/core/font_spec.js +83 -192
  6. data/spec/core/fontruler_spec.js +7 -4
  7. data/spec/core/fontwatcher_spec.js +78 -61
  8. data/spec/core/fontwatchrunner_spec.js +85 -33
  9. data/spec/core/webfont_spec.js +224 -0
  10. data/spec/custom/customcss_spec.js +5 -2
  11. data/spec/deps.js +13 -13
  12. data/spec/fontdeck/fontdeckscript_spec.js +4 -6
  13. data/spec/fonts/sourcesansc.css +1 -0
  14. data/spec/fonts/sourcesanscbold.css +1 -0
  15. data/spec/fonts/sourcesanscbold.otf +0 -0
  16. data/spec/google/fontapiparser_spec.js +58 -178
  17. data/spec/google/googlefontapi_spec.js +14 -42
  18. data/spec/google/lastresortwebkitfontwatchrunner_spec.js +12 -10
  19. data/spec/index.html +5 -3
  20. data/spec/monotype/monotypescript_spec.js +3 -2
  21. data/spec/typekit/typekitscript_spec.js +9 -4
  22. data/src/ascender/ascender_script.js +43 -26
  23. data/src/core/eventdispatcher.js +23 -23
  24. data/src/core/font.js +80 -99
  25. data/src/core/fontmoduleloader.js +1 -1
  26. data/src/core/fontruler.js +10 -20
  27. data/src/core/fontwatcher.js +24 -46
  28. data/src/core/fontwatchrunner.js +13 -13
  29. data/src/core/initialize.js +0 -10
  30. data/src/core/webfont.js +134 -0
  31. data/src/custom/customcss.js +14 -10
  32. data/src/fontdeck/fontdeck_script.js +7 -9
  33. data/src/google/fontapiparser.js +11 -15
  34. data/src/google/googlefontapi.js +1 -2
  35. data/src/google/lastresortwebkitfontwatchrunner.js +15 -13
  36. data/src/modules.yml +2 -3
  37. data/src/monotype/monotype_script.js +9 -8
  38. data/src/typekit/typekit_script.js +17 -7
  39. data/webfontloader.gemspec +7 -6
  40. metadata +9 -8
  41. data/spec/core/cssfontfamilyname_spec.js +0 -38
  42. data/spec/core/fontvariationdescription_spec.js +0 -67
  43. data/src/core/cssfontfamilyname.js +0 -33
  44. data/src/core/fontvariationdescription.js +0 -140
@@ -1,5 +1,6 @@
1
1
  describe('GoogleFontApi', function () {
2
2
  var GoogleFontApi = webfont.GoogleFontApi,
3
+ Font = webfont.Font,
3
4
  UserAgent = webfont.UserAgent,
4
5
  userAgent = null,
5
6
  link = '',
@@ -25,14 +26,12 @@ describe('GoogleFontApi', function () {
25
26
 
26
27
  describe('call onReady with font family loading', function () {
27
28
  var googleFontApi = null,
28
- families = null,
29
- descriptions = null;
29
+ fonts = null;
30
30
 
31
31
  beforeEach(function () {
32
32
  googleFontApi = new GoogleFontApi(userAgent, fakeDomHelper, { families: ['Font1', 'Font2'] });
33
- googleFontApi.load(function (fontFamilies, fontDescriptions) {
34
- families = fontFamilies;
35
- descriptions = fontDescriptions;
33
+ googleFontApi.load(function (f) {
34
+ fonts = f;
36
35
  });
37
36
  });
38
37
 
@@ -42,39 +41,22 @@ describe('GoogleFontApi', function () {
42
41
  });
43
42
 
44
43
  it('has the correct families', function () {
45
- expect(families).not.toBeNull();
46
- expect(families.length).toEqual(2);
47
- expect(families[0]).toEqual('Font1');
48
- expect(families[1]).toEqual('Font2');
49
- });
50
-
51
- it('has the correct font descriptions', function () {
52
- var font1 = descriptions['Font1'];
53
- expect(font1).not.toBeNull();
54
- expect(font1.length).toEqual(1);
55
- expect(font1[0]).toEqual('n4');
56
-
57
- var font2 = descriptions['Font2'];
58
- expect(font2).not.toBeNull();
59
- expect(font2.length).toEqual(1);
60
- expect(font1[0]).toEqual('n4');
44
+ expect(fonts).not.toBeNull();
45
+ expect(fonts.length).toEqual(2);
46
+ expect(fonts[0]).toEqual(new Font('Font1'));
47
+ expect(fonts[1]).toEqual(new Font('Font2'));
61
48
  });
62
49
  });
63
50
 
64
51
  describe('call onReady with font family loading and custom API url', function () {
65
- var googleFontApi = null,
66
- families = null,
67
- descriptions = null;
52
+ var googleFontApi = null;
68
53
 
69
54
  beforeEach(function () {
70
55
  googleFontApi = new GoogleFontApi(userAgent, fakeDomHelper, {
71
56
  api: 'http://moo',
72
57
  families: ['Font1', 'Font2']
73
58
  });
74
- googleFontApi.load(function (fontFamilies, fontDescriptions) {
75
- families = fontFamilies;
76
- descriptions = fontDescriptions;
77
- });
59
+ googleFontApi.load(function () {});
78
60
  });
79
61
 
80
62
  it('has inserted the link element correctly', function () {
@@ -84,16 +66,11 @@ describe('GoogleFontApi', function () {
84
66
  });
85
67
 
86
68
  describe('spaces replaced by plus', function () {
87
- var googleFontApi = null,
88
- families = null,
89
- descriptions = null;
69
+ var googleFontApi = null;
90
70
 
91
71
  beforeEach(function () {
92
72
  googleFontApi = new GoogleFontApi(userAgent, fakeDomHelper, { families: ['Font1 WithSpace', 'Font2 WithSpaceToo'] });
93
- googleFontApi.load(function (fontFamilies, fontDescriptions) {
94
- families = fontFamilies;
95
- descriptions = fontDescriptions;
96
- });
73
+ googleFontApi.load(function () {});
97
74
  });
98
75
 
99
76
  it('has inserted the link element correctly', function () {
@@ -103,16 +80,11 @@ describe('GoogleFontApi', function () {
103
80
  });
104
81
 
105
82
  describe('load with variations', function () {
106
- var googleFontApi = null,
107
- families = null,
108
- descriptions = null;
83
+ var googleFontApi = null;
109
84
 
110
85
  beforeEach(function () {
111
86
  googleFontApi = new GoogleFontApi(userAgent, fakeDomHelper, { families: ['Font1 WithSpace:bi', 'Font2 WithSpaceToo:b,r'] });
112
- googleFontApi.load(function (fontFamilies, fontDescriptions) {
113
- families = fontFamilies;
114
- descriptions = fontDescriptions;
115
- });
87
+ googleFontApi.load(function () {});
116
88
  });
117
89
 
118
90
  it('has inserted the link element correctly', function () {
@@ -3,9 +3,9 @@ describe('LastResortWebKitFontWatchRunner', function () {
3
3
  BrowserInfo = webfont.BrowserInfo,
4
4
  DomHelper = webfont.DomHelper,
5
5
  FontRuler = webfont.FontRuler,
6
+ Font = webfont.Font,
6
7
  domHelper = new DomHelper(window),
7
- fontFamily = 'My Family',
8
- fontDescription = 'n4';
8
+ font = new Font('My Family', 'n4');
9
9
 
10
10
  var TARGET_SIZE = 3,
11
11
  FALLBACK_SIZE_A = 1,
@@ -74,12 +74,12 @@ describe('LastResortWebKitFontWatchRunner', function () {
74
74
  ];
75
75
 
76
76
  var fontWatchRunner = new LastResortWebKitFontWatchRunner(activeCallback, inactiveCallback,
77
- domHelper, fontFamily, fontDescription, browserInfo);
77
+ domHelper, font, browserInfo);
78
78
 
79
79
  fontWatchRunner.start();
80
80
 
81
81
  jasmine.Clock.tick(1 * 25);
82
- expect(activeCallback).toHaveBeenCalledWith('My Family', 'n4');
82
+ expect(activeCallback).toHaveBeenCalledWith(font);
83
83
  });
84
84
 
85
85
  it('should consider last resort font as having identical metrics and call active', function () {
@@ -90,13 +90,15 @@ describe('LastResortWebKitFontWatchRunner', function () {
90
90
 
91
91
  timesToGetTimeBeforeTimeout = 2;
92
92
 
93
+ var arimo = new Font('Arimo');
94
+
93
95
  var fontWatchRunner = new LastResortWebKitFontWatchRunner(activeCallback, inactiveCallback,
94
- domHelper, 'Arimo', fontDescription, browserInfo);
96
+ domHelper, arimo, browserInfo);
95
97
 
96
98
  fontWatchRunner.start();
97
99
 
98
100
  jasmine.Clock.tick(1 * 25);
99
- expect(activeCallback).toHaveBeenCalledWith('Arimo', 'n4');
101
+ expect(activeCallback).toHaveBeenCalledWith(arimo);
100
102
  });
101
103
 
102
104
  it('should fail to load font and call inactive', function () {
@@ -109,12 +111,12 @@ describe('LastResortWebKitFontWatchRunner', function () {
109
111
  timesToGetTimeBeforeTimeout = 3;
110
112
 
111
113
  var fontWatchRunner = new LastResortWebKitFontWatchRunner(activeCallback, inactiveCallback,
112
- domHelper, fontFamily, fontDescription, browserInfo);
114
+ domHelper, font, browserInfo);
113
115
 
114
116
  fontWatchRunner.start();
115
117
 
116
118
  jasmine.Clock.tick(2 * 25);
117
- expect(inactiveCallback).toHaveBeenCalledWith('My Family', 'n4');
119
+ expect(inactiveCallback).toHaveBeenCalledWith(font);
118
120
  });
119
121
 
120
122
  it('should call inactive when we are loading a metric incompatible font', function () {
@@ -126,10 +128,10 @@ describe('LastResortWebKitFontWatchRunner', function () {
126
128
  timesToGetTimeBeforeTimeout = 2;
127
129
 
128
130
  var fontWatchRunner = new LastResortWebKitFontWatchRunner(activeCallback, inactiveCallback,
129
- domHelper, fontFamily, fontDescription, browserInfo);
131
+ domHelper, font, browserInfo);
130
132
 
131
133
  fontWatchRunner.start();
132
134
  jasmine.Clock.tick(1 * 25);
133
- expect(inactiveCallback).toHaveBeenCalledWith('My Family', 'n4');
135
+ expect(inactiveCallback).toHaveBeenCalledWith(font);
134
136
  });
135
137
  });
data/spec/index.html CHANGED
@@ -9,6 +9,9 @@
9
9
  <link rel="stylesheet" href="fonts/nullfont2.css">
10
10
  <link rel="stylesheet" href="fonts/nullfont3.css">
11
11
  <link rel="stylesheet" href="fonts/sourcesansa.css">
12
+ <link rel="stylesheet" href="fonts/sourcesansb.css">
13
+ <link rel="stylesheet" href="fonts/sourcesansc.css">
14
+ <link rel="stylesheet" href="fonts/sourcesanscbold.css">
12
15
  </head>
13
16
  <body>
14
17
  <script src="../tools/jasmine/jasmine.js"></script>
@@ -32,15 +35,14 @@
32
35
 
33
36
  <script src="../spec/core/domhelper_spec.js"></script>
34
37
  <script src="../spec/core/cssclassname_spec.js"></script>
35
- <script src="../spec/core/cssfontfamilyname_spec.js"></script>
36
- <script src="../spec/core/fontvariationdescription_spec.js"></script>
37
38
  <script src="../spec/core/useragentparser_spec.js"></script>
38
39
  <script src="../spec/core/fontmoduleloader_spec.js"></script>
39
40
  <script src="../spec/core/eventdispatcher_spec.js"></script>
41
+ <script src="../spec/core/font_spec.js"></script>
40
42
  <script src="../spec/core/fontruler_spec.js"></script>
41
43
  <script src="../spec/core/fontwatchrunner_spec.js"></script>
42
44
  <script src="../spec/core/fontwatcher_spec.js"></script>
43
- <script src="../spec/core/font_spec.js"></script>
45
+ <script src="../spec/core/webfont_spec.js"></script>
44
46
  <script src="../spec/google/fontapiparser_spec.js"></script>
45
47
  <script src="../spec/google/fontapiurlbuilder_spec.js"></script>
46
48
  <script src="../spec/google/googlefontapi_spec.js"></script>
@@ -1,5 +1,6 @@
1
1
  describe('MonotypeScript', function () {
2
2
  var MonotypeScript = webfont.MonotypeScript,
3
+ Font = webfont.Font,
3
4
  BrowserInfo = webfont.BrowserInfo,
4
5
  UserAgent = webfont.UserAgent;
5
6
 
@@ -34,7 +35,7 @@ describe('MonotypeScript', function () {
34
35
  monotype.load(load);
35
36
 
36
37
  global[MonotypeScript.HOOK + configuration.projectId] = function () {
37
- return ['aachen bold', 'kid print regular'];
38
+ return [{fontfamily: 'aachen bold'}, {fontfamily: 'kid print regular'}];
38
39
  };
39
40
 
40
41
  script.onload();
@@ -44,6 +45,6 @@ describe('MonotypeScript', function () {
44
45
  expect(support).toHaveBeenCalled();
45
46
  expect(fakeDomHelper.createElement).toHaveBeenCalledWith('script');
46
47
  expect(script.src).toEqual('http://fast.fonts.com/jsapidev/01e2ff27-25bf-4801-a23e-73d328e6c7cc.js');
47
- expect(load).toHaveBeenCalledWith([undefined, undefined], {});
48
+ expect(load).toHaveBeenCalledWith([new Font('aachen bold'), new Font('kid print regular')]);
48
49
  });
49
50
  });
@@ -1,5 +1,6 @@
1
1
  describe('TypekitScript', function () {
2
- var TypekitScript = webfont.TypekitScript;
2
+ var TypekitScript = webfont.TypekitScript,
3
+ Font = webfont.Font;
3
4
 
4
5
  var configuration = {
5
6
  id: 'abc'
@@ -48,7 +49,7 @@ describe('TypekitScript', function () {
48
49
 
49
50
  typekit.load(load);
50
51
 
51
- expect(load).toHaveBeenCalledWith(['Font1', 'Font2'], { 'Font1': undefined, 'Font2': undefined });
52
+ expect(load).toHaveBeenCalledWith([new Font('Font1'), new Font('Font2')]);
52
53
  });
53
54
 
54
55
  it('should load with variations', function () {
@@ -66,7 +67,11 @@ describe('TypekitScript', function () {
66
67
 
67
68
  typekit.load(load);
68
69
 
69
- expect(load).toHaveBeenCalledWith(['Font1', 'Font2'], { 'Font1': ['n7', 'i7'], 'Font2': undefined });
70
+ expect(load).toHaveBeenCalledWith([
71
+ new Font('Font1', 'n7'),
72
+ new Font('Font1', 'i7'),
73
+ new Font('Font2', 'n4')
74
+ ]);
70
75
  });
71
76
 
72
77
  it('should load through the alternative API', function () {
@@ -88,6 +93,6 @@ describe('TypekitScript', function () {
88
93
 
89
94
  typekit.load(load);
90
95
 
91
- expect(load).toHaveBeenCalledWith([], {});
96
+ expect(load).toHaveBeenCalledWith([]);
92
97
  });
93
98
  });
@@ -1,5 +1,7 @@
1
1
  goog.provide('webfont.AscenderScript');
2
2
 
3
+ goog.require('webfont.Font');
4
+
3
5
  /**
4
6
  *
5
7
  * WebFont.load({
@@ -31,7 +33,8 @@ webfont.AscenderScript.VARIATIONS = {
31
33
  };
32
34
 
33
35
  goog.scope(function () {
34
- var AscenderScript = webfont.AscenderScript;
36
+ var AscenderScript = webfont.AscenderScript,
37
+ Font = webfont.Font;
35
38
 
36
39
  AscenderScript.prototype.supportUserAgent = function(userAgent, support) {
37
40
  return support(userAgent.getBrowserInfo().hasWebFontSupport());
@@ -43,40 +46,54 @@ goog.scope(function () {
43
46
  var url = protocol + '//webfonts.fontslive.com/css/' + key + '.css';
44
47
  this.domHelper_.insertInto('head', this.domHelper_.createCssLink(url));
45
48
  var fv = this.parseFamiliesAndVariations(this.configuration_['families']);
46
- onReady(fv.families, fv.variations);
49
+ onReady(fv);
47
50
  };
48
51
 
49
- AscenderScript.prototype.parseFamiliesAndVariations = function(providedFamilies){
50
- var families, variations, fv;
51
- families = [];
52
- variations = {};
53
- for(var i = 0, len = providedFamilies.length; i < len; i++){
54
- fv = this.parseFamilyAndVariations(providedFamilies[i]);
55
- families.push(fv.family);
56
- variations[fv.family] = fv.variations;
52
+ /**
53
+ * @param {Array.<string>} providedFamilies
54
+ * @return {Array.<webfont.Font>}
55
+ */
56
+ AscenderScript.prototype.parseFamiliesAndVariations = function (providedFamilies) {
57
+ var fonts = [];
58
+
59
+ for (var i = 0, len = providedFamilies.length; i < len; i++) {
60
+ fonts.push.apply(fonts, this.parseFamilyAndVariations(providedFamilies[i]));
57
61
  }
58
- return { families:families, variations:variations };
62
+ return fonts;
59
63
  };
60
64
 
61
- AscenderScript.prototype.parseFamilyAndVariations = function(providedFamily){
62
- var family, variations, parts;
63
- parts = providedFamily.split(':');
64
- family = parts[0];
65
- variations = [];
66
- if(parts[1]){
67
- variations = this.parseVariations(parts[1]);
68
- }else{
69
- variations = ['n4'];
65
+ /**
66
+ * @param {string} providedFamily
67
+ * @return {Array.<webfont.Font>}
68
+ */
69
+ AscenderScript.prototype.parseFamilyAndVariations = function (providedFamily){
70
+ var parts = providedFamily.split(':'),
71
+ familyName = parts[0];
72
+
73
+ if (parts[1]) {
74
+ var variations = this.parseVariations(parts[1]),
75
+ result = [];
76
+
77
+ for (var i = 0; i < variations.length; i += 1) {
78
+ result.push(new Font(familyName, variations[i]));
79
+ }
80
+ return result;
70
81
  }
71
- return { family:family, variations:variations };
82
+ return [new Font(familyName)];
72
83
  };
73
84
 
74
- AscenderScript.prototype.parseVariations = function(source){
75
- var providedVariations = source.split(',');
76
- var variations = [];
77
- for(var i = 0, len = providedVariations.length; i < len; i++){
85
+ /**
86
+ * @param {string} source
87
+ * @return {Array.<string>}
88
+ */
89
+ AscenderScript.prototype.parseVariations = function (source) {
90
+ var providedVariations = source.split(','),
91
+ variations = [];
92
+
93
+ for (var i = 0, len = providedVariations.length; i < len; i++){
78
94
  var pv = providedVariations[i];
79
- if(pv){
95
+
96
+ if (pv) {
80
97
  var v = AscenderScript.VARIATIONS[pv];
81
98
  variations.push(v ? v : pv);
82
99
  }
@@ -68,58 +68,55 @@ goog.scope(function () {
68
68
 
69
69
  /**
70
70
  * Dispatch the font loading event and append the font loading class name.
71
- * @param {string} fontFamily
72
- * @param {string} fontDescription
71
+ * @param {webfont.Font} font
73
72
  */
74
- EventDispatcher.prototype.dispatchFontLoading = function(fontFamily, fontDescription) {
73
+ EventDispatcher.prototype.dispatchFontLoading = function(font) {
75
74
  this.domHelper_.appendClassName(this.htmlElement_,
76
75
  this.cssClassName_.build(
77
- this.namespace_, fontFamily, fontDescription, webfont.EventDispatcher.LOADING));
76
+ this.namespace_, font.getName(), font.getVariation().toString(), webfont.EventDispatcher.LOADING));
78
77
  this.dispatch_(
79
- webfont.EventDispatcher.FONT + webfont.EventDispatcher.LOADING, fontFamily, fontDescription);
78
+ webfont.EventDispatcher.FONT + webfont.EventDispatcher.LOADING, font);
80
79
  };
81
80
 
82
81
  /**
83
82
  * Dispatch the font active event, remove the font loading class name, remove
84
83
  * the font inactive class name, and append the font active class name.
85
- * @param {string} fontFamily
86
- * @param {string} fontDescription
84
+ * @param {webfont.Font} font
87
85
  */
88
- EventDispatcher.prototype.dispatchFontActive = function(fontFamily, fontDescription) {
86
+ EventDispatcher.prototype.dispatchFontActive = function(font) {
89
87
  this.domHelper_.removeClassName(this.htmlElement_,
90
88
  this.cssClassName_.build(
91
- this.namespace_, fontFamily, fontDescription, webfont.EventDispatcher.LOADING));
89
+ this.namespace_, font.getName(), font.getVariation().toString(), webfont.EventDispatcher.LOADING));
92
90
  this.domHelper_.removeClassName(this.htmlElement_,
93
91
  this.cssClassName_.build(
94
- this.namespace_, fontFamily, fontDescription, webfont.EventDispatcher.INACTIVE));
92
+ this.namespace_, font.getName(), font.getVariation().toString(), webfont.EventDispatcher.INACTIVE));
95
93
  this.domHelper_.appendClassName(this.htmlElement_,
96
94
  this.cssClassName_.build(
97
- this.namespace_, fontFamily, fontDescription, webfont.EventDispatcher.ACTIVE));
95
+ this.namespace_, font.getName(), font.getVariation().toString(), webfont.EventDispatcher.ACTIVE));
98
96
  this.dispatch_(
99
- webfont.EventDispatcher.FONT + webfont.EventDispatcher.ACTIVE, fontFamily, fontDescription);
97
+ webfont.EventDispatcher.FONT + webfont.EventDispatcher.ACTIVE, font);
100
98
  };
101
99
 
102
100
  /**
103
101
  * Dispatch the font inactive event, remove the font loading class name, and
104
102
  * append the font inactive class name (unless the font active class name is
105
103
  * already present).
106
- * @param {string} fontFamily
107
- * @param {string} fontDescription
104
+ * @param {webfont.Font} font
108
105
  */
109
- EventDispatcher.prototype.dispatchFontInactive = function(fontFamily, fontDescription) {
106
+ EventDispatcher.prototype.dispatchFontInactive = function(font) {
110
107
  this.domHelper_.removeClassName(this.htmlElement_,
111
108
  this.cssClassName_.build(
112
- this.namespace_, fontFamily, fontDescription, webfont.EventDispatcher.LOADING));
109
+ this.namespace_, font.getName(), font.getVariation().toString(), webfont.EventDispatcher.LOADING));
113
110
  var hasFontActive = this.domHelper_.hasClassName(this.htmlElement_,
114
111
  this.cssClassName_.build(
115
- this.namespace_, fontFamily, fontDescription, webfont.EventDispatcher.ACTIVE));
112
+ this.namespace_, font.getName(), font.getVariation().toString(), webfont.EventDispatcher.ACTIVE));
116
113
  if (!hasFontActive) {
117
114
  this.domHelper_.appendClassName(this.htmlElement_,
118
115
  this.cssClassName_.build(
119
- this.namespace_, fontFamily, fontDescription, webfont.EventDispatcher.INACTIVE));
116
+ this.namespace_, font.getName(), font.getVariation().toString(), webfont.EventDispatcher.INACTIVE));
120
117
  }
121
118
  this.dispatch_(
122
- webfont.EventDispatcher.FONT + webfont.EventDispatcher.INACTIVE, fontFamily, fontDescription);
119
+ webfont.EventDispatcher.FONT + webfont.EventDispatcher.INACTIVE, font);
123
120
  };
124
121
 
125
122
  /**
@@ -160,12 +157,15 @@ goog.scope(function () {
160
157
 
161
158
  /**
162
159
  * @param {string} event
163
- * @param {string=} opt_arg1
164
- * @param {string=} opt_arg2
160
+ * @param {webfont.Font=} opt_font
165
161
  */
166
- EventDispatcher.prototype.dispatch_ = function(event, opt_arg1, opt_arg2) {
162
+ EventDispatcher.prototype.dispatch_ = function(event, opt_font) {
167
163
  if (this.callbacks_[event]) {
168
- this.callbacks_[event](opt_arg1, opt_arg2);
164
+ if (opt_font) {
165
+ this.callbacks_[event](opt_font.getName(), opt_font.getVariation());
166
+ } else {
167
+ this.callbacks_[event]();
168
+ }
169
169
  }
170
170
  };
171
171
  });