| <!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> |