| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778 |
- <!doctype html>
- <html>
- <head>
- <meta charset="utf-8">
- <title>074 font-face variants</title>
- <style>
- /* The regular face lists WOFF2 first (unsupported, skipped) and a WOFF 1.0
- * copy of the built-in mono face second. */
- @font-face {
- font-family: "Ladder Var";
- src: local("Ladder Var"), url("ladder-mono.woff2") format("woff2"),
- url("ladder-mono.woff") format("woff");
- }
- /* The bold face of the same family is the built-in sans bold. */
- @font-face {
- font-family: "Ladder Var";
- font-weight: 700;
- src: url("ladder-sans-b.ttf") format("truetype");
- }
- /* A non-Latin subset with the same family/weight/style must not replace
- * the regular face (Google Fonts lists latin last). */
- @font-face {
- font-family: "Ladder Var";
- unicode-range: U+0400-045F, U+0490-0491;
- src: url("does-not-exist-cyrillic.ttf") format("truetype");
- }
- /* Never referenced: must not be fetched (check the [font] log). */
- @font-face {
- font-family: "Never Used";
- src: url("never-used.ttf") format("truetype");
- }
- html, body { margin: 0; padding: 0; background: #ffffff; color: #202020; }
- body { font-family: sans-serif; font-size: 13px; padding: 10px; }
- h1 { font-size: 20px; margin: 0 0 6px 0; }
- p { margin: 0 0 10px 0; }
- .pane { float: left; width: 440px; margin-left: 10px; }
- .label { background: #eeeeee; padding: 4px 6px; margin-bottom: 4px; }
- .box { width: 400px; background: #f4f4f4; border: 1px solid #999999; padding: 6px; margin-bottom: 8px; }
- .var { font-family: "Ladder Var", sans-serif; font-size: 15px; }
- .var-b { font-family: "Ladder Var", sans-serif; font-size: 15px; font-weight: bold; }
- .short { font: 15px "Ladder Var", sans-serif; }
- .mono { font-family: monospace; font-size: 15px; }
- .sans-b { font-family: sans-serif; font-size: 15px; font-weight: bold; }
- #result { clear: both; margin-top: 14px; padding: 8px; background: #eeeeee; color: #000000; font-family: monospace; font-weight: bold; }
- </style>
- </head>
- <body>
- <h1>074 · @font-face variants</h1>
- <p>One family with a WOFF regular face and a TTF bold face; the font shorthand names the family too. Each A row must look like its B row.</p>
- <div class="pane">
- <div class="label">A · "Ladder Var"</div>
- <div class="box"><span class="var">Regular: the quick brown fox 0123</span></div>
- <div class="box"><span class="var-b">Bold: the quick brown fox 0123</span></div>
- <div class="box"><span class="short">Shorthand: the quick brown fox 0123</span></div>
- </div>
- <div class="pane">
- <div class="label">B · reference</div>
- <div class="box"><span class="mono">Regular: the quick brown fox 0123</span></div>
- <div class="box"><span class="sans-b">Bold: the quick brown fox 0123</span></div>
- <div class="box"><span class="mono">Shorthand: the quick brown fox 0123</span></div>
- </div>
- <div id="result">checking...</div>
- <script>
- /* The font rendering itself is the A/B comparison above (A must look like
- * B row by row). The script checks the CSS Font Loading API surface. */
- setTimeout(function () {
- var ok = typeof FontFace === 'function' &&
- new FontFace('X', 'url(x.ttf)').status === 'loaded' &&
- document.fonts.size === 0 &&
- document.fonts.check('15px "Ladder Var"') &&
- typeof document.fonts.ready.then === 'function';
- var out = document.getElementById('result');
- out.textContent = (ok ? 'PASS' : 'FAIL') + ': FontFace / document.fonts API';
- out.style.background = ok ? '#ccffcc' : '#ffcccc';
- }, 300);
- </script>
- </body>
- </html>
|