webfontloader 1.4.12 → 1.5.0
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 +5 -0
- data/README.md +13 -0
- data/Rakefile +1 -1
- data/browsers.json +23 -12
- data/lib/webfontloader.rb +1 -1
- data/spec/core/domhelper_spec.js +9 -7
- data/spec/core/fontwatchrunner_spec.js +3 -50
- data/spec/core/useragentparser_spec.js +43 -22
- data/spec/index.html +1 -11
- data/spec/modules/custom_spec.js +9 -1
- data/spec/modules/google/googlefontapi_spec.js +3 -0
- data/src/core/useragentparser.js +29 -10
- data/src/modules/custom.js +2 -1
- data/webfontloader.gemspec +2 -5
- metadata +5 -8
- data/spec/fixtures/fonts/sourcesansc.css +0 -1
- data/spec/fixtures/fonts/sourcesanscbold.css +0 -1
- data/spec/fixtures/fonts/sourcesanscbold.otf +0 -0
data/CHANGELOG
CHANGED
@@ -1,3 +1,8 @@
|
|
1
|
+
v1.5.0 (September 9, 2013)
|
2
|
+
* Correctly categorize Internet Explorer 11 as an Internet Explorer version.
|
3
|
+
* Add support for custom test strings in the custom module.
|
4
|
+
* Various small bug fixes to the test suite so it runs on all browsers automatically.
|
5
|
+
|
1
6
|
v1.4.12 (August 21, 2013)
|
2
7
|
* Cleared up initialization code and made all modules optional and configurable at compile time
|
3
8
|
|
data/README.md
CHANGED
@@ -180,6 +180,19 @@ In this example, the `fonts.css` file might look something like this:
|
|
180
180
|
src: ...;
|
181
181
|
}
|
182
182
|
|
183
|
+
The custom module also supports customizing the test strings that are used to determine whether or not a font has loaded. This can be used to load fonts with custom subsets or glyphs in the private use unicode area.
|
184
|
+
|
185
|
+
WebFontConfig = {
|
186
|
+
custom: {
|
187
|
+
families: ['My Font'],
|
188
|
+
testStrings: {
|
189
|
+
'My Font': '\uE003\uE005'
|
190
|
+
}
|
191
|
+
}
|
192
|
+
};
|
193
|
+
|
194
|
+
Tests strings should be specified on a per font basis and contain at least one character. If not specified the default test string (`BESbswy`) is used.
|
195
|
+
|
183
196
|
### Fontdeck
|
184
197
|
|
185
198
|
To use the [Fontdeck](http://fontdeck.com/) module, specify the ID of your website. You can find this ID on the website page within your account settings.
|
data/Rakefile
CHANGED
@@ -161,7 +161,7 @@ end
|
|
161
161
|
#
|
162
162
|
desc "BrowserStack tests"
|
163
163
|
task :bstest do |t|
|
164
|
-
exec "browserstack-test -u $BROWSERSTACK_USERNAME -p $BROWSERSTACK_PASSWORD -k $BROWSERSTACK_KEY -b browsers.json http://localhost:9999/spec/index.html"
|
164
|
+
exec "browserstack-test -u $BROWSERSTACK_USERNAME -p $BROWSERSTACK_PASSWORD -k $BROWSERSTACK_KEY -b browsers.json -t 300 http://localhost:9999/spec/index.html"
|
165
165
|
end
|
166
166
|
|
167
167
|
desc "Test everything"
|
data/browsers.json
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
{
|
3
3
|
"os_version": "XP",
|
4
4
|
"os": "Windows",
|
5
|
-
"browser_version": "
|
5
|
+
"browser_version": "12.16",
|
6
6
|
"browser": "opera"
|
7
7
|
},
|
8
8
|
{
|
@@ -21,13 +21,15 @@
|
|
21
21
|
"os_version": "XP",
|
22
22
|
"os": "Windows",
|
23
23
|
"browser_version": "6.0",
|
24
|
-
"browser": "ie"
|
24
|
+
"browser": "ie",
|
25
|
+
"timeout": "300"
|
25
26
|
},
|
26
27
|
{
|
27
28
|
"os_version": "XP",
|
28
29
|
"os": "Windows",
|
29
30
|
"browser_version": "7.0",
|
30
|
-
"browser": "ie"
|
31
|
+
"browser": "ie",
|
32
|
+
"timeout": "300"
|
31
33
|
},
|
32
34
|
{
|
33
35
|
"os_version": "XP",
|
@@ -69,54 +71,63 @@
|
|
69
71
|
"os_version": "5.0",
|
70
72
|
"device": "iPad 2 (5.0)",
|
71
73
|
"os": "ios",
|
72
|
-
"browser": "Mobile Safari"
|
74
|
+
"browser": "Mobile Safari",
|
75
|
+
"timeout": "300"
|
73
76
|
},
|
74
77
|
{
|
75
78
|
"os_version": "5.1",
|
76
79
|
"device": "iPad 3rd",
|
77
80
|
"os": "ios",
|
78
|
-
"browser": "Mobile Safari"
|
81
|
+
"browser": "Mobile Safari",
|
82
|
+
"timeout": "300"
|
79
83
|
},
|
80
84
|
{
|
81
85
|
"os_version": "6.0",
|
82
86
|
"device": "iPhone 5",
|
83
87
|
"os": "ios",
|
84
|
-
"browser": "Mobile Safari"
|
88
|
+
"browser": "Mobile Safari",
|
89
|
+
"timeout": "300"
|
85
90
|
},
|
86
91
|
{
|
87
92
|
"os_version": "4.3.2",
|
88
93
|
"device": "iPad 2",
|
89
94
|
"os": "ios",
|
90
|
-
"browser": "Mobile Safari"
|
95
|
+
"browser": "Mobile Safari",
|
96
|
+
"timeout": "300"
|
91
97
|
},
|
92
98
|
{
|
93
99
|
"os_version": "2.3",
|
94
100
|
"device": "Samsung Galaxy S II",
|
95
101
|
"os": "android",
|
96
|
-
"browser": "Android Browser"
|
102
|
+
"browser": "Android Browser",
|
103
|
+
"timeout": "300"
|
97
104
|
},
|
98
105
|
{
|
99
106
|
"os_version": "2.2",
|
100
107
|
"device": "Samsung Galaxy S",
|
101
108
|
"os": "android",
|
102
|
-
"browser": "Android Browser"
|
109
|
+
"browser": "Android Browser",
|
110
|
+
"timeout": "300"
|
103
111
|
},
|
104
112
|
{
|
105
113
|
"os_version": "4.2",
|
106
114
|
"device": "LG Nexus 4",
|
107
115
|
"os": "android",
|
108
|
-
"browser": "Android Browser"
|
116
|
+
"browser": "Android Browser",
|
117
|
+
"timeout": "300"
|
109
118
|
},
|
110
119
|
{
|
111
120
|
"os_version": "4.0",
|
112
121
|
"device": "Samsung Galaxy Nexus",
|
113
122
|
"os": "android",
|
114
|
-
"browser": "Android Browser"
|
123
|
+
"browser": "Android Browser",
|
124
|
+
"timeout": "300"
|
115
125
|
},
|
116
126
|
{
|
117
127
|
"os_version": "4.1",
|
118
128
|
"device": "Samsung Galaxy S III",
|
119
129
|
"os": "android",
|
120
|
-
"browser": "Android Browser"
|
130
|
+
"browser": "Android Browser",
|
131
|
+
"timeout": "300"
|
121
132
|
}
|
122
133
|
]
|
data/lib/webfontloader.rb
CHANGED
data/spec/core/domhelper_spec.js
CHANGED
@@ -136,7 +136,12 @@ describe('DomHelper', function () {
|
|
136
136
|
var style = null;
|
137
137
|
|
138
138
|
beforeEach(function () {
|
139
|
-
style = domHelper.createStyle('font-size:300px
|
139
|
+
style = domHelper.createStyle('blockquote{font-size:300px}');
|
140
|
+
domHelper.insertInto('head', style);
|
141
|
+
});
|
142
|
+
|
143
|
+
afterEach(function () {
|
144
|
+
domHelper.removeElement(style);
|
140
145
|
});
|
141
146
|
|
142
147
|
it('should create a style element', function () {
|
@@ -145,11 +150,8 @@ describe('DomHelper', function () {
|
|
145
150
|
});
|
146
151
|
|
147
152
|
it('should set the css content correctly', function () {
|
148
|
-
|
149
|
-
|
150
|
-
} else {
|
151
|
-
expect(style.textContent).toEqual('font-size:300px;');
|
152
|
-
}
|
153
|
+
var text = style.styleSheet ? style.styleSheet.cssText : style.textContent;
|
154
|
+
expect(text.replace(/[\s;]/g, '').toLowerCase()).toEqual('blockquote{font-size:300px}');
|
153
155
|
});
|
154
156
|
});
|
155
157
|
|
@@ -412,7 +414,7 @@ describe('DomHelper', function () {
|
|
412
414
|
|
413
415
|
var result = domHelper.removeElement(b);
|
414
416
|
expect(result).toBe(true);
|
415
|
-
expect(b.parentNode).toEqual(
|
417
|
+
expect(b.parentNode).not.toEqual(a);
|
416
418
|
});
|
417
419
|
|
418
420
|
it('should return false when failing to remove an element', function () {
|
@@ -256,8 +256,6 @@ describe('FontWatchRunner', function () {
|
|
256
256
|
nullFont = null,
|
257
257
|
sourceSansA = null,
|
258
258
|
sourceSansB = null,
|
259
|
-
sourceSansC = null,
|
260
|
-
sourceSansCBold = null,
|
261
259
|
elena = null;
|
262
260
|
|
263
261
|
beforeEach(function () {
|
@@ -266,8 +264,6 @@ describe('FontWatchRunner', function () {
|
|
266
264
|
nullFont = new Font('__webfontloader_test__');
|
267
265
|
sourceSansA = new Font('SourceSansA');
|
268
266
|
sourceSansB = new Font('SourceSansB');
|
269
|
-
sourceSansC = new Font('SourceSansC');
|
270
|
-
sourceSansCBold = new Font('SourceSansC', 'n7');
|
271
267
|
elena = new Font('Elena');
|
272
268
|
|
273
269
|
userAgent = userAgentParser.parse();
|
@@ -292,7 +288,7 @@ describe('FontWatchRunner', function () {
|
|
292
288
|
|
293
289
|
it('should load font succesfully', function () {
|
294
290
|
var fontWatchRunner = new FontWatchRunner(activeCallback, inactiveCallback,
|
295
|
-
domHelper, sourceSansA, userAgent.getBrowserInfo(),
|
291
|
+
domHelper, sourceSansA, userAgent.getBrowserInfo(), 5000),
|
296
292
|
ruler = new FontRuler(domHelper, 'abcdef'),
|
297
293
|
monospace = new Font('monospace'),
|
298
294
|
sourceSansAFallback = new Font("'SourceSansA', monospace"),
|
@@ -345,17 +341,13 @@ describe('FontWatchRunner', function () {
|
|
345
341
|
});
|
346
342
|
|
347
343
|
runs(function () {
|
348
|
-
|
349
|
-
expect(activeCallback).toHaveBeenCalledWith(elena);
|
350
|
-
} else {
|
351
|
-
expect(inactiveCallback).toHaveBeenCalledWith(elena);
|
352
|
-
}
|
344
|
+
expect(inactiveCallback).toHaveBeenCalledWith(elena);
|
353
345
|
});
|
354
346
|
});
|
355
347
|
|
356
348
|
it('should load even if @font-face is inserted after watching has started', function () {
|
357
349
|
var fontWatchRunner = new FontWatchRunner(activeCallback, inactiveCallback,
|
358
|
-
domHelper, sourceSansB, userAgent.getBrowserInfo(),
|
350
|
+
domHelper, sourceSansB, userAgent.getBrowserInfo(), 5000),
|
359
351
|
ruler = new FontRuler(domHelper, 'abcdef'),
|
360
352
|
monospace = new Font('monospace'),
|
361
353
|
sourceSansBFallback = new Font("'SourceSansB', monospace"),
|
@@ -400,44 +392,5 @@ describe('FontWatchRunner', function () {
|
|
400
392
|
expect(ruler.getWidth()).toEqual(activeWidth);
|
401
393
|
});
|
402
394
|
});
|
403
|
-
|
404
|
-
it('should load one weight after another', function () {
|
405
|
-
var fontWatchRunnerRegular = new FontWatchRunner(activeCallback, inactiveCallback,
|
406
|
-
domHelper, sourceSansC, userAgent.getBrowserInfo(), 500),
|
407
|
-
fontWatchRunnerBold = new FontWatchRunner(activeCallback, inactiveCallback,
|
408
|
-
domHelper, sourceSansCBold, userAgent.getBrowserInfo(), 500),
|
409
|
-
fontRulerA = new FontRuler(domHelper, 'abcdef'),
|
410
|
-
fontRulerB = new FontRuler(domHelper, 'abcdef');
|
411
|
-
|
412
|
-
runs(function () {
|
413
|
-
fontRulerA.insert();
|
414
|
-
fontRulerA.setFont(sourceSansC);
|
415
|
-
fontWatchRunnerRegular.start();
|
416
|
-
});
|
417
|
-
|
418
|
-
waitsFor(function () {
|
419
|
-
return activeCallback.wasCalled || inactiveCallback.wasCalled;
|
420
|
-
});
|
421
|
-
|
422
|
-
runs(function () {
|
423
|
-
expect(activeCallback).toHaveBeenCalledWith(sourceSansC);
|
424
|
-
|
425
|
-
activeCallback.reset();
|
426
|
-
inactiveCallback.reset();
|
427
|
-
|
428
|
-
fontRulerB.insert();
|
429
|
-
fontRulerB.setFont(sourceSansCBold);
|
430
|
-
fontWatchRunnerBold.start();
|
431
|
-
});
|
432
|
-
|
433
|
-
waitsFor(function () {
|
434
|
-
return activeCallback.wasCalled || inactiveCallback.wasCalled;
|
435
|
-
});
|
436
|
-
|
437
|
-
runs(function () {
|
438
|
-
expect(activeCallback).toHaveBeenCalledWith(sourceSansCBold);
|
439
|
-
expect(fontRulerA.getWidth()).not.toEqual(fontRulerB.getWidth());
|
440
|
-
});
|
441
|
-
});
|
442
395
|
});
|
443
396
|
});
|
@@ -558,9 +558,9 @@ describe('UserAgentParser', function () {
|
|
558
558
|
platform: 'Windows',
|
559
559
|
parsedPlatformVersion: new Version(5, 1),
|
560
560
|
platformVersion: '5.1',
|
561
|
-
engine: '
|
562
|
-
parsedEngineVersion: new Version(
|
563
|
-
engineVersion: '
|
561
|
+
engine: 'Unknown',
|
562
|
+
parsedEngineVersion: new Version(),
|
563
|
+
engineVersion: 'Unknown',
|
564
564
|
documentMode: undefined,
|
565
565
|
browserInfo: {
|
566
566
|
hasWebFontSupport: true,
|
@@ -577,9 +577,9 @@ describe('UserAgentParser', function () {
|
|
577
577
|
platform: 'Windows',
|
578
578
|
parsedPlatformVersion: new Version(5, 1),
|
579
579
|
platformVersion: '5.1',
|
580
|
-
engine: '
|
581
|
-
parsedEngineVersion: new Version(
|
582
|
-
engineVersion: '
|
580
|
+
engine: 'Unknown',
|
581
|
+
parsedEngineVersion: new Version(),
|
582
|
+
engineVersion: 'Unknown',
|
583
583
|
documentMode: undefined,
|
584
584
|
browserInfo: {
|
585
585
|
hasWebFontSupport: true,
|
@@ -598,9 +598,9 @@ describe('UserAgentParser', function () {
|
|
598
598
|
platform: 'Windows',
|
599
599
|
parsedPlatformVersion: new Version(5, 1),
|
600
600
|
platformVersion: '5.1',
|
601
|
-
engine: '
|
602
|
-
parsedEngineVersion: new Version(
|
603
|
-
engineVersion: '
|
601
|
+
engine: 'Unknown',
|
602
|
+
parsedEngineVersion: new Version(),
|
603
|
+
engineVersion: 'Unknown',
|
604
604
|
documentMode: undefined,
|
605
605
|
browserInfo: {
|
606
606
|
hasWebFontSupport: true,
|
@@ -619,9 +619,9 @@ describe('UserAgentParser', function () {
|
|
619
619
|
platform: 'Windows Phone',
|
620
620
|
parsedPlatformVersion: new Version(8, 0),
|
621
621
|
platformVersion: '8.0',
|
622
|
-
engine: '
|
623
|
-
parsedEngineVersion: new Version(
|
624
|
-
engineVersion: '
|
622
|
+
engine: 'Trident',
|
623
|
+
parsedEngineVersion: new Version(6, 0),
|
624
|
+
engineVersion: '6.0',
|
625
625
|
documentMode: undefined,
|
626
626
|
browserInfo: {
|
627
627
|
hasWebFontSupport: true,
|
@@ -640,9 +640,9 @@ describe('UserAgentParser', function () {
|
|
640
640
|
platform: 'Windows Phone',
|
641
641
|
parsedPlatformVersion: new Version(7, 5),
|
642
642
|
platformVersion: '7.5',
|
643
|
-
engine: '
|
644
|
-
parsedEngineVersion: new Version(
|
645
|
-
engineVersion: '
|
643
|
+
engine: 'Trident',
|
644
|
+
parsedEngineVersion: new Version(5, 0),
|
645
|
+
engineVersion: '5.0',
|
646
646
|
documentMode: undefined,
|
647
647
|
browserInfo: {
|
648
648
|
hasWebFontSupport: false,
|
@@ -661,9 +661,9 @@ describe('UserAgentParser', function () {
|
|
661
661
|
platform: 'Macintosh',
|
662
662
|
parsedPlatformVersion: new Version(),
|
663
663
|
platformVersion: 'Unknown',
|
664
|
-
engine: '
|
665
|
-
parsedEngineVersion: new Version(
|
666
|
-
engineVersion: '
|
664
|
+
engine: 'Unknown',
|
665
|
+
parsedEngineVersion: new Version(),
|
666
|
+
engineVersion: 'Unknown',
|
667
667
|
documentMode: undefined,
|
668
668
|
browserInfo: {
|
669
669
|
hasWebFontSupport: false,
|
@@ -673,7 +673,7 @@ describe('UserAgentParser', function () {
|
|
673
673
|
});
|
674
674
|
});
|
675
675
|
|
676
|
-
it('should detect Internet Explorer with Trident
|
676
|
+
it('should detect Internet Explorer with Trident version', function () {
|
677
677
|
expect(parse('Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; WOW64; Trident/4.0; SLCC2; .NET CLR 2.0.50727; InfoPath.2)', { documentMode: 8 }))
|
678
678
|
.toMatchUserAgent({
|
679
679
|
name: 'MSIE',
|
@@ -682,9 +682,9 @@ describe('UserAgentParser', function () {
|
|
682
682
|
platform: 'Windows',
|
683
683
|
parsedPlatformVersion: new Version(6, 1),
|
684
684
|
platformVersion: '6.1',
|
685
|
-
engine: '
|
686
|
-
parsedEngineVersion: new Version(
|
687
|
-
engineVersion: '
|
685
|
+
engine: 'Trident',
|
686
|
+
parsedEngineVersion: new Version(4, 0),
|
687
|
+
engineVersion: '4.0',
|
688
688
|
documentMode: 8,
|
689
689
|
browserInfo: {
|
690
690
|
hasWebFontSupport: true,
|
@@ -693,6 +693,27 @@ describe('UserAgentParser', function () {
|
|
693
693
|
}
|
694
694
|
});
|
695
695
|
});
|
696
|
+
|
697
|
+
it('should detect Internet Explorer 11', function () {
|
698
|
+
expect(parse('Mozilla/5.0 (Windows NT 6.3; Trident/7.0; rv:11.0) like Gecko', { documentMode: 11 }))
|
699
|
+
.toMatchUserAgent({
|
700
|
+
name: 'MSIE',
|
701
|
+
parsedVersion: new Version(11, 0),
|
702
|
+
version: '11.0',
|
703
|
+
platform: 'Windows',
|
704
|
+
parsedPlatformVersion: new Version(6, 3),
|
705
|
+
platformVersion: '6.3',
|
706
|
+
engine: 'Trident',
|
707
|
+
parsedEngineVersion: new Version(7, 0),
|
708
|
+
engineVersion: '7.0',
|
709
|
+
documentMode: 11,
|
710
|
+
browserInfo: {
|
711
|
+
hasWebFontSupport: true,
|
712
|
+
hasWebKitFallbackBug: false,
|
713
|
+
hasWebKitMetricsBug: false
|
714
|
+
}
|
715
|
+
});
|
716
|
+
});
|
696
717
|
});
|
697
718
|
|
698
719
|
describe('Builtin Browser', function () {
|
data/spec/index.html
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
<!doctype html>
|
2
2
|
<html>
|
3
3
|
<head>
|
4
|
+
<meta name="viewport" content="width=device-width, initial-scale=1">
|
4
5
|
<title>Webfontloader tests</title>
|
5
6
|
<link rel="stylesheet" href="../tools/jasmine/jasmine.css">
|
6
7
|
|
@@ -9,9 +10,6 @@
|
|
9
10
|
<link rel="stylesheet" href="fixtures/fonts/nullfont2.css">
|
10
11
|
<link rel="stylesheet" href="fixtures/fonts/nullfont3.css">
|
11
12
|
<link rel="stylesheet" href="fixtures/fonts/sourcesansa.css">
|
12
|
-
<link rel="stylesheet" href="fixtures/fonts/sourcesansb.css">
|
13
|
-
<link rel="stylesheet" href="fixtures/fonts/sourcesansc.css">
|
14
|
-
<link rel="stylesheet" href="fixtures/fonts/sourcesanscbold.css">
|
15
13
|
</head>
|
16
14
|
<body>
|
17
15
|
<script>
|
@@ -26,14 +24,6 @@
|
|
26
24
|
|
27
25
|
<script>
|
28
26
|
goog.require('webfont');
|
29
|
-
|
30
|
-
// Require the modules because they don't have an explicit
|
31
|
-
// dependency on core.
|
32
|
-
goog.require('webfont.modules.Typekit');
|
33
|
-
goog.require('webfont.modules.Fontdeck');
|
34
|
-
goog.require('webfont.modules.Monotype');
|
35
|
-
goog.require('webfont.modules.Custom');
|
36
|
-
goog.require('webfont.modules.google.GoogleFontApi');
|
37
27
|
</script>
|
38
28
|
|
39
29
|
<script src="../spec/core/domhelper_spec.js"></script>
|
data/spec/modules/custom_spec.js
CHANGED
@@ -15,7 +15,10 @@ describe('modules.Custom', function () {
|
|
15
15
|
|
16
16
|
var defaultModule = new Custom(fakeDomHelper, {
|
17
17
|
families: ['Font1', 'Font2', 'Font3'],
|
18
|
-
urls: ['http://moo', 'http://meuh']
|
18
|
+
urls: ['http://moo', 'http://meuh'],
|
19
|
+
testStrings: {
|
20
|
+
Font3: 'hello world'
|
21
|
+
}
|
19
22
|
});
|
20
23
|
|
21
24
|
defaultModule.load(load);
|
@@ -34,5 +37,10 @@ describe('modules.Custom', function () {
|
|
34
37
|
expect(load.calls[0].args[0][1].getName()).toEqual('Font2');
|
35
38
|
expect(load.calls[0].args[0][2].getName()).toEqual('Font3');
|
36
39
|
});
|
40
|
+
|
41
|
+
it('should have set a custom test string', function () {
|
42
|
+
expect(load.callCount).toEqual(1);
|
43
|
+
expect(load.calls[0].args[1]).toEqual({ Font3: 'hello world' });
|
44
|
+
});
|
37
45
|
});
|
38
46
|
});
|
data/src/core/useragentparser.js
CHANGED
@@ -141,7 +141,7 @@ goog.scope(function () {
|
|
141
141
|
* @private
|
142
142
|
*/
|
143
143
|
UserAgentParser.prototype.isIe_ = function() {
|
144
|
-
return this.userAgent_.indexOf("MSIE") != -1;
|
144
|
+
return this.userAgent_.indexOf("MSIE") != -1 || this.userAgent_.indexOf("Trident/") != -1;
|
145
145
|
};
|
146
146
|
|
147
147
|
/**
|
@@ -151,21 +151,40 @@ goog.scope(function () {
|
|
151
151
|
var platform = this.getPlatform_(),
|
152
152
|
platformVersionString = this.getPlatformVersionString_(),
|
153
153
|
platformVersion = Version.parse(platformVersionString),
|
154
|
-
browserVersionString =
|
155
|
-
browserVersion =
|
156
|
-
|
157
|
-
|
154
|
+
browserVersionString = null,
|
155
|
+
browserVersion = null,
|
156
|
+
engine = null,
|
157
|
+
engineVersion = null,
|
158
|
+
engineVersionString = this.getMatchingGroup_(this.userAgent_, /Trident\/([\d\w\.]+)/, 1),
|
159
|
+
documentMode = this.getDocumentMode_(this.doc_);
|
160
|
+
|
161
|
+
if (this.userAgent_.indexOf("MSIE") != -1) {
|
162
|
+
browserVersionString = this.getMatchingGroup_(this.userAgent_, /MSIE ([\d\w\.]+)/, 1);
|
163
|
+
} else {
|
164
|
+
browserVersionString = this.getMatchingGroup_(this.userAgent_, /rv:([\d\w\.]+)/, 1);
|
165
|
+
}
|
166
|
+
|
167
|
+
browserVersion = Version.parse(browserVersionString);
|
168
|
+
|
169
|
+
if (engineVersionString != '') {
|
170
|
+
engine = 'Trident';
|
171
|
+
engineVersion = Version.parse(engineVersionString);
|
172
|
+
} else {
|
173
|
+
engine = UserAgentParser.UNKNOWN;
|
174
|
+
engineVersion = new Version();
|
175
|
+
engineVersionString = UserAgentParser.UNKNOWN;
|
176
|
+
}
|
177
|
+
|
178
|
+
var supportWebFont = (platform == "Windows" && browserVersion.major >= 6) ||
|
158
179
|
(platform == "Windows Phone" && platformVersion.major >= 8);
|
159
180
|
|
160
|
-
// For IE we give MSIE as the engine name and the version of IE
|
161
|
-
// instead of the specific Trident engine name and version
|
162
181
|
return new UserAgent(
|
163
182
|
"MSIE",
|
164
183
|
browserVersion,
|
165
184
|
browserVersionString,
|
166
|
-
|
167
|
-
|
168
|
-
|
185
|
+
engine,
|
186
|
+
engineVersion,
|
187
|
+
engineVersionString,
|
169
188
|
platform,
|
170
189
|
platformVersion,
|
171
190
|
platformVersionString,
|
data/src/modules/custom.js
CHANGED
@@ -32,6 +32,7 @@ goog.scope(function () {
|
|
32
32
|
var i, len;
|
33
33
|
var urls = this.configuration_['urls'] || [];
|
34
34
|
var familiesConfiguration = this.configuration_['families'] || [];
|
35
|
+
var fontTestStrings = this.configuration_['testStrings'] || {};
|
35
36
|
|
36
37
|
for (i = 0, len = urls.length; i < len; i++) {
|
37
38
|
this.domHelper_.loadStylesheet(urls[i]);
|
@@ -53,7 +54,7 @@ goog.scope(function () {
|
|
53
54
|
}
|
54
55
|
}
|
55
56
|
|
56
|
-
onReady(fonts);
|
57
|
+
onReady(fonts, fontTestStrings);
|
57
58
|
};
|
58
59
|
|
59
60
|
Custom.prototype.supportUserAgent = function(userAgent, support) {
|
data/webfontloader.gemspec
CHANGED
@@ -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.
|
17
|
-
s.date = '2013-
|
16
|
+
s.version = '1.5.0'
|
17
|
+
s.date = '2013-09-09'
|
18
18
|
|
19
19
|
## Make sure your summary is short. The description may be as long
|
20
20
|
## as you like.
|
@@ -133,9 +133,6 @@ DESC
|
|
133
133
|
spec/fixtures/fonts/sourcesans.woff
|
134
134
|
spec/fixtures/fonts/sourcesansa.css
|
135
135
|
spec/fixtures/fonts/sourcesansb.css
|
136
|
-
spec/fixtures/fonts/sourcesansc.css
|
137
|
-
spec/fixtures/fonts/sourcesanscbold.css
|
138
|
-
spec/fixtures/fonts/sourcesanscbold.otf
|
139
136
|
spec/index.html
|
140
137
|
spec/modules/custom_spec.js
|
141
138
|
spec/modules/fontdeck_spec.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:
|
4
|
+
hash: 3
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 1
|
8
|
-
-
|
9
|
-
-
|
10
|
-
version: 1.
|
8
|
+
- 5
|
9
|
+
- 0
|
10
|
+
version: 1.5.0
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Ryan Carver
|
@@ -16,7 +16,7 @@ autorequire:
|
|
16
16
|
bindir: bin
|
17
17
|
cert_chain: []
|
18
18
|
|
19
|
-
date: 2013-
|
19
|
+
date: 2013-09-09 00:00:00 Z
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|
22
22
|
name: rake
|
@@ -161,9 +161,6 @@ files:
|
|
161
161
|
- spec/fixtures/fonts/sourcesans.woff
|
162
162
|
- spec/fixtures/fonts/sourcesansa.css
|
163
163
|
- spec/fixtures/fonts/sourcesansb.css
|
164
|
-
- spec/fixtures/fonts/sourcesansc.css
|
165
|
-
- spec/fixtures/fonts/sourcesanscbold.css
|
166
|
-
- spec/fixtures/fonts/sourcesanscbold.otf
|
167
164
|
- spec/index.html
|
168
165
|
- spec/modules/custom_spec.js
|
169
166
|
- spec/modules/fontdeck_spec.js
|
@@ -1 +0,0 @@
|
|
1
|
-
@font-face{font-family:SourceSansC;src:url(sourcesans.eot?#iefix) format('embedded-opentype'),url(sourcesans.woff) format('woff'),url(sourcesans.otf) format('opentype'),url(sourcesans.ttf) format('truetype'),url(sourcesans.svg#source_sans_proregular) format('svg');font-weight:normal;font-style:normal;}
|
@@ -1 +0,0 @@
|
|
1
|
-
@font-face{font-family:SourceSansC;src:url(sourcesanscbold.otf) format('opentype');font-weight:bold;font-style:normal;}
|
Binary file
|