forked from WebKit/WebKit-http
-
Notifications
You must be signed in to change notification settings - Fork 0
/
font-feature-settings-font-face-rendering.html
106 lines (102 loc) · 6.69 KB
/
font-feature-settings-font-face-rendering.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
<!DOCTYPE html>
<html>
<head>
<style>
@font-face {
font-family: "FontFeaturesTestOTF";
src: url("resources/FontWithFeatures.otf") format("opentype");
}
@font-face {
font-family: "FontFeaturesTestTTF";
src: url("resources/FontWithFeatures.ttf") format("truetype");
}
</style>
</head>
<body>
This tests that font features are able to be turned on and off as desired. It uses a special font
designed specifically for this purpose. The test passes if you see a sequence of alternating check
marks and X below.
<div id="insertionPoint"></div>
<div id="insertionPoint2"></div>
<script>
var insertionPoint = document.getElementById("insertionPoint");
var insertionPoint2 = document.getElementById("insertionPoint2");
var styleNode = document.createElement("style");
document.head.appendChild(styleNode);
function addElement(placeToInsert, familyName, extension, format, feature, c) {
["0", "1"].map(function(state) {
styleNode.sheet.insertRule("@font-face { font-family: " + familyName + "_" + feature + "_" + state + "; src: url('resources/FontWithFeatures." + extension + "') format('" + format + "'); font-feature-settings: '" + feature + "'" + state + "; }", 0);
var element = document.createElement("span");
element.textContent = c + c;
element.style.fontFamily = familyName + "_" + feature + "_" + state;
placeToInsert.appendChild(element);
});
placeToInsert.appendChild(document.createTextNode(" "));
}
addElement(insertionPoint, "FontFeaturesTestOTF", "otf", "opentype", "liga", "C");
addElement(insertionPoint, "FontFeaturesTestOTF", "otf", "opentype", "clig", "D");
addElement(insertionPoint, "FontFeaturesTestOTF", "otf", "opentype", "dlig", "E");
addElement(insertionPoint, "FontFeaturesTestOTF", "otf", "opentype", "hlig", "F");
addElement(insertionPoint, "FontFeaturesTestOTF", "otf", "opentype", "calt", "G");
addElement(insertionPoint, "FontFeaturesTestOTF", "otf", "opentype", "subs", "H");
addElement(insertionPoint, "FontFeaturesTestOTF", "otf", "opentype", "sups", "I");
addElement(insertionPoint, "FontFeaturesTestOTF", "otf", "opentype", "smcp", "J");
addElement(insertionPoint, "FontFeaturesTestOTF", "otf", "opentype", "c2sc", "K");
addElement(insertionPoint, "FontFeaturesTestOTF", "otf", "opentype", "pcap", "L");
addElement(insertionPoint, "FontFeaturesTestOTF", "otf", "opentype", "c2pc", "M");
addElement(insertionPoint, "FontFeaturesTestOTF", "otf", "opentype", "unic", "N");
addElement(insertionPoint, "FontFeaturesTestOTF", "otf", "opentype", "titl", "O");
addElement(insertionPoint, "FontFeaturesTestOTF", "otf", "opentype", "lnum", "P");
addElement(insertionPoint, "FontFeaturesTestOTF", "otf", "opentype", "onum", "Q");
addElement(insertionPoint, "FontFeaturesTestOTF", "otf", "opentype", "pnum", "R");
addElement(insertionPoint, "FontFeaturesTestOTF", "otf", "opentype", "tnum", "S");
addElement(insertionPoint, "FontFeaturesTestOTF", "otf", "opentype", "frac", "T");
//addElement(insertionPoint, "FontFeaturesTestOTF", "otf", "opentype", "afrc", "U");
addElement(insertionPoint, "FontFeaturesTestOTF", "otf", "opentype", "ordn", "V");
addElement(insertionPoint, "FontFeaturesTestOTF", "otf", "opentype", "zero", "W");
addElement(insertionPoint, "FontFeaturesTestOTF", "otf", "opentype", "hist", "X");
addElement(insertionPoint, "FontFeaturesTestOTF", "otf", "opentype", "jp78", "Y");
addElement(insertionPoint, "FontFeaturesTestOTF", "otf", "opentype", "jp83", "Z");
addElement(insertionPoint, "FontFeaturesTestOTF", "otf", "opentype", "jp90", "a");
addElement(insertionPoint, "FontFeaturesTestOTF", "otf", "opentype", "jp04", "b");
addElement(insertionPoint, "FontFeaturesTestOTF", "otf", "opentype", "smpl", "c");
addElement(insertionPoint, "FontFeaturesTestOTF", "otf", "opentype", "trad", "d");
addElement(insertionPoint, "FontFeaturesTestOTF", "otf", "opentype", "fwid", "e");
addElement(insertionPoint, "FontFeaturesTestOTF", "otf", "opentype", "pwid", "f");
addElement(insertionPoint, "FontFeaturesTestOTF", "otf", "opentype", "ruby", "g");
addElement(insertionPoint2, "FontFeaturesTestTTF", "ttf", "truetype", "liga", "C");
addElement(insertionPoint2, "FontFeaturesTestTTF", "ttf", "truetype", "liga", "D");
addElement(insertionPoint2, "FontFeaturesTestTTF", "ttf", "truetype", "clig", "C");
addElement(insertionPoint2, "FontFeaturesTestTTF", "ttf", "truetype", "clig", "D");
addElement(insertionPoint2, "FontFeaturesTestTTF", "ttf", "truetype", "dlig", "G");
addElement(insertionPoint2, "FontFeaturesTestTTF", "ttf", "truetype", "hlig", "I");
addElement(insertionPoint2, "FontFeaturesTestTTF", "ttf", "truetype", "calt", "L");
addElement(insertionPoint2, "FontFeaturesTestTTF", "ttf", "truetype", "subs", "O");
addElement(insertionPoint2, "FontFeaturesTestTTF", "ttf", "truetype", "sups", "P");
addElement(insertionPoint2, "FontFeaturesTestTTF", "ttf", "truetype", "smcp", "S");
addElement(insertionPoint2, "FontFeaturesTestTTF", "ttf", "truetype", "c2sc", "V");
addElement(insertionPoint2, "FontFeaturesTestTTF", "ttf", "truetype", "pcap", "T");
addElement(insertionPoint2, "FontFeaturesTestTTF", "ttf", "truetype", "c2pc", "W");
addElement(insertionPoint2, "FontFeaturesTestTTF", "ttf", "truetype", "unic", "Y");
addElement(insertionPoint2, "FontFeaturesTestTTF", "ttf", "truetype", "titl", "a");
addElement(insertionPoint2, "FontFeaturesTestTTF", "ttf", "truetype", "lnum", "c");
addElement(insertionPoint2, "FontFeaturesTestTTF", "ttf", "truetype", "onum", "d");
addElement(insertionPoint2, "FontFeaturesTestTTF", "ttf", "truetype", "pnum", "f");
addElement(insertionPoint2, "FontFeaturesTestTTF", "ttf", "truetype", "tnum", "g");
addElement(insertionPoint2, "FontFeaturesTestTTF", "ttf", "truetype", "frac", "i");
addElement(insertionPoint2, "FontFeaturesTestTTF", "ttf", "truetype", "afrc", "j");
addElement(insertionPoint2, "FontFeaturesTestTTF", "ttf", "truetype", "ordn", "Q");
addElement(insertionPoint2, "FontFeaturesTestTTF", "ttf", "truetype", "zero", "k");
addElement(insertionPoint2, "FontFeaturesTestTTF", "ttf", "truetype", "hist", "K");
addElement(insertionPoint2, "FontFeaturesTestTTF", "ttf", "truetype", "jp78", "m");
addElement(insertionPoint2, "FontFeaturesTestTTF", "ttf", "truetype", "jp83", "n");
addElement(insertionPoint2, "FontFeaturesTestTTF", "ttf", "truetype", "jp90", "o");
addElement(insertionPoint2, "FontFeaturesTestTTF", "ttf", "truetype", "jp04", "p");
addElement(insertionPoint2, "FontFeaturesTestTTF", "ttf", "truetype", "smpl", "q");
addElement(insertionPoint2, "FontFeaturesTestTTF", "ttf", "truetype", "trad", "r");
addElement(insertionPoint2, "FontFeaturesTestTTF", "ttf", "truetype", "fwid", "t");
addElement(insertionPoint2, "FontFeaturesTestTTF", "ttf", "truetype", "pwid", "u");
addElement(insertionPoint2, "FontFeaturesTestTTF", "ttf", "truetype", "ruby", "v");
</script>
</body>
</html>