3 <script src=
"../../resources/js-test.js"></script>
5 description('Tests that unicode-range descriptor is used to selectively download fonts that are used in document.');
7 window
.jsTestIsAsync
= true;
9 var latin1Loaded
= false;
10 var cyrillicLoaded
= false;
11 var arabicLoaded
= false;
12 var iconLoaded
= false;
15 document
.fonts
.addEventListener('loadingdone', onloadingdone
);
18 function onloadingdone(e
) {
19 for (var i
= 0; i
< e
.fontfaces
.length
; i
++) {
20 var range
= e
.fontfaces
[i
].unicodeRange
;
21 if (range
== 'U+0-FF')
23 if (range
== 'U+400-4FF')
24 cyrillicLoaded
= true;
25 if (range
== 'U+600-6FF')
27 if (range
== 'U+E000')
31 shouldBeFalse('latin1Loaded');
32 shouldBeTrue('cyrillicLoaded');
33 shouldBeFalse('arabicLoaded');
34 shouldBeFalse('iconLoaded');
41 testFailed('document.fonts does not exist');
47 font-family: TestFont;
48 src: url('../../resources/Ahem.ttf');
49 unicode-range: U+
00-
0FF; /* Latin-
1 */
52 font-family: TestFont;
53 src: url('../../resources/Ahem.otf');
54 unicode-range: U+
0400-
04FF; /* Cyrillic */
57 font-family: TestFont;
58 src: url('../../resources/Ahem.woff');
59 unicode-range: U+
0600-
06FF; /* Arabic */
62 font-family: TestFont;
66 font-family: SingleCharacterOverride;
67 src: url('../../resources/Ahem.woff');
68 unicode-range: U+E000;
71 font-family: SingleCharacterOverride;
76 <p id=
"test">Проверка</p>
77 <p id=
"test2">hello
</p>