Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(362)

Side by Side Diff: LayoutTests/fast/css/font-face-unicode-range-load.html

Issue 23446007: Use unicode-range to prevent unnecessary @font-face donwnloads (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: rebase and add toSegmentedFontData() Created 7 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | LayoutTests/fast/css/font-face-unicode-range-load-expected.txt » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 <html>
2 <head>
3 <script src="../js/resources/js-test-pre.js"></script>
4 <script>
5 description('Tests that unicode-range descriptor is used to selectively download fonts that are used in document.');
6
7 window.jsTestIsAsync = true;
8
9 var latin1Loaded = false;
10 var cyrillicLoaded = false;
11 var arabicLoaded = false;
12
13 function runTests() {
14 document.fonts.addEventListener('load', onload);
15 document.fonts.notifyWhenFontsReady(verify);
16 }
17
18 function onload(e) {
19 var range = e.fontfaces[0].unicodeRange;
20 if (range == 'U+0-FF')
21 latin1Loaded = true;
22 if (range == 'U+400-4FF')
23 cyrillicLoaded = true;
24 if (range == 'U+600-6FF')
25 arabicLoaded = true;
26 }
27
28 function verify() {
29 shouldBeTrue('latin1Loaded'); // Latin-1 font is loaded for basic font metri cs.
30 shouldBeTrue('cyrillicLoaded');
31 shouldBeFalse('arabicLoaded');
32 finishJSTest();
33 }
34
35 if (document.fonts)
36 runTests();
37 else {
38 testFailed('document.fonts does not exist');
39 finishJSTest();
40 }
41 </script>
42 <style>
43 @font-face {
44 font-family: TestFont;
45 src: url('../../resources/Ahem.ttf');
46 unicode-range: U+00-0FF; /* Latin-1 */
47 }
48 @font-face {
49 font-family: TestFont;
50 src: url('../../resources/Ahem.otf');
51 unicode-range: U+0400-04FF; /* Cyrillic */
52 }
53 @font-face {
54 font-family: TestFont;
55 src: url('../../resources/Ahem.woff');
56 unicode-range: U+0600-06FF; /* Arabic */
57 }
58 #test {
59 font-family: TestFont;
60 }
61 </style>
62 </head>
63 <body>
64 <p id="test">&#x41F;&#x440;&#x43E;&#x432;&#x435;&#x440;&#x43A;&#x430;</p>
65 <script src="../js/resources/js-test-post.js"></script>
66 </body>
67 </html>
OLDNEW
« no previous file with comments | « no previous file | LayoutTests/fast/css/font-face-unicode-range-load-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698