Wed, 06 Feb 2013 10:00:12 -0700
[css3-fonts] add animatable attribute to font properties
1 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"
2 "http://www.w3.org/TR/html4/strict.dtd">
4 <html lang=en>
5 <head><meta content="text/html;charset=utf-8" http-equiv=Content-Type>
7 <title>CSS Fonts Module Level 3</title>
8 <!--
9 FIXME when publishing: copy the current default.css and link to
10 "default.css" rather than "../default.css"
11 -->
12 <link href="../default.css" rel=stylesheet type="text/css">
13 <link href="../csslogo.ico" rel="shortcut icon" type="image/x-icon">
14 <!-- I'm just experimenting here, don't get your bee in a bonnet -->
15 <script src="http://use.typekit.com/xon2bky.js"
16 type="text/javascript"></script>
17 <script type="text/javascript">try{Typekit.load();}catch(e){}</script>
19 <style type="text/css">
21 body, th, td, h1, h2, h3, h4, h5, h6 {
22 font-family: "myriad-pro", sans-serif !important;
23 }
25 body {
26 padding: 2em 70px 2em 70px;
27 }
29 p + p, p.mtb {
30 margin-top: 0.8em;
31 text-indent: 0px;
32 }
34 #bolderlighter {
35 width: 40%;
36 }
38 #bolderlighter th {
39 text-align: center;
40 }
42 #fontformats td, #eventhandlers td, #fontformats th, #eventhandlers th {
43 padding-right: 2em;
44 text-align: left;
45 }
47 dd {
48 margin-bottom: 1em;
49 }
51 #authors dd {
52 margin-bottom: 0;
53 }
55 #fontstylematchingalg {
56 list-style-type: lower-alpha;
57 }
59 #fontmatchingalg ul, #fontmatchingalg ol {
60 margin-top: 0.8em;
61 }
63 #fontmatchingalg li + li {
64 margin-top: 0.8em;
65 }
67 div.example {
68 padding: 1em;
69 margin-top: 1em;
70 }
72 div.example + div.example {
73 margin-top: 2em;
74 }
76 div.figure {
77 page-break-inside: avoid;
78 }
80 pre.prod { white-space: pre-wrap; margin: 1em 0 1em 2em }
82 div.featex {
83 width: 700px;
84 }
86 div.featex img {
87 margin: auto;
88 display: block;
89 }
91 span.tag {
92 font-family: monospace;
93 font-size: 120%;
94 }
96 ol ol {
97 list-style-type: lower-alpha;
98 }
100 .idl-code {
101 font-weight: bold;
102 color: #c50;
103 }
104 </style>
105 <link href="http://www.w3.org/StyleSheets/TR/W3C-WD.css" rel=stylesheet
106 type="text/css">
108 <body>
109 <div class=head> <!--begin-logo-->
110 <p><a href="http://www.w3.org/"><img alt=W3C height=48
111 src="http://www.w3.org/Icons/w3c_home" width=72></a> <!--end-logo-->
113 <h1>CSS Fonts Module Level 3</h1>
115 <h2 class="no-num no-toc" id=w3c-working-draft-12-february-2013>W3C
116 Working Draft 12 February 2013</h2>
118 <dl id=authors>
119 <dt>This version:</dt>
120 <!-- <dd><a href="http://dev.w3.org/csswg/css3-fonts/">http://dev.w3.org/csswg/css3-fonts/</a> -->
122 <dd><a
123 href="http://www.w3.org/TR/2013/WD-css3-fonts-20130212/">http://www.w3.org/TR/2013/WD-css3-fonts-20130212/</a>
126 <dt>Latest version:
128 <dd><a
129 href="http://www.w3.org/TR/css3-fonts/">http://www.w3.org/TR/css3-fonts/</a>
131 <dt>Latest editor's draft:
133 <dd><a
134 href="http://dev.w3.org/csswg/css3-fonts/">http://dev.w3.org/csswg/css3-fonts/</a>
136 <dt>Previous version:
138 <dd><a
139 href="http://www.w3.org/TR/2012/WD-css3-fonts-20121211/">http://www.w3.org/TR/2012/WD-css3-fonts-20121211/</a>
141 <dt>Issues List:
143 <dd><a href="http://www.w3.org/Style/CSS/Tracker/products/18">CSS3 Fonts
144 issues in Tracker</a>
146 <dd><a
147 href="https://www.w3.org/Bugs/Public/buglist.cgi?query_format=advanced&product=CSS&component=Fonts&bug_status=NEW&bug_status=ASSIGNED&bug_status=REOPENED">CSS3
148 Fonts issues in Bugzilla</a>
150 <dt>Discussion:
152 <dd><a
153 href="http://lists.w3.org/Archives/Public/www-style/">www-style@w3.org</a>
154 with subject line “<kbd>[css3-fonts] topic</kbd>”
156 <dt>Editor:
158 <dd><a href="mailto:jdaggett@mozilla.com">John Daggett (Mozilla)</a>
159 </dl>
160 <!--begin-copyright-->
161 <p class=copyright><a
162 href="http://www.w3.org/Consortium/Legal/ipr-notice#Copyright"
163 rel=license>Copyright</a> © 2013 <a href="http://www.w3.org/"><abbr
164 title="World Wide Web Consortium">W3C</abbr></a><sup>®</sup> (<a
165 href="http://www.csail.mit.edu/"><abbr title="Massachusetts Institute of
166 Technology">MIT</abbr></a>, <a href="http://www.ercim.eu/"><abbr
167 title="European Research Consortium for Informatics and
168 Mathematics">ERCIM</abbr></a>, <a href="http://www.keio.ac.jp/">Keio</a>,
169 <a href="http://ev.buaa.edu.cn/">Beihang</a>), All Rights Reserved. W3C
170 <a
171 href="http://www.w3.org/Consortium/Legal/ipr-notice#Legal_Disclaimer">liability</a>,
172 <a
173 href="http://www.w3.org/Consortium/Legal/ipr-notice#W3C_Trademarks">trademark</a>
174 and <a
175 href="http://www.w3.org/Consortium/Legal/copyright-documents">document
176 use</a> rules apply.</p>
177 <!--end-copyright-->
178 <hr title="Separator for header">
179 </div>
181 <h2 class="no-num no-toc" id=abstract>Abstract</h2>
183 <p>This CSS3 module describes how font properties are specified and how
184 font resources are loaded dynamically. The contents of this specification
185 are a consolidation of content previously divided into <a
186 href="http://www.w3.org/TR/2002/WD-css3-fonts-20020802/">CSS3 Fonts</a>
187 and <a href="http://www.w3.org/TR/2002/WD-css3-webfonts-20020802/">CSS3
188 Web Fonts</a> modules.
190 <h2 class="no-num no-toc" id=status>Status of this document</h2>
191 <!--begin-status-->
193 <p><em>This section describes the status of this document at the time of
194 its publication. Other documents may supersede this document. A list of
195 current W3C publications and the latest revision of this technical report
196 can be found in the <a href="http://www.w3.org/TR/">W3C technical reports
197 index at http://www.w3.org/TR/.</a></em>
199 <p>Publication as a Working Draft does not imply endorsement by the W3C
200 Membership. This is a draft document and may be updated, replaced or
201 obsoleted by other documents at any time. It is inappropriate to cite this
202 document as other than work in progress.
204 <p>The (<a
205 href="http://lists.w3.org/Archives/Public/www-style/">archived</a>) public
206 mailing list <a href="mailto:www-style@w3.org">www-style@w3.org</a> (see
207 <a href="http://www.w3.org/Mail/Request">instructions</a>) is preferred
208 for discussion of this specification. When sending e-mail, please put the
209 text “css3-fonts” in the subject, preferably like this:
210 “[<!---->css3-fonts<!---->] <em>…summary of comment…</em>”
212 <p>This document was produced by the <a
213 href="http://www.w3.org/Style/CSS/members">CSS Working Group</a> (part of
214 the <a href="http://www.w3.org/Style/">Style Activity</a>).
216 <p>This document was produced by a group operating under the <a
217 href="http://www.w3.org/Consortium/Patent-Policy-20040205/">5 February
218 2004 W3C Patent Policy</a>. W3C maintains a <a
219 href="http://www.w3.org/2004/01/pp-impl/32061/status"
220 rel=disclosure>public list of any patent disclosures</a> made in
221 connection with the deliverables of the group; that page also includes
222 instructions for disclosing a patent. An individual who has actual
223 knowledge of a patent which the individual believes contains <a
224 href="http://www.w3.org/Consortium/Patent-Policy-20040205/#def-essential">Essential
225 Claim(s)</a> must disclose the information in accordance with <a
226 href="http://www.w3.org/Consortium/Patent-Policy-20040205/#sec-Disclosure">section
227 6 of the W3C Patent Policy</a>.</p>
228 <!--end-status-->
229 <!--
230 <h3 class="no-num no-toc" id="atrisk">Features at risk</h3>
232 <p>The following features are at risk and may be removed when exiting CR:</p>
234 <ul>
235 </ul>
236 -->
238 <h2 class="no-num no-toc" id=contents>Table of contents</h2>
239 <!--begin-toc-->
241 <ul class=toc>
242 <li><a href="#introduction"><span class=secno>1 </span>Introduction</a>
244 <li><a href="#typography-background"><span class=secno>2 </span>Typography
245 Background</a>
247 <li><a href="#basic-font-props"><span class=secno>3 </span>Basic Font
248 Properties</a>
249 <ul class=toc>
250 <li><a href="#font-family-prop"><span class=secno>3.1 </span>Font
251 family: the font-family property</a>
252 <ul class=toc>
253 <li><a href="#generic-font-families"><span class=secno>3.1.1
254 </span>Generic font families</a>
255 </ul>
257 <li><a href="#font-weight-prop"><span class=secno>3.2 </span>Font
258 weight: the font-weight property</a>
260 <li><a href="#font-stretch-prop"><span class=secno>3.3 </span>Font
261 width: the font-stretch property</a>
263 <li><a href="#font-style-prop"><span class=secno>3.4 </span>Font style:
264 the font-style property</a>
266 <li><a href="#font-size-prop"><span class=secno>3.5 </span>Font size:
267 the font-size property</a>
269 <li><a href="#font-size-adjust-prop"><span class=secno>3.6
270 </span>Relative sizing: the font-size-adjust property</a>
272 <li><a href="#font-prop"><span class=secno>3.7 </span>Shorthand font
273 property: the font property</a>
275 <li><a href="#font-synthesis-prop"><span class=secno>3.8
276 </span>Controlling synthetic faces: the font-synthesis property</a>
277 </ul>
279 <li><a href="#font-resources"><span class=secno>4 </span>Font
280 Resources</a>
281 <ul class=toc>
282 <li><a href="#font-face-rule"><span class=secno>4.1 </span>The
283 <code>@font-face</code> rule</a>
285 <li><a href="#font-family-desc"><span class=secno>4.2 </span>Font
286 family: the font-family descriptor</a>
288 <li><a href="#src-desc"><span class=secno>4.3 </span>Font reference: the
289 src descriptor</a>
291 <li><a href="#font-prop-desc"><span class=secno>4.4 </span>Font property
292 descriptors: the font-style, font-weight, font-stretch descriptors</a>
294 <li><a href="#unicode-range-desc"><span class=secno>4.5 </span>Character
295 range: the unicode-range descriptor</a>
297 <li><a href="#font-rend-desc"><span class=secno>4.6 </span>Font
298 features: the font-variant and font-feature-settings descriptors</a>
300 <li><a href="#font-face-loading"><span class=secno>4.7 </span>Font
301 loading guidelines</a>
303 <li><a href="#same-origin-restriction"><span class=secno>4.8
304 </span>Same-origin restriction for fonts</a>
305 <ul class=toc>
306 <li><a href="#default-same-origin-restriction"><span class=secno>4.8.1
307 </span>Default same-origin restriction</a>
309 <li><a href="#allowing-cross-origin-font-loading"><span
310 class=secno>4.8.2 </span>Allowing cross-origin font loading</a>
311 </ul>
312 </ul>
314 <li><a href="#font-matching-algorithm"><span class=secno>5 </span>Font
315 Matching Algorithm</a>
316 <ul class=toc>
317 <li><a href="#font-family-casing"><span class=secno>5.1 </span>Case
318 sensitivity of font family names</a>
320 <li><a href="#font-style-matching"><span class=secno>5.2 </span>Matching
321 font styles</a>
323 <li><a href="#cluster-matching"><span class=secno>5.3 </span>Cluster
324 matching</a>
326 <li><a href="#char-handling-issues"><span class=secno>5.4
327 </span>Character handling issues</a>
329 <li><a href="#font-matching-changes"><span class=secno>5.5 </span>Font
330 matching changes since CSS 2.1</a>
332 <li><a href="#font-matching-examples"><span class=secno>5.6 </span>Font
333 matching examples</a>
334 </ul>
336 <li><a href="#font-rend-props"><span class=secno>6 </span>Font Feature
337 Properties</a>
338 <ul class=toc>
339 <li><a href="#glyph-selection-positioning"><span class=secno>6.1
340 </span>Glyph selection and positioning</a>
342 <li><a href="#language-specific-support"><span class=secno>6.2
343 </span>Language-specific display</a>
345 <li><a href="#font-kerning-prop"><span class=secno>6.3 </span>Kerning:
346 the font-kerning property</a>
348 <li><a href="#font-variant-ligatures-prop"><span class=secno>6.4
349 </span>Ligatures: the font-variant-ligatures property</a>
351 <li><a href="#font-variant-position-prop"><span class=secno>6.5
352 </span>Subscript and superscript forms: the font-variant-position
353 property</a>
355 <li><a href="#font-variant-caps-prop"><span class=secno>6.6
356 </span>Capitalization: the font-variant-caps property</a>
358 <li><a href="#font-variant-numeric-prop"><span class=secno>6.7
359 </span>Numerical formatting: the font-variant-numeric property</a>
361 <li><a href="#font-variant-alternates-prop"><span class=secno>6.8
362 </span>Alternates and swashes: the font-variant-alternates property</a>
365 <li><a href="#font-feature-values"><span class=secno>6.9 </span>Defining
366 font specific alternates: the <code>@font-feature-values</code>
367 rule</a>
369 <li><a href="#font-variant-east-asian-prop"><span class=secno>6.10
370 </span>East Asian text rendering: the font-variant-east-asian
371 property</a>
373 <li><a href="#font-variant-prop"><span class=secno>6.11 </span>Overall
374 shorthand for font rendering: the font-variant property</a>
376 <li><a href="#font-feature-settings-prop"><span class=secno>6.12
377 </span>Low-level font feature settings control: the
378 font-feature-settings property</a>
380 <li><a href="#font-language-override-prop"><span class=secno>6.13
381 </span>Font language override: the font-language-override property</a>
382 </ul>
384 <li><a href="#font-feature-resolution"><span class=secno>7 </span>Font
385 Feature Resolution </a>
386 <ul class=toc>
387 <li><a href="#default-features"><span class=secno>7.1 </span>Default
388 features</a>
390 <li><a href="#feature-precedence"><span class=secno>7.2 </span>Feature
391 precedence</a>
393 <li><a href="#feature-precedence-examples"><span class=secno>7.3
394 </span>Feature precedence examples</a>
395 </ul>
397 <li><a href="#object-model"><span class=secno>8 </span>Object Model</a>
398 <ul class=toc>
399 <li><a href="#om-fontface"><span class=secno>8.1 </span>The
400 <code>CSSFontFaceRule</code> interface</a>
402 <li><a href="#om-fontfeaturevalues"><span class=secno>8.2 </span>The
403 <code>CSSFontFeatureValuesRule</code> interface</a>
404 </ul>
406 <li><a href="#font-load-events"><span class=secno>9 </span>Font Load
407 Events</a>
408 <ul class=toc>
409 <li><a href="#document-fontloader"><span class=secno>9.1
410 </span>Extension to the <code>document</code> interface</a>
412 <li><a href="#fontloader-interface"><span class=secno>9.2 </span>The
413 <code>FontLoader</code> Interface</a>
414 <ul class=toc>
415 <li><a href="#events"><span class=secno>9.2.1 </span>Events</a>
417 <li><a href="#methods"><span class=secno>9.2.2 </span>Methods</a>
418 </ul>
420 <li><a href="#font-load-event-examples"><span class=secno>9.3
421 </span>Font load event examples</a>
422 </ul>
424 <li class=no-num><a href="#platform-props-to-css">Appendix A: Mapping
425 platform font properties to CSS properties</a>
427 <li class=no-num><a href="#ch-ch-ch-changes">Changes</a>
428 <ul class=toc>
429 <li class=no-num><a href="#recent-changes"> Changes from the December
430 2012 CSS3 Fonts Working Draft</a>
431 </ul>
433 <li class=no-num><a href="#acknowledgments">Acknowledgments</a>
435 <li class=no-num><a href="#conformance"> Conformance</a>
436 <ul class=toc>
437 <li class=no-num><a href="#conventions"> Document Conventions</a>
439 <li class=no-num><a href="#conformance-classes"> Conformance Classes</a>
442 <li class=no-num><a href="#partial"> Partial Implementations</a>
444 <li class=no-num><a href="#experimental"> Experimental
445 Implementations</a>
447 <li class=no-num><a href="#testing"> Non-Experimental
448 Implementations</a>
449 </ul>
451 <li class=no-num><a href="#references">References</a>
452 <ul class=toc>
453 <li class=no-num><a href="#normative-references">Normative
454 References</a>
456 <li class=no-num><a href="#other-references">Other References</a>
457 </ul>
459 <li class=no-num><a href="#index">Index</a>
461 <li class=no-num><a href="#property-index">Property index</a>
462 </ul>
463 <!--end-toc-->
465 <h2 id=introduction><span class=secno>1 </span>Introduction</h2>
467 <p>A font provides a resource containing the visual representation of
468 characters. At the simplest level it contains information that maps
469 character codes to shapes (called glyphs) that represent these characters.
470 Fonts sharing a common design style are commonly grouped into font
471 families classified by a set of standard font properties. Within a family,
472 the shape displayed for a given character can vary by stroke weight, slant
473 or relative width, among others. An individual font face is described by a
474 unique combination of these properties. For a given range of text, CSS
475 font properties are used to select a font family and a specific font face
476 within that family to be used when rendering that text. As a simple
477 example, to use the bold form of Helvetica one could use:
479 <pre>body {
480 font-family: Helvetica;
481 font-weight: bold;
482 }</pre>
484 <p>Font resources may be installed locally on the system on which a user
485 agent is running or downloadable. For local font resources descriptive
486 information can be obtained directly from the font resource. For
487 downloadable font resources (sometimes referred to as web fonts), the
488 descriptive information is included with the reference to the font
489 resource.
491 <p>Families of fonts typically don't contain a single face for each
492 possible variation of font properties. The CSS font selection mechanism
493 describes how to match a given set of CSS font properties to a single font
494 face.
496 <h2 id=typography-background><span class=secno>2 </span>Typography
497 Background</h2>
499 <p><em>This section is non-normative.</em>
501 <p> Typographic traditions vary across the globe, so there is no unique way
502 to classify all fonts across languages and cultures. For even common Latin
503 letters, wide variations are possible:
505 <div class=figure><img alt="variations in glyphs for a single character"
506 src=aaaaaa.png>
507 <p class=caption>One character, many glyph variations
508 </div>
510 <p>Differences in the anatomy of letterforms is one way to distinguish
511 fonts. For Latin fonts, flourishes at the ends of a character's main
512 strokes, or serifs, can distinguish a font from those without. Similar
513 comparisons exist in non-Latin fonts between fonts with tapered strokes
514 and those using primarily uniform strokes:
516 <div class=figure><img alt="serif vs. non-serifs" src=serifvssansserif.png>
517 <p class=caption>Letterforms with and without serifs
518 </div>
520 <div class=figure><img alt="serif vs. non-serifs for japanese"
521 src=minchovsgothic.png>
522 <p class=caption>Similar groupings for Japanese typefaces
523 </div>
525 <p>Fonts contain letterforms and the data needed to map characters to these
526 letterforms. Often this may be a simple one-to-one mapping, but more
527 complex mappings are also possible. The use of combining diacritic marks
528 creates many variations for an underlying letterform:
530 <div class=figure><img alt="diacritic marks" src=aaaaaa-diacritics.png>
531 <p class=caption>Variations with diacritic marks
532 </div>
534 <p>A sequence of characters can be represented by a single glyph known as a
535 ligature:
537 <div class=figure><img alt="example of a fi ligature"
538 src=final-ligature.png>
539 <p class=caption>Ligature example
540 </div>
542 <p>Visual transformations based on textual context are often stylistic
543 option in European languages. They are required to correctly render
544 languages like Arabic, the lam and alef characters below <em>must</em> be
545 combined when they exist in sequence:
547 <div class=figure><img alt="lam alef ligature" src=lamaleflig.png>
548 <p class=caption>Required Arabic ligature
549 </div>
551 <p>The relative complexity of these shaping transformations requires
552 additional data within the font.
554 <p>Sets of font faces with various stylistic variations are often grouped
555 together into font families. In the simplest case a regular face is
556 supplemented with bold and italic faces, but much more extensive groupings
557 are possible. Variations in the thickness of letterform strokes, the <dfn
558 id=weight>weight</dfn>, and the overall proportions of the letterform, the
559 <dfn id=width>width</dfn>, are most common. In the example below, each
560 letter uses a different font face within the Univers font family. The
561 width used increases from top to bottom and the weight increases from left
562 to right:
564 <div class=figure><img alt="various width and weight variations within a
565 single family" src=weightwidthvariations.png>
566 <p class=caption>Weight and width variations within a single font family
567 </div>
569 <p>Creating fonts that support multiple scripts is a difficult task;
570 designers need to understand the cultural traditions surrounding the use
571 of type in different scripts and come up with letterforms that somehow
572 share a common theme. Many languages often share a common script and each
573 of these languages may have noticeable stylistic differences. For example,
574 the Arabic script is shared by Persian and Urdu and Cyrillic is used with
575 many languages, not just Russian.
577 <p>The character map of a font defines the mapping of characters to glyphs
578 for that font. If a document contains characters not supported by the
579 character maps of the fonts contained in a font family list, a user agent
580 may use a system font fallback procedure to locate an appropriate font
581 that does. If no appropriate font can be found, some form of "missing
582 glyph" character will be rendered by the user agent. Fallback can occur
583 when the list of font families does not include a font that supports a
584 given character.
586 <p>Although the character map of a font maps a given character to a glyph
587 for that character, modern font technologies such as OpenType and AAT
588 (Apple Advanced Typography) provide ways of mapping a character to
589 different glyphs based upon feature settings. Fonts in these formats allow
590 these features to be embedded in the font itself and controlled by
591 applications. Common typographic features which can be specified this way
592 include ligatures, swashes, contextual alternates, proportional and
593 tabular figures, and automatic fractions, to list just a few. For a visual
594 overview of OpenType features, see the <a href="#OPENTYPE-FONT-GUIDE"
595 rel=biblioentry>[OPENTYPE-FONT-GUIDE]<!--{{OPENTYPE-FONT-GUIDE}}--></a>.
597 <h2 id=basic-font-props><span class=secno>3 </span>Basic Font Properties</h2>
599 <p>The particular font face used to render a character is determined by the
600 font family and other font properties that apply to a given element. This
601 structure allows settings to be varied independent of each other.</p>
602 <!-- prop: font-family -->
604 <h3 id=font-family-prop><span class=secno>3.1 </span>Font family: the <a
605 href="#propdef-font-family">font-family</a> property</h3>
607 <table class=propdef id=namefont-familyvalue-ltfamily-name-ltgen>
608 <tbody>
609 <tr>
610 <td>Name:
612 <td><dfn id=propdef-font-family>font-family</dfn>
614 <tr>
615 <td>Value:
617 <td>[ <family-name> | <generic-family> ]#
619 <tr>
620 <td>Initial:
622 <td>depends on user agent
624 <tr>
625 <td>Applies to:
627 <td>all elements
629 <tr>
630 <td>Inherited:
632 <td>yes
634 <tr>
635 <td>Percentages:
637 <td>N/A
639 <tr>
640 <td>Media:
642 <td>visual
644 <tr>
645 <td>Computed value:
647 <td>as specified
649 <tr>
650 <td>Animatable:
652 <td>no
653 </table>
655 <p>This property specifies a prioritized list of font family names or
656 generic family names. A font family defines a set of faces that vary in
657 weight, width or slope. CSS uses the combination of a family name with
658 other style attributes to select an individual face. Using this selection
659 mechanism, rather than selecting a face via the style name as is often
660 done in design applications, allows some degree of regularity in textual
661 display when fallback occurs.
663 <p class=note>Designers should note that the CSS definition of font
664 attributes used for selection are explicitly not intended to define a font
665 taxonomy. A type designer's idea of a family may often extend to a set of
666 faces that vary along axes other than just the standard axes of weight,
667 width and slope. A family may extend to include both a set of serif faces
668 and a set of sans-serif faces or vary along axes that are unique to that
669 family. The CSS font selection mechanism merely provides a way to
670 determine the “closest” substitute when substitution is necessary.
672 <p>Unlike other CSS properties, component values are a comma-separated list
673 indicating alternatives. A user agent iterates through the list of family
674 names until it matches an available font that contains a glyph for the
675 character to be rendered. This allows for differences in available fonts
676 across platforms and for differences in the range of characters supported
677 by individual fonts.
679 <p>A font family name only specifies a name given to a set of font faces,
680 it does not specify an individual face. Given the availability of the
681 fonts below, Futura would match but Futura Medium would not:
683 <div class=figure><img alt="family and face names"
684 src=familyvsfacename.png>
685 <p class=caption>Family and individual face names
686 </div>
688 <p>Consider the example below:
690 <div class=example>
691 <pre>body {
692 font-family: Helvetica, Verdana, sans-serif;
693 }</pre>
695 <p>If Helvetica is available it will be used when rendering. If neither
696 Helvetica nor Verdana is present, then the user-agent-defined sans serif
697 font will be used.</p>
698 </div>
700 <p>There are two types of font family names:
702 <dl>
703 <dt><family-name>
705 <dd>The name of a font family of choice such as Helvetica or Verdana in
706 the previous example.
708 <dt><generic-family>
710 <dd> The following generic family keywords are defined: ‘<a
711 href="#serif"><code class=property>serif</code></a>’, ‘<a
712 href="#sans-serif"><code class=property>sans-serif</code></a>’, ‘<a
713 href="#cursive"><code class=property>cursive</code></a>’, ‘<a
714 href="#fantasy"><code class=property>fantasy</code></a>’, and ‘<a
715 href="#monospace"><code class=property>monospace</code></a>’. These
716 keywords can be used as a general fallback mechanism when an author's
717 desired font choices are not available. As keywords, they must not be
718 quoted. Authors are encouraged to append a generic font family as a last
719 alternative for improved robustness.
720 </dl>
722 <p>Font family names must either be given quoted as <a
723 href="//www.w3.org/TR/CSS21/syndata.html#strings">strings,</a> or unquoted
724 as a sequence of one or more <a
725 href="//www.w3.org/TR/CSS21/syndata.html#value-def-identifier">identifiers.</a>
726 This means most punctuation characters and digits at the start of each
727 token must be escaped in unquoted font family names.
729 <p>To illustrate this, the following declarations are invalid:
731 <pre>
732 font-family: Red/Black, sans-serif;
733 font-family: "Lucida" Grande, sans-serif;
734 font-family: Ahem!, sans-serif;
735 font-family: test@foo, sans-serif;
736 font-family: #POUND, sans-serif;
737 font-family: Hawaii 5-0, sans-serif;
738 </pre>
740 <p>If a sequence of identifiers is given as a font family name, the
741 computed value is the name converted to a string by joining all the
742 identifiers in the sequence by single spaces.
744 <p>To avoid mistakes in escaping, it is recommended to quote font family
745 names that contain white space, digits, or punctuation characters other
746 than hyphens:
748 <pre>
749 body { font-family: "New Century Schoolbook", serif }
751 <BODY STYLE="font-family: '21st Century', fantasy">
752 </pre>
754 <p>Font family <em>names</em> that happen to be the same as a keyword value
755 (‘<code class=property>inherit</code>’, ‘<a href="#serif"><code
756 class=property>serif</code></a>’, ‘<a href="#sans-serif"><code
757 class=property>sans-serif</code></a>’, ‘<a href="#monospace"><code
758 class=property>monospace</code></a>’, ‘<a href="#fantasy"><code
759 class=property>fantasy</code></a>’, and ‘<a href="#cursive"><code
760 class=property>cursive</code></a>’) must be quoted to prevent confusion
761 with the keywords with the same names. The keywords ‘<code
762 class=property>initial</code>’ and ‘<code
763 class=property>default</code>’ are reserved for future use and must also
764 be quoted when used as font names. UAs must not consider these keywords as
765 matching the ‘<code class=css><family-name></code>’ type.
767 <p>The precise way a set of fonts are grouped into font families varies
768 depending upon the platform font management API's. The Windows GDI API
769 only allows four faces to be grouped into a family while the DirectWrite
770 API and API's on OSX and other platforms support font families with a
771 variety of weights, widths and slopes (see <a
772 href="#platform-props-to-css">Appendix A</a> for more details).
774 <p>Some font formats allow fonts to carry multiple localizations of the
775 family name. User agents must recognize and correctly match all of these
776 names independent of the underlying platform localization, system API used
777 or document encoding:
779 <div class=figure><img alt="examples of localized family names"
780 src=localizedfamilynames.png>
781 <p class=caption>Localized family names
782 </div>
784 <h4 id=generic-font-families><span class=secno>3.1.1 </span>Generic font
785 families</h4>
787 <p>All five generic font families are defined to exist in all CSS
788 implementations (they need not necessarily map to five distinct actual
789 fonts). User agents should provide reasonable default choices for the
790 generic font families, which express the characteristics of each family as
791 well as possible within the limits allowed by the underlying technology.
792 User agents are encouraged to allow users to select alternative choices
793 for the generic fonts.
795 <h5 class="no-num no-toc"> <span class=index-def id=serif0 title="serif,
796 definition of"><a name=serif-def><dfn id=serif>serif</dfn></a></span></h5>
798 <p>Glyphs of serif fonts, as the term is used in CSS, have finishing
799 strokes, flared or tapering ends, or have actual serifed endings
800 (including slab serifs). Serif fonts are typically proportionately-spaced.
801 They often display a greater variation between thick and thin strokes than
802 fonts from the ‘<a href="#sans-serif"><code
803 class=property>sans-serif</code></a>’ generic font family. CSS uses the
804 term ‘<a href="#serif"><code class=property>serif</code></a>’ to apply
805 to a font for any script, although other names may be more familiar for
806 particular scripts, such as Mincho (Japanese), Sung, Song or Kai
807 (Chinese), Batang (Korean). Any font that is so described may be used to
808 represent the generic ‘<a href="#serif"><code
809 class=property>serif</code></a>’ family.
811 <div class=figure><img alt="sample serif fonts" src=serifexamples.png>
812 <p class=caption>Sample serif fonts
813 </div>
815 <h5 class="no-num no-toc"> <span class=index-def id=sans-serif0
816 title="sans-serif, definition of"> <a name=sans-serif-def><dfn
817 id=sans-serif>sans-serif</dfn></a></span></h5>
819 <p>Glyphs in sans-serif fonts, as the term is used in CSS, have stroke
820 endings that are plain -- without any flaring, cross stroke, or other
821 ornamentation. Sans-serif fonts are typically proportionately-spaced. They
822 often have little variation between thick and thin strokes, compared to
823 fonts from the ‘<a href="#serif"><code
824 class=property>serif</code></a>’ family. CSS uses the term ‘<a
825 href="#sans-serif"><code class=property>sans-serif</code></a>’ to apply
826 to a font for any script, although other names may be more familiar for
827 particular scripts, such as Gothic (Japanese), Hei (Chinese), or Gulim
828 (Korean). Any font that is so described may be used to represent the
829 generic ‘<a href="#sans-serif"><code
830 class=property>sans-serif</code></a>’ family.
832 <div class=figure><img alt="sample sans-serif fonts"
833 src=sansserifexamples.png>
834 <p class=caption>Sample sans-serif fonts
835 </div>
837 <h5 class="no-num no-toc"> <span class=index-def id=cursive0
838 title="cursive, definition of"> <a name=cursive-def><dfn
839 id=cursive>cursive</dfn></a></span></h5>
841 <p>Glyphs in cursive fonts generally have either joining strokes or other
842 cursive characteristics beyond those of italic typefaces. The glyphs are
843 partially or completely connected, and the result looks more like
844 handwritten pen or brush writing than printed letterwork. Some scripts,
845 such as Arabic, are almost always cursive. CSS uses the term ‘<a
846 href="#cursive"><code class=property>cursive</code></a>’ to apply to a
847 font for any script, although other names such as Chancery, Brush, Swing
848 and Script are also used in font names.
850 <div class=figure><img alt="sample cursive fonts" src=cursiveexamples.png>
851 <p class=caption>Sample cursive fonts
852 </div>
854 <h5 class="no-num no-toc"> <span class=index-def id=fantasy0
855 title="fantasy, definition of"> <a name=fantasy-def><dfn
856 id=fantasy>fantasy</dfn></a></span></h5>
858 <p>Fantasy fonts are primarily decorative fonts that contain playful
859 representations of characters. These do not include Pi or Picture fonts
860 which do not represent actual characters.
862 <div class=figure><img alt="sample fantasy fonts" src=fantasyexamples.png>
863 <p class=caption>Sample fantasy fonts
864 </div>
866 <h5 class="no-num no-toc"> <span class=index-def id=monospace0
867 title="monospace, definition of"> <a name=monospace-def><dfn
868 id=monospace>monospace</dfn></a></span></h5>
870 <p>The sole criterion of a monospace font is that all glyphs have the same
871 fixed width. This is often used to render samples of computer code.
873 <div class=figure><img alt="sample monospace fonts"
874 src=monospaceexamples.png>
875 <p class=caption>Sample monospace fonts
876 </div>
877 <!-- prop: font-weight -->
879 <h3 id=font-weight-prop><span class=secno>3.2 </span>Font weight: the <a
880 href="#propdef-font-weight">font-weight</a> property</h3>
882 <table class=propdef id=namefont-weightvaluenormal-bold-bolder-l>
883 <tbody>
884 <tr>
885 <td>Name:
887 <td><dfn id=propdef-font-weight>font-weight</dfn>
889 <tr>
890 <td>Value:
892 <td>normal | bold | bolder | lighter | 100 | 200 | 300 | 400 | 500 | 600
893 | 700 | 800 | 900
895 <tr>
896 <td>Initial:
898 <td>normal
900 <tr>
901 <td>Applies to:
903 <td>all elements
905 <tr>
906 <td>Inherited:
908 <td>yes
910 <tr>
911 <td>Percentages:
913 <td>N/A
915 <tr>
916 <td>Media:
918 <td>visual
920 <tr>
921 <td>Computed value:
923 <td>see description
925 <tr>
926 <td>Animatable:
928 <td>as <a
929 href="http://dev.w3.org/csswg/css3-transitions/#animtype-font-weight">font
930 weight</a>
931 </table>
933 <p>The <a class=noxref href="#font-weight-prop"><span
934 class=property>‘<code class=property>font-weight</code>’</span></a>
935 property specifies weight of glyphs in the font, their degree of blackness
936 or stroke thickness.
938 <p>Values have the following meanings:
940 <dl>
941 <dt>100 to 900
943 <dd>These values form an ordered sequence, where each number indicates a
944 weight that is at least as dark as its predecessor. These roughly
945 correspond to the commonly used weight names below:
946 </dl>
948 <ul>
949 <li>100 - Thin
951 <li>200 - Extra Light (Ultra Light)
953 <li>300 - Light
955 <li>400 - Normal
957 <li>500 - Medium
959 <li>600 - Semi Bold (Demi Bold)
961 <li>700 - Bold
963 <li>800 - Extra Bold (Ultra Bold)
965 <li>900 - Black (Heavy)
966 </ul>
968 <dl>
969 <dt><a href="#normal2"><strong>normal</strong></a>
971 <dd>Same as ‘<code class=css>400</code>’.
973 <dt><strong>bold</strong>
975 <dd>Same as ‘<code class=css>700</code>’.
977 <dt><strong>bolder</strong>
979 <dd>Specifies the weight of the face bolder than the inherited value.
981 <dt><strong>lighter</strong>
983 <dd>Specifies the weight of the face lighter than the inherited value.
984 </dl>
986 <p>Font formats that use a scale other than a nine step scale should map
987 their scale onto the CSS scale so that 400 roughly corresponds with a face
988 that would be labeled as Regular, Book, Roman and 700 roughly matches a
989 face that would be labeled as Bold. Or weights may be inferred from the
990 style names, ones that correspond roughly with the scale above. The scale
991 is relative, so a face with a larger weight value must never appear
992 lighter. If style names are used to infer weights, care should be taken to
993 handle variations in style names across locales.
995 <p>Quite often there are only a few weights available for a particular font
996 family. When a weight is specified for which no face exists, a face with a
997 nearby weight is used. In general, bold weights map to faces with heavier
998 weights and light weights map to faces with lighter weights (see the <a
999 href="#font-matching-algorithm">font matching section below</a> for a
1000 precise definition). The examples here illustrate which face is used for
1001 different weights, grey indicates a face for that weight does not exist so
1002 a face with a nearby weight is used:
1004 <div class=figure><img alt="weight mappings for a family with 400, 700 and
1005 900 weights" src=optimaweights.png>
1006 <p class=caption>Weight mappings for a font family with 400, 700 and 900
1007 weight faces
1008 </div>
1010 <div class=figure><img alt="weight mappings for a family with 300, 600
1011 weights" src=hiraginoweights.png>
1012 <p class=caption>Weight mappings for a font family with 300 and 600 weight
1013 faces
1014 </div>
1016 <p>Although the practice is not well-loved by typographers, bold faces are
1017 often synthesized by user agents for faces that lack actual bold faces.
1018 For the purposes of style matching, these faces must be treated as if they
1019 exist within the family.
1021 <p>Values of ‘<code class=property>bolder</code>’ and ‘<code
1022 class=property>lighter</code>’ indicate values relative to the weight of
1023 the parent element. Based on the inherited weight value, the weight used
1024 is calculated using the chart below. Child elements inherit the calculated
1025 weight, not a value of ‘<code class=property>bolder</code>’ or
1026 ‘<code class=property>lighter</code>’.
1028 <table class=data id=bolderlighter summary="Bolder/lighter mappings">
1029 <thead>
1030 <tr>
1031 <th>Inherited value
1033 <th>bolder
1035 <th>lighter
1037 <tbody>
1038 <tr>
1039 <th>100
1041 <td>400
1043 <td>100
1045 <tr>
1046 <th>200
1048 <td>400
1050 <td>100
1052 <tr>
1053 <th>300
1055 <td>400
1057 <td>100
1059 <tr>
1060 <th>400
1062 <td>700
1064 <td>100
1066 <tr>
1067 <th>500
1069 <td>700
1071 <td>100
1073 <tr>
1074 <th>600
1076 <td>900
1078 <td>400
1080 <tr>
1081 <th>700
1083 <td>900
1085 <td>400
1087 <tr>
1088 <th>800
1090 <td>900
1092 <td>700
1094 <tr>
1095 <th>900
1097 <td>900
1099 <td>700
1100 </table>
1102 <p>The table above is equivalent to selecting the next relative bolder or
1103 lighter face, given a font family containing normal and bold faces along
1104 with a thin and a heavy face. Authors who desire finer control over the
1105 exact weight values used for a given element should use numerical values
1106 instead of relative weights.</p>
1107 <!-- prop: font-stretch -->
1109 <h3 id=font-stretch-prop><span class=secno>3.3 </span>Font width: the <a
1110 href="#propdef-font-stretch">font-stretch</a> property</h3>
1112 <table class=propdef id=namefont-stretchvaluenormal-ultra-conden>
1113 <tbody>
1114 <tr>
1115 <td>Name:
1117 <td><dfn id=propdef-font-stretch>font-stretch</dfn>
1119 <tr>
1120 <td>Value:
1122 <td>normal | ultra-condensed | extra-condensed | condensed |
1123 semi-condensed | semi-expanded | expanded | extra-expanded |
1124 ultra-expanded
1126 <tr>
1127 <td>Initial:
1129 <td>normal
1131 <tr>
1132 <td>Applies to:
1134 <td>all elements
1136 <tr>
1137 <td>Inherited:
1139 <td>yes
1141 <tr>
1142 <td>Percentages:
1144 <td>N/A
1146 <tr>
1147 <td>Media:
1149 <td>visual
1151 <tr>
1152 <td>Computed value:
1154 <td>as specified
1156 <tr>
1157 <td>Animatable:
1159 <td>as <a href="#font-stretch-animation">font stretch</a>
1160 </table>
1162 <p>The <a class=noxref href="#font-stretch-prop"><span
1163 class=property>‘<code class=property>font-stretch</code>’</span></a>
1164 property selects a normal, condensed, or expanded face from a font family.
1165 Absolute keyword values have the following ordering, from narrowest to
1166 widest:
1168 <ul>
1169 <li>Ultra Condensed
1171 <li>Extra Condensed
1173 <li>Condensed
1175 <li>Semi Condensed
1177 <li>Normal
1179 <li>Semi Expanded
1181 <li>Expanded
1183 <li>Extra Expanded
1185 <li>Ultra Expanded
1186 </ul>
1188 <p>The scale is relative, so a face with a font-stretch value higher in the
1189 list above should never appear wider. When a face does not exist for a
1190 given width, normal or condensed values map to a narrower face, otherwise
1191 a wider face. Conversely, expanded values map to a wider face, otherwise a
1192 narrower face. The figure below shows how the nine font-stretch property
1193 settings affect font selection for font family containing a variety of
1194 widths, grey indicates a width for which no face exists and a different
1195 width is substituted:
1197 <div class=figure><img alt="width mappings for a family with condensed,
1198 normal and expanded faces" src=universwidths.png>
1199 <p class=caption>Width mappings for a font family with condensed, normal
1200 and expanded width faces
1201 </div>
1203 <p id=font-stretch-animation>Animation of font stretch: Font stretch is
1204 interpolated in discrete steps. The interpolation happens as though the
1205 ordered values are equally spaced real numbers. The interpolation result
1206 is rounded to the nearest value, with values exactly halfway between two
1207 values rounded towards the later value in the list above.</p>
1208 <!-- prop: font-style -->
1210 <h3 id=font-style-prop><span class=secno>3.4 </span>Font style: the <a
1211 href="#propdef-font-style">font-style</a> property</h3>
1213 <table class=propdef id=namefont-stylevaluenormal-italic-oblique>
1214 <tbody>
1215 <tr>
1216 <td>Name:
1218 <td><dfn id=propdef-font-style>font-style</dfn>
1220 <tr>
1221 <td>Value:
1223 <td>normal | italic | oblique
1225 <tr>
1226 <td>Initial:
1228 <td>normal
1230 <tr>
1231 <td>Applies to:
1233 <td>all elements
1235 <tr>
1236 <td>Inherited:
1238 <td>yes
1240 <tr>
1241 <td>Percentages:
1243 <td>N/A
1245 <tr>
1246 <td>Media:
1248 <td>visual
1250 <tr>
1251 <td>Computed value:
1253 <td>as specified
1255 <tr>
1256 <td>Animatable:
1258 <td>no
1259 </table>
1261 <p>The <a class=noxref href="#font-style-prop"><span
1262 class=property>‘<code class=property>font-style</code>’</span></a>
1263 property allows italic or oblique faces to be selected. Italic forms are
1264 generally cursive in nature while oblique faces are typically sloped
1265 versions of the regular face. Oblique faces can be simulated by
1266 artificially sloping the glyphs of the regular face. Compare the
1267 artificially sloped renderings of Palatino ‘<code
1268 class=property>a</code>’ and Baskerville ‘<code
1269 class=property>N</code>’ in grey with the actual italic versions:
1271 <div class=figure><img alt="artificial sloping vs. real italics"
1272 src=realvsfakeitalics.png>
1273 <p class=caption>Artificial sloping versus real italics
1274 </div>
1276 <p>A value of ‘<a href="#normal2"><code
1277 class=property>normal</code></a>’ selects a face that is classified as
1278 ‘<a href="#normal2"><code class=property>normal</code></a>’, while
1279 ‘<code class=property>oblique</code>’ selects a font that is labeled
1280 ‘<code class=property>oblique</code>’. A value of ‘<code
1281 class=property>italic</code>’ selects a font that is labeled ‘<code
1282 class=property>italic</code>’, or, if that is not available, one labeled
1283 ‘<code class=property>oblique</code>’. If no italic or oblique faces
1284 is available, an oblique face can by synthesized by rendering the normal
1285 face with a sloping transformation applied.
1287 <p>Many scripts lack the tradition of mixing a cursive form within text
1288 rendered with a normal face. Chinese, Japanese and Korean fonts almost
1289 always lack italic or oblique faces. Fonts that support a mixture of
1290 scripts will sometimes omit specific scripts such as Arabic from the set
1291 of glyphs supported in the italic face. User agents should be careful
1292 about making character map assumptions across faces.
1294 <p class=issue>For synthetic italics in vertical runs of Chinese, Japanese,
1295 or Korean text, is there a need to define explicitly the direction of the
1296 faux oblique for runs that include a mixture of ideographic and Latin
1297 text?</p>
1298 <!-- prop: font-size -->
1300 <h3 id=font-size-prop><span class=secno>3.5 </span>Font size: the <a
1301 href="#propdef-font-size">font-size</a> property</h3>
1303 <table class=propdef id=namefont-sizevalueltabsolute-size-ltrela>
1304 <tbody>
1305 <tr>
1306 <td>Name:
1308 <td><dfn id=propdef-font-size>font-size</dfn>
1310 <tr>
1311 <td>Value:
1313 <td><absolute-size> | <relative-size> | <length> |
1314 <percentage>
1316 <tr>
1317 <td>Initial:
1319 <td>medium
1321 <tr>
1322 <td>Applies to:
1324 <td>all elements
1326 <tr>
1327 <td>Inherited:
1329 <td>yes
1331 <tr>
1332 <td>Percentages:
1334 <td>refer to parent element's font size
1336 <tr>
1337 <td>Media:
1339 <td>visual
1341 <tr>
1342 <td>Computed value:
1344 <td>absolute length
1346 <tr>
1347 <td>Animatable:
1349 <td>as <a
1350 href="http://dev.w3.org/csswg/css3-transitions/#animtype-length">length</a>
1351 </table>
1353 <p>This property indicates the desired height of glyphs from the font. For
1354 scalable fonts, the font-size is a scale factor applied to the EM unit of
1355 the font. (Note that certain glyphs may bleed outside their EM box.) For
1356 non-scalable fonts, the font-size is converted into absolute units and
1357 matched against the declared font-size of the font, using the same
1358 absolute coordinate space for both of the matched values. Values have the
1359 following meanings:
1361 <dl>
1362 <dt><a name=x18><span class=index-def id=ltabsolute-sizegt
1363 title="<absolute-size>">
1364 <strong><absolute-size></strong></span></a>
1366 <dd> An <a class=value-def
1367 name=value-def-absolute-size><absolute-size></a> keyword refers to
1368 an entry in a table of font sizes computed and kept by the user agent.
1369 Possible values are:
1370 <p> [ xx-small | x-small | small | medium | large | x-large | xx-large ]</p>
1372 <dt><a name=x19><span class=index-def id=ltrelative-sizegt
1373 title="<relative-size>">
1374 <strong><relative-size></strong></span></a>
1376 <dd> A <a class=value-def
1377 name=value-def-relative-size><relative-size></a> keyword is
1378 interpreted relative to the table of font sizes and the font size of the
1379 parent element. Possible values are:
1380 <p> [ larger | smaller ]
1382 <p> For example, if the parent element has a font size of ‘<code
1383 class=property>medium</code>’, a value of ‘<code
1384 class=property>larger</code>’ will make the font size of the current
1385 element be ‘<code class=property>large</code>’. If the parent
1386 element's size is not close to a table entry, the user agent is free to
1387 interpolate between table entries or round off to the closest one. The
1388 user agent may have to extrapolate table values if the numerical value
1389 goes beyond the keywords.
1391 <dt><span class=index-inst id=ltlengthgt
1392 title="<length>"><length></span>
1394 <dd>A length value specifies an absolute font size (that is independent of
1395 the user agent's font table). Negative lengths are illegal.
1397 <dt><span class=index-inst id=ltpercentagegt-
1398 title="<percentage>"><percentage> </span>
1400 <dd>A percentage value specifies an absolute font size relative to the
1401 parent element's font size. Use of percentage values, or values in
1402 ‘<code class=property>em</code>’s, leads to more robust and
1403 cascadable style sheets.
1404 </dl>
1406 <p>The following table provides user agent's guideline for the
1407 absolute-size scaling factor and their mapping to XHTML heading and
1408 absolute font-sizes. The ‘<code class=property>medium</code>’ value is
1409 used as the reference middle value. The user agent may fine-tune these
1410 values for different fonts or different types of display devices.
1412 <table class=data>
1413 <thead>
1414 <tr>
1415 <th>CSS absolute-size values
1417 <th>xx-small
1419 <th>x-small
1421 <th>small
1423 <th>medium
1425 <th>large
1427 <th>x-large
1429 <th>xx-large
1431 <th>
1433 <tbody>
1434 <tr>
1435 <th>scaling factor
1437 <td>3/5
1439 <td>3/4
1441 <td>8/9
1443 <td>1
1445 <td>6/5
1447 <td>3/2
1449 <td>2/1
1451 <td>3/1
1453 <tr>
1454 <th>XHTML headings
1456 <td>h6
1458 <td>
1460 <td>h5
1462 <td>h4
1464 <td>h3
1466 <td>h2
1468 <td>h1
1470 <td>
1472 <tr>
1473 <th>XHTML font sizes
1475 <td>1
1477 <td>
1479 <td>2
1481 <td>3
1483 <td>4
1485 <td>5
1487 <td>6
1489 <td>7
1490 </table>
1492 <p class=note><em><strong>Note 1.</strong> To preserve readability, an UA
1493 applying these guidelines should nevertheless avoid creating font-size
1494 resulting in less than 9 pixels per EM unit on a computer display .</em>
1496 <p class=note><em><strong>Note 2.</strong> In CSS1, the suggested scaling
1497 factor between adjacent indexes was 1.5 which user experience proved to be
1498 too large. In CSS2, the suggested scaling factor for computer screen
1499 between adjacent indexes was 1.2 which still created issues for the small
1500 sizes. The new scaling factor varies between each index to provide a
1501 better readability.</em>
1503 <p>The actual value of this property may differ from the computed value due
1504 a numerical value on ‘<a href="#propdef-font-size-adjust"><code
1505 class=property>font-size-adjust</code></a>’ and the unavailability of
1506 certain font sizes.
1508 <p>Child elements inherit the computed <a class=noxref
1509 href="#font-size-prop"> <span class=property>‘<code
1510 class=property>font-size</code>’</span></a> value (otherwise, the effect
1511 of <a class=noxref href="#font-size-adjust-prop"><span
1512 class=property>‘<code
1513 class=property>font-size-adjust</code>’</span></a> would compound).
1515 <div class=example>
1516 <p style="display:none">Example(s):
1518 <p>
1520 <pre>p { font-size: 12pt; }
1521 blockquote { font-size: larger }
1522 em { font-size: 150% }
1523 em { font-size: 1.5em }
1524 </pre>
1525 </div>
1526 <!-- prop: font-size-adjust -->
1528 <h3 id=font-size-adjust-prop><span class=secno>3.6 </span>Relative sizing:
1529 the <a href="#propdef-font-size-adjust">font-size-adjust</a> property</h3>
1531 <table class=propdef id=namefont-size-adjustvaluenone-auto-ltnum>
1532 <tbody>
1533 <tr>
1534 <td>Name:
1536 <td><dfn id=propdef-font-size-adjust>font-size-adjust</dfn>
1538 <tr>
1539 <td>Value:
1541 <td>none | auto | <number>
1543 <tr>
1544 <td>Initial:
1546 <td>none
1548 <tr>
1549 <td>Applies to:
1551 <td>all elements
1553 <tr>
1554 <td>Inherited:
1556 <td>yes
1558 <tr>
1559 <td>Percentages:
1561 <td>N/A
1563 <tr>
1564 <td>Media:
1566 <td>visual
1568 <tr>
1569 <td>Computed value:
1571 <td>as specified
1573 <tr>
1574 <td>Animatable:
1576 <td>as <a
1577 href="http://dev.w3.org/csswg/css3-transitions/#animtype-number">number</a>
1578 </table>
1580 <p>For any given font size, the apparent size and legibility of text varies
1581 across fonts. For scripts such as Latin or Cyrillic that distinguish
1582 between upper and lowercase letters, the relative height of lowercase
1583 letters compared to their uppercase counterparts is a determining factor
1584 of legibility. This is commonly referred to as the <a class=index-def
1585 href="#aspect-value" id=aspect-value0 title="aspect value"><dfn
1586 id=aspect-value>aspect value</dfn></a>. Precisely defined, it is equal to
1587 the x-height of a font divided by the font size.
1589 <p>In situations where font fallback occurs, fallback fonts may not share
1590 the same aspect ratio as the desired font family and will thus appear less
1591 readable. The font-size-adjust property is a way to preserve the
1592 readability of text when font fallback occurs. It does this by adjusting
1593 the font-size so that the x-height is the same regardless of the font
1594 used.
1596 <div class=example>
1597 <p>The style defined below defines Verdana as the desired font family, but
1598 if Verdana is not available Futura or Times will be used.</p>
1600 <pre>p {
1601 font-family: Verdana, Futura, Times;
1602 }
1604 <p>Lorem ipsum dolor sit amet, ...</p>
1605 </pre>
1607 <p>Verdana has a relatively high aspect ratio, lowercase letters are
1608 relatively tall compared to uppercase letters, so at small sizes text
1609 appears legible. Times has a lower aspect ratio and so if fallback
1610 occurs, the text will be less legible at small sizes than Verdana.</p>
1611 </div>
1613 <p>How text rendered in each of these fonts compares is shown below, the
1614 columns show text rendered in Verdana, Futura and Times. The same
1615 font-size value is used across cells within each row and red lines are
1616 included to show the differences in x-height. In the upper half each row
1617 is rendered in the same font-size value. The same is true for the lower
1618 half but in this half the font-size-adjust property is also set so that
1619 the actual font size is adjusted to preserve the x-height across each row.
1620 Note how small text remains relatively legible across each row in the
1621 lower half.
1623 <div class=figure><img alt="text with and without font-size-adjust"
1624 src=fontsizeadjust.png>
1625 <p class=caption>Text with and without the use of font-size-adjust
1626 </div>
1628 <p>This property allows authors to specify an aspect value for an element
1629 that will effectively preserve the x-height of the first choice font,
1630 whether it is substituted or not. Values have the following meanings:
1632 <dl>
1633 <dt><strong>none</strong>
1635 <dd>Do not preserve the font's x-height.
1637 <dt><strong>auto</strong>
1639 <dd>Behaves just like <number>, except the number used is the aspect
1640 value calculated by user agents for the first font in the list of fonts
1641 defined for the initial value of the ‘<a
1642 href="#descdef-font-family"><code
1643 class=property>font-family</code></a>’ property. Effectively this is
1644 the default font used when ‘<a href="#descdef-font-family"><code
1645 class=property>font-family</code></a>’ is not otherwise specified.
1646 <p>Authors can use this value to specify that font size should be
1647 normalized across fonts based on the x-height without the need to
1648 specify the aspect ratio explicitly.</p>
1650 <dt><span class=index-inst id=ltnumbergt
1651 title="<number>"><number></span>
1653 <dd>Specifies the aspect value used in the calculation below to calculate
1654 the adjusted font size:
1655 <pre>c = ( a / a' ) s
1656 </pre>
1658 <p>where:</p>
1660 <pre>s = font-size value
1661 a = aspect value as specified by the font-size-adjust property
1662 a' = aspect value of actual font
1663 c = adjusted font-size to use
1664 </pre>
1666 <p>This value applies to any font that is selected but in typical usage
1667 it should be based on the aspect value of the first font in the
1668 font-family list. If this is specified accurately, the <tt>(a/a')</tt>
1669 term in the formula above is effectively 1 for the first font and no
1670 adjustment occurs. If the value is specified inaccurately, text rendered
1671 using the first font in the family list will display differently in
1672 older user agents that don't support font-size-adjust.</p>
1673 </dl>
1675 <p>Authors can calculate the aspect value for a given font by comparing
1676 spans with the same content but different font-size-adjust properties. If
1677 the same font-size is used, the spans will match when the font-size-adjust
1678 value is accurate for the given font.
1680 <div class=example>
1681 <p>Two spans with borders are used to determine the aspect value of a
1682 font. The font-size is the same for both spans but the font-size-adjust
1683 property is specified only for the right span. Starting with a value of
1684 0.5, the aspect value can be adjusted until the borders around the two
1685 letters line up.</p>
1687 <pre>p {
1688 font-family: Futura;
1689 font-size: 500px;
1690 }
1692 span {
1693 border: solid 1px red;
1694 }
1696 .adjust {
1697 font-size-adjust: 0.5;
1698 }
1700 <p><span>b</span><span class="adjust">b</span></p>
1701 </pre>
1703 <div class=figure><img alt="Futura with an aspect value of 0.5"
1704 src=beforefontsizeadjust.png>
1705 <p class=caption>Futura with an aspect value of 0.5
1706 </div>
1708 <p>The box on the right is a bit bigger than the one on the left, so the
1709 aspect value of this font is something less than 0.5. Adjust the value
1710 until the boxes align.</p>
1711 </div>
1712 <!-- prop: font -->
1713 <!-- jtdfix, crap, preprocessor is inserting links to descriptors rather than properties. bert, make it stop... -->
1714 <!-- <a href="#font-stretch-prop" class="noxref"><span class="property">'font-stretch'</span></a> -->
1716 <h3 id=font-prop><span class=secno>3.7 </span>Shorthand font property: the
1717 <a href="#propdef-font">font</a> property</h3>
1719 <table class=propdef id=namefontvalue-ltlsquofont-stylersquo-ltf>
1720 <tbody>
1721 <tr>
1722 <td>Name:
1724 <td><dfn id=propdef-font>font</dfn>
1726 <tr>
1727 <td>Value:
1729 <td>[ [ <‘<a href="#propdef-font-style"><code
1730 class=property>font-style</code></a>’> || <font-variant-css21> ||
1731 <‘<a href="#propdef-font-weight"><code
1732 class=property>font-weight</code></a>’> || <‘<a
1733 href="#propdef-font-stretch"><code
1734 class=property>font-stretch</code></a>’> ]? <‘<a
1735 href="#propdef-font-size"><code class=property>font-size</code></a>’>
1736 [ / <‘<code class=property>line-height</code>’> ]? <‘<a
1737 href="#descdef-font-family"><code
1738 class=property>font-family</code></a>’> ] | caption | icon | menu |
1739 message-box | small-caption | status-bar
1741 <tr>
1742 <td>Initial:
1744 <td>see individual properties
1746 <tr>
1747 <td>Applies to:
1749 <td>all elements
1751 <tr>
1752 <td>Inherited:
1754 <td>yes
1756 <tr>
1757 <td>Percentages:
1759 <td>see individual properties
1761 <tr>
1762 <td>Media:
1764 <td>visual
1766 <tr>
1767 <td>Computed value:
1769 <td>see individual properties
1771 <tr>
1772 <td>Animatable:
1774 <td>see individual properties
1775 </table>
1777 <p>The <span class=property>‘<a href="#propdef-font"><code
1778 class=property>font</code></a>’</span> property is, except as described
1779 below, a shorthand property for setting ‘<a
1780 href="#propdef-font-style"><code class=property>font-style</code></a>’,
1781 <span class=property>‘<a href="#propdef-font-variant"><code
1782 class=property>font-variant</code></a>’</span>, <span
1783 class=property>‘<a href="#propdef-font-weight"><code
1784 class=property>font-weight</code></a>’</span>, <span
1785 class=property>‘<a href="#propdef-font-stretch"><code
1786 class=property>font-stretch</code></a>’</span>, <span
1787 class=property>‘<a href="#propdef-font-size"><code
1788 class=property>font-size</code></a>’</span>, ‘<code
1789 class=property>line-height</code>’, <span class=property>‘<a
1790 href="#descdef-font-family"><code
1791 class=property>font-family</code></a>’</span> at the same place in the
1792 stylesheet. Values for the <span class=property>‘<a
1793 href="#propdef-font-variant"><code
1794 class=property>font-variant</code></a>’</span> property may also be
1795 included but only those supported in CSS 2.1, none of the font-variant
1796 values added in this specification can be used in the <span
1797 class=property>‘<a href="#propdef-font"><code
1798 class=property>font</code></a>’</span> shorthand:
1800 <pre
1801 class=prod><dfn id=ltfont-variant-css21gt><var><font-variant-css21></var></dfn> = [normal | small-caps]</pre>
1803 <p>The syntax of this property is based on a traditional typographical
1804 shorthand notation to set multiple properties related to fonts.
1806 <p>All font-related properties are first reset to their initial values,
1807 including those listed in the preceding paragraph plus <span
1808 class=property>‘<a href="#propdef-font-size-adjust"><code
1809 class=property>font-size-adjust</code></a>’</span>, <span
1810 class=property>‘<a href="#propdef-font-kerning"><code
1811 class=property>font-kerning</code></a>’</span> and all font feature
1812 properties. Then, those properties that are given explicit values in the
1813 <span class=property>‘<a href="#propdef-font"><code
1814 class=property>font</code></a>’</span> shorthand are set to those
1815 values. For a definition of allowed and initial values, see the previously
1816 defined properties. For reasons of backwards compatibility, it is not
1817 possible to set <span class=property>‘<a
1818 href="#propdef-font-size-adjust"><code
1819 class=property>font-size-adjust</code></a>’</span> to anything other
1820 than its initial value using the <span class=property>‘<a
1821 href="#propdef-font"><code class=property>font</code></a>’</span>
1822 shorthand property; instead, use the individual property.
1824 <div class=example>
1825 <p style="display:none">Example(s):
1827 <p>
1829 <pre>p { font: 12pt/14pt sans-serif }
1830 p { font: 80% sans-serif }
1831 p { font: x-large/110% "new century schoolbook", serif }
1832 p { font: bold italic large Palatino, serif }
1833 p { font: normal small-caps 120%/120% fantasy }
1834 p { font: condensed oblique 12pt "Helvetica Neue", serif; }
1835 </pre>
1837 <p> In the second rule, the font size percentage value (‘<code
1838 class=css>80%</code>’) refers to the font size of the parent element.
1839 In the third rule, the line height percentage (‘<code
1840 class=css>110%</code>’) refers to the font size of the element itself.
1842 <p>The first three rules do not specify the <span class=property>‘<a
1843 href="#propdef-font-variant"><code
1844 class=property>font-variant</code></a>’</span> and <span
1845 class=property>‘<a href="#propdef-font-weight"><code
1846 class=property>font-weight</code></a>’</span> explicitly, so these
1847 properties receive their initial values (‘<a href="#normal2"><code
1848 class=property>normal</code></a>’). Notice that the font family name
1849 "new century schoolbook", which contains spaces, is enclosed in quotes.
1850 The fourth rule sets the <span class=property>‘<a
1851 href="#propdef-font-weight"><code
1852 class=property>font-weight</code></a>’</span> to ‘<code
1853 class=property>bold</code>’, the <span class=property>‘<a
1854 href="#propdef-font-style"><code
1855 class=property>font-style</code></a>’</span> to ‘<code
1856 class=property>italic</code>’, and implicitly sets <span
1857 class=property>‘<a href="#propdef-font-variant"><code
1858 class=property>font-variant</code></a>’</span> to ‘<a
1859 href="#normal2"><code class=property>normal</code></a>’.
1861 <p> The fifth rule sets the <span class=property>‘<a
1862 href="#propdef-font-variant"><code
1863 class=property>font-variant</code></a>’</span> (‘<a
1864 href="#small-caps"><code class=property>small-caps</code></a>’), the
1865 <span class=property>‘<a href="#propdef-font-size"><code
1866 class=property>font-size</code></a>’</span> (120% of the parent's font
1867 size), the <span class=property>‘<code
1868 class=property>line-height</code>’</span> (120% of the font size) and
1869 the <span class=property>‘<a href="#descdef-font-family"><code
1870 class=property>font-family</code></a>’</span> (‘<a
1871 href="#fantasy"><code class=property>fantasy</code></a>’). It follows
1872 that the keyword ‘<a href="#normal2"><code
1873 class=property>normal</code></a>’ applies to the two remaining
1874 properties: <span class=property>‘<a href="#propdef-font-style"><code
1875 class=property>font-style</code></a>’</span> and <span
1876 class=property>‘<a href="#propdef-font-weight"><code
1877 class=property>font-weight</code></a>’</span>.
1879 <p>The sixth rule sets the <span class=property>‘<a
1880 href="#propdef-font-style"><code
1881 class=property>font-style</code></a>’</span>, <span
1882 class=property>‘<a href="#propdef-font-stretch"><code
1883 class=property>font-stretch</code></a>’</span>, <span
1884 class=property>‘<a href="#propdef-font-size"><code
1885 class=property>font-size</code></a>’</span>, and <span
1886 class=property>‘<a href="#descdef-font-family"><code
1887 class=property>font-family</code></a>’</span>, the other font
1888 properties being set to their initial values.
1889 </div>
1891 <p>Since the ‘<a href="#propdef-font-stretch"><code
1892 class=property>font-stretch</code></a>’ property was not defined in CSS
1893 2.1, when using ‘<a href="#propdef-font-stretch"><code
1894 class=property>font-stretch</code></a>’ values within ‘<a
1895 href="#propdef-font"><code class=property>font</code></a>’ rules,
1896 authors should include a extra version compatible with older user agents:
1898 <pre>p {
1899 font: 80% sans-serif; /* for older user agents */
1900 font: condensed 80% sans-serif;
1901 }</pre>
1903 <p>The following values refer to system fonts:
1905 <dl>
1906 <dt><strong>caption</strong>
1908 <dd>The font used for captioned controls (e.g., buttons, drop-downs,
1909 etc.).
1911 <dt><strong>icon</strong>
1913 <dd>The font used to label icons.
1915 <dt><strong>menu</strong>
1917 <dd>The font used in menus (e.g., dropdown menus and menu lists).
1919 <dt><strong>message-box</strong>
1921 <dd>The font used in dialog boxes.
1923 <dt><strong>small-caption</strong>
1925 <dd>The font used for labeling small controls.
1927 <dt><strong>status-bar</strong>
1929 <dd>The font used in window status bars.
1930 </dl>
1932 <p>System fonts may only be set as a whole; that is, the font family, size,
1933 weight, style, etc. are all set at the same time. These values may then be
1934 altered individually if desired. If no font with the indicated
1935 characteristics exists on a given platform, the user agent should either
1936 intelligently substitute (e.g., a smaller version of the ‘<code
1937 class=property>caption</code>’ font might be used for the ‘<code
1938 class=property>small-caption</code>’ font), or substitute a user agent
1939 default font. As for regular fonts, if, for a system font, any of the
1940 individual properties are not part of the operating system's available
1941 user preferences, those properties should be set to their initial values.
1943 <p>That is why this property is "almost" a shorthand property: system fonts
1944 can only be specified with this property, not with <span
1945 class=property>‘<a href="#descdef-font-family"><code
1946 class=property>font-family</code></a>’</span> itself, so <span
1947 class=property>‘<a href="#propdef-font"><code
1948 class=property>font</code></a>’</span> allows authors to do more than
1949 the sum of its subproperties. However, the individual properties such as
1950 <span class=property>‘<a href="#propdef-font-weight"><code
1951 class=property>font-weight</code></a>’</span> are still given values
1952 taken from the system font, which can be independently varied.
1954 <p>Note that the keywords used for the system fonts listed above are only
1955 treated as keywords when they occur in the initial position, in other
1956 positions the same string is treated as part of the font family name:
1958 <pre> font: menu; /* use the font settings for system menus */
1959 font: large menu; /* use a font family named "menu" */</pre>
1961 <div class=example>
1962 <p style="display:none">Example(s):
1964 <p>
1966 <pre>button { font: 300 italic 1.3em/1.7em "FB Armada", sans-serif }
1967 button p { font: menu }
1968 button p em { font-weight: bolder }
1969 </pre>
1971 <p>If the font used for dropdown menus on a particular system happened to
1972 be, for example, 9-point Charcoal, with a weight of 600, then P elements
1973 that were descendants of BUTTON would be displayed as if this rule were
1974 in effect:
1976 <pre>button p { font: 600 9pt Charcoal }
1977 </pre>
1979 <p>Because the <span class=property>‘<a href="#propdef-font"><code
1980 class=property>font</code></a>’</span> shorthand resets to its initial
1981 value any property not explicitly given a value, this has the same effect
1982 as this declaration:
1984 <pre>button p {
1985 font-style: normal;
1986 font-variant: normal;
1987 font-weight: 600;
1988 font-size: 9pt;
1989 line-height: normal;
1990 font-family: Charcoal
1991 }
1992 </pre>
1993 </div>
1994 <!-- prop: font-synthesis -->
1996 <h3 id=font-synthesis-prop><span class=secno>3.8 </span>Controlling
1997 synthetic faces: the <a href="#propdef-font-synthesis">font-synthesis</a>
1998 property</h3>
2000 <table class=propdef id=namefont-synthesisvaluenone-weight-style>
2001 <tbody>
2002 <tr>
2003 <td>Name:
2005 <td><dfn id=propdef-font-synthesis>font-synthesis</dfn>
2007 <tr>
2008 <td>Value:
2010 <td>none | [ weight || style ]
2012 <tr>
2013 <td>Initial:
2015 <td>weight style
2017 <tr>
2018 <td>Applies to:
2020 <td>all elements
2022 <tr>
2023 <td>Inherited:
2025 <td>yes
2027 <tr>
2028 <td>Percentages:
2030 <td>N/A
2032 <tr>
2033 <td>Media:
2035 <td>visual
2037 <tr>
2038 <td>Computed value:
2040 <td>as specified
2042 <tr>
2043 <td>Animatable:
2045 <td>no
2046 </table>
2048 <p>This property controls whether user agents are allowed to synthesize
2049 bold or oblique font faces when a font family lacks bold or italic faces.
2050 If ‘<a href="#weight"><code class=property>weight</code></a>’ is not
2051 specified, user agents must not synthesize bold faces and if ‘<code
2052 class=property>style</code>’ is not specified user agents must not
2053 synthesize italic faces. A value of ‘<code class=property>none</code>’
2054 disallows all synthetic faces.
2056 <div class=example>
2057 <p>The style rule below disables the use of synthetically obliqued Arabic:</p>
2059 <pre>*:lang(ar) { font-synthesis: none; }
2060 </pre>
2061 </div>
2063 <h2 id=font-resources><span class=secno>4 </span>Font Resources</h2>
2065 <h3 id=font-face-rule><span class=secno>4.1 </span>The
2066 <code>@font-face</code> rule</h3>
2068 <p>The <code>@font-face</code> rule allows for linking to fonts that are
2069 automatically activated when needed. This allows authors to select a font
2070 that closely matches the design goals for a given page rather than
2071 limiting the font choice to a set of fonts available on all platforms. A
2072 set of font descriptors define the location of a font resource, either
2073 locally or externally, along with the style characteristics of an
2074 individual face. Multiple <code>@font-face</code> rules can be used to
2075 construct font families with a variety of faces. Using CSS font matching
2076 rules, a user agent can selectively download only those faces that are
2077 needed for a given piece of text.
2079 <p>The general form of an <span class=index-def id=font-face
2080 title="@font-face"><code>@font-face</code></span> <span class=index-inst
2081 id=at-rule title=at-rules>at-rule</span> is:
2083 <pre>
2084 @font-face { <span class=value-inst-font-description><font-description></span> }
2085 </pre>
2087 <p>where <span class=index-def id=ltfont-descriptiongt
2088 title="<font-description>"><a
2089 name=value-def-font-description><font-description></a></span> has
2090 the form:
2092 <pre>
2093 descriptor: value;
2094 descriptor: value;
2095 [...]
2096 descriptor: value;
2097 </pre>
2099 <p>Each <span class=index-inst id=font-face0
2100 title="@font-face"><code>@font-face</code></span> rule specifies a value
2101 for every font descriptor, either implicitly or explicitly. Those not
2102 given explicit values in the rule take the initial value listed with each
2103 descriptor in this specification. These descriptors apply solely within
2104 the context of the <code>@font-face</code> rule in which they are defined,
2105 and do not apply to document language elements. There is no notion of
2106 which elements the descriptors apply to or whether the values are
2107 inherited by child elements. When a given descriptor occurs multiple times
2108 in a given <code>@font-face</code> rule, only the last specified value is
2109 used, all prior values for that descriptor are ignored.
2111 <div class=example>
2112 <p>To use a downloadable font called Gentium:</p>
2114 <pre>
2115 @font-face {
2116 font-family: Gentium;
2117 src: url(http://example.com/fonts/Gentium.ttf);
2118 }
2120 p { font-family: Gentium, serif; }
2121 </pre>
2123 <p>The user agent will download Gentium and use it when rendering text
2124 within paragraph elements. If for some reason the site serving the font
2125 is unavailable, the default serif font will be used.</p>
2126 </div>
2128 <p>A given set of <code>@font-face</code> rules define a set of fonts
2129 available to containing documents. Multiple rules can be used to define a
2130 family with a large set of faces. When font matching is done fonts defined
2131 using these rules are considered before other available fonts on a system.
2134 <p>Downloaded fonts are only available to documents that reference them,
2135 the process of activating these fonts should not make them available to
2136 other applications or to documents that don't directly link to the same
2137 font. User agent implementers might consider it convenient to use
2138 downloaded fonts when rendering characters in other documents for which no
2139 other available font exists as part of the system font fallback procedure.
2140 This would cause a security leak since the contents of one page would be
2141 able to affect other pages, something an attacker could use as an attack
2142 vector. These restrictions do not affect caching behavior, fonts are
2143 cached the same way other web resources are cached.
2145 <p>User agents which do not understand the <code>@font-face</code> rule
2146 encounter the opening curly bracket and ignore forward until the closing
2147 curly bracket. This at-rule conforms with the forward-compatible parsing
2148 requirement of CSS, parsers may ignore these rules without error. Any
2149 descriptors that are not recognized or implemented by a given user agent
2150 must be ignored. <code>@font-face</code> rules require a font-family and
2151 src descriptor, if either of these are missing the <code>@font-face</code>
2152 must be ignored.
2154 <p>In cases where user agents have limited platform resources or implement
2155 the ability to disable downloadable font resources,
2156 <code>@font-face</code> rules must simply be ignored; the behavior of
2157 individual descriptors as defined in this specification should not be
2158 altered.
2160 <h3 id=font-family-desc><span class=secno>4.2 </span>Font family: the <a
2161 href="#descdef-font-family">font-family</a> descriptor</h3>
2163 <table class=descdef>
2164 <tbody>
2165 <tr>
2166 <td>Name:
2168 <td><dfn id=descdef-font-family>font-family</dfn>
2170 <tr>
2171 <td>Value:
2173 <td><family-name>
2175 <tr>
2176 <td><em>Initial:</em>
2178 <td>N/A
2179 </table>
2181 <p>This descriptor defines the font family name that will be used in all
2182 CSS font family name matching, overriding font family names contained in
2183 the underlying font data. If the font family name is the same as a font
2184 family available in a given user's environment, it effectively hides the
2185 underlying font for documents that use the stylesheet. This permits a web
2186 author to freely choose font-family names without worrying about conflicts
2187 with font family names present in a given user's environment. Errors
2188 loading font data do not affect font name matching behavior. User agents
2189 that apply platform font aliasing rules to font family names defined via
2190 <code>@font-face</code> rules are considered non-conformant.
2192 <h3 id=src-desc><span class=secno>4.3 </span>Font reference: the <a
2193 href="#descdef-src">src</a> descriptor</h3>
2195 <table class=descdef>
2196 <tbody>
2197 <tr>
2198 <td>Name:
2200 <td><dfn id=descdef-src>src</dfn>
2202 <tr>
2203 <td>Value:
2205 <td>[ <uri> [format(<string>#)]? | <font-face-name> ]#
2207 <tr>
2208 <td><em>Initial:</em>
2210 <td>N/A
2211 </table>
2213 <p>This descriptor specifies the resource containing font data. It is
2214 required, whether the font is downloadable or locally installed. Its value
2215 is a prioritized, comma-separated list of external references or locally
2216 installed font face names. When a font is needed the user agent iterates
2217 over the set of references listed, using the first one it can successfully
2218 activate. Fonts containing invalid data or local font faces that are not
2219 found are ignored and the user agent loads the next font in the list
2220 (platform substitutions for a given font must not be used).
2222 <p>As with other URIs in CSS, the URI may be partial, in which case it is
2223 resolved relative to the location of the style sheet containing the <span
2224 class=index-inst id=font-face1
2225 title="@font-face"><code>@font-face</code></span> rule. In the case of SVG
2226 fonts, the URL points to an element within a document containing SVG font
2227 definitions. If the element reference is omitted, a reference to the first
2228 defined font is implied. Similarly, font container formats that can
2229 contain more than one font must load one and only one of the fonts for a
2230 given <code>@font-face</code> rule. Fragment identifiers are used to
2231 indicate which font to load. If a container format lacks a defined
2232 fragment identifier scheme, implementations should use a simple 1-based
2233 indexing scheme (e.g. "font-collection#1" for the first font,
2234 "font-collection#2" for the second font).
2236 <pre>
2237 src: url(fonts/simple.ttf); /* load simple.ttf relative to stylesheet location */
2238 src: url(/fonts/simple.ttf); /* load simple.ttf from absolute location */
2239 src: url(fonts.svg#simple); /* load SVG font with id 'simple' */
2240 </pre>
2242 <p>External references consist of a URI, followed by an optional hint
2243 describing the format of the font resource referenced by that URI. The
2244 format hint contains a comma-separated list of format strings that denote
2245 well-known font formats. Conformant user agents must skip downloading a
2246 font resource if the format hints indicate only unsupported or unknown
2247 font formats. If no format hints are supplied, the user agent should
2248 download the font resource.
2250 <pre>
2251 /* load WOFF font if possible, otherwise use OpenType font */
2252 @font-face {
2253 font-family: bodytext;
2254 src: url(ideal-sans-serif.woff) format("woff"),
2255 url(basic-sans-serif.ttf) format("opentype");
2256 }
2257 </pre>
2259 <p>Format strings defined by this specification:
2261 <table class=data id=fontformats>
2262 <thead>
2263 <tr>
2264 <th>String
2266 <th>Font Format
2268 <th>Common extensions
2270 <tbody>
2271 <tr>
2272 <th>"woff"
2274 <td><a href="http://www.w3.org/TR/WOFF/">WOFF (Web Open Font Format)</a>
2276 <td>.woff
2278 <tr>
2279 <th>"truetype"
2281 <td><a
2282 href="http://www.microsoft.com/typography/otspec/default.htm">TrueType</a>
2284 <td>.ttf
2286 <tr>
2287 <th>"opentype"
2289 <td><a
2290 href="http://www.microsoft.com/typography/otspec/default.htm">OpenType</a>
2292 <td>.ttf, .otf
2294 <tr>
2295 <th>"embedded-opentype"
2297 <td><a
2298 href="http://www.w3.org/Submission/2008/SUBM-EOT-20080305/">Embedded
2299 OpenType</a>
2301 <td>.eot
2303 <tr>
2304 <th>"svg"
2306 <td><a href="http://www.w3.org/TR/SVG/fonts.html">SVG Font</a>
2308 <td>.svg, .svgz
2309 </table>
2311 <p>Given the overlap in common usage between TrueType and OpenType, the
2312 format hints "truetype" and "opentype" must be considered as synonymous; a
2313 format hint of "opentype" does not imply that the font contains Postscript
2314 CFF style glyph data or that it contains OpenType layout information (see
2315 <a href="#platform-props-to-css">Appendix A</a> for more background on
2316 this).
2318 <p>When authors would prefer to use a locally available copy of a given
2319 font and download it if it's not, local() can be used. The locally
2320 installed <span class=index-def id=ltfont-face-namegt
2321 title="<font-face-name>"><a
2322 name=value-def-font-face-name><font-face-name></a></span> is a
2323 format-specific string that uniquely identifies a single font face within
2324 a larger family. The syntax for a <font-face-name> is a unique font
2325 face name enclosed by "local(" and ")".
2327 <pre>
2328 /* regular face of Gentium */
2329 @font-face {
2330 font-family: MyGentium;
2331 src: local(Gentium), /* use locally available Gentium */
2332 url(Gentium.ttf); /* otherwise, download it */
2333 }
2334 </pre>
2336 <p>The name can optionally be enclosed in quotes. For OpenType and TrueType
2337 fonts, this string is used to match only the Postscript name or the full
2338 font name in the name table of locally available fonts. Which is used
2339 varies by platform and font, so authors should include both of these names
2340 to assure proper matching across platforms.
2342 <pre>
2343 /* bold face of Gentium */
2344 @font-face {
2345 font-family: MyGentium;
2346 src: local(Gentium Bold), /* full font name */
2347 local(Gentium-Bold), /* Postscript name */
2348 url(GentiumBold.ttf); /* otherwise, download it */
2349 font-weight: bold;
2350 }
2351 </pre>
2353 <p>Just as a <code>@font-face</code> rule specifies the characteristics of
2354 a single font within a family, the unique name used with local() specifies
2355 a single font, not an entire font family. Defined in terms of OpenType
2356 font data, the Postscript name is found in the font's <a
2357 href="http://www.microsoft.com/typography/otspec/name.htm">name table</a>,
2358 in the name record with nameID = 6 (see <a href="#OPENTYPE"
2359 rel=biblioentry>[OPENTYPE]<!--{{!OPENTYPE}}--></a> for more details). The
2360 Postscript name is the commonly used key for all fonts on OSX and for
2361 Postscript CFF fonts under Windows. The full font name (nameID = 4) is
2362 used as a unique key for fonts with TrueType glyphs on Windows.
2364 <p>For OpenType fonts with multiple localizations of the full font name,
2365 the US English version is used (language ID = 0x409 for Windows and
2366 language ID = 0 for Macintosh) or the first localization when a US English
2367 full font name is not available (the OpenType specification recommends
2368 that <a href="http://www.microsoft.com/typography/otspec/recom.htm">all
2369 fonts minimally include US English names</a>). User agents that also match
2370 other full font names, e.g. matching the Dutch name when the current
2371 system locale is set to Dutch, are considered non-conformant. This is done
2372 not to prefer English but to avoid matching inconsistencies across font
2373 versions and OS localizations, since font style names (e.g. "Bold") are
2374 frequently localized into many languages and the set of localizations
2375 available varies widely across platform and font version. User agents that
2376 match a concatenation of family name (nameID = 1) with style name (nameID
2377 = 2) are considered non-conformant.
2379 <p>This also allows for referencing faces that belong to larger families
2380 that cannot otherwise be referenced.
2382 <div class=example>
2383 <p>Use a local font or reference an SVG font in another document:</p>
2385 <pre>
2386 @font-face {
2387 font-family: Headline;
2388 src: local(Futura-Medium),
2389 url(fonts.svg#MyGeometricModern) format("svg");
2390 }
2391 </pre>
2393 <p>Create an alias for local Japanese fonts on different platforms:</p>
2395 <pre>
2396 @font-face {
2397 font-family: jpgothic;
2398 src: local(HiraKakuPro-W3), local(Meiryo), local(IPAPGothic);
2399 }
2400 </pre>
2402 <p>Reference a font face that cannot be matched within a larger family:</p>
2404 <pre>
2405 @font-face {
2406 font-family: Hoefler Text Ornaments;
2407 /* has the same font properties as Hoefler Text Regular */
2408 src: local(HoeflerText-Ornaments);
2409 }
2410 </pre>
2412 <p>Since localized fullnames should never match, a document with the
2413 header style rules below would always render using the default serif
2414 font, regardless whether a particular system locale parameter is set to
2415 Finnish or not:</p>
2417 <pre>
2418 @font-face {
2419 font-family: SectionHeader;
2420 src: local("Arial Lihavoitu"); /* Finnish fullname for Arial Bold, should fail */
2421 font-weight: bold;
2422 }
2424 h2 { font-family: SectionHeader, serif; }
2425 </pre>
2427 <p>A conformant user agent should never load the font ‘<code
2428 class=css>gentium.eot</code>’ in the example below, since it is
2429 included in the first definition of the ‘<a href="#descdef-src"><code
2430 class=property>src</code></a>’ descriptor which is overridden by the
2431 second definition in the same <code>@font-face</code> rule:</p>
2433 <pre>
2434 @font-face {
2435 font-family: MainText;
2436 src: url(gentium.eot); /* for use with older non-conformant user agents */
2437 src: local("Gentium"), url(gentium.ttf); /* Overrides src definition */
2438 }
2439 </pre>
2440 </div>
2442 <h3 id=font-prop-desc><span class=secno>4.4 </span>Font property
2443 descriptors: the <a href="#descdef-font-style">font-style</a>, <a
2444 href="#descdef-font-weight">font-weight</a>, <a
2445 href="#descdef-font-stretch">font-stretch</a> descriptors</h3>
2447 <table class=descdef>
2448 <tbody>
2449 <tr>
2450 <td>Name:
2452 <td><dfn id=descdef-font-style title="font-style
2453 (descriptor)">font-style</dfn>
2455 <tr>
2456 <td>Value:
2458 <td>normal | italic | oblique
2460 <tr>
2461 <td><em>Initial:</em>
2463 <td>normal
2464 </table>
2466 <table class=descdef>
2467 <tbody>
2468 <tr>
2469 <td>Name:
2471 <td><dfn id=descdef-font-weight title="font-weight
2472 (descriptor)">font-weight</dfn>
2474 <tr>
2475 <td>Value:
2477 <td>normal | bold | 100 | 200 | 300 | 400 | 500 | 600 | 700 | 800 | 900
2479 <tr>
2480 <td><em>Initial:</em>
2482 <td>normal
2483 </table>
2485 <table class=descdef>
2486 <tbody>
2487 <tr>
2488 <td>Name:
2490 <td><dfn id=descdef-font-stretch title="font-stretch
2491 (descriptor)">font-stretch</dfn>
2493 <tr>
2494 <td>Value:
2496 <td>normal | ultra-condensed | extra-condensed | condensed |
2497 semi-condensed | semi-expanded | expanded | extra-expanded |
2498 ultra-expanded
2500 <tr>
2501 <td><em>Initial:</em>
2503 <td>normal
2504 </table>
2506 <p>These descriptors define the characteristics of a font face and are used
2507 in the process of matching styles to specific faces. For a font family
2508 defined with several <code>@font-face</code> rules, user agents can either
2509 download all faces in the family or use these descriptors to selectively
2510 download font faces that match actual styles used in document. The values
2511 for these descriptors are the same as those for the corresponding font
2512 properties except that relative keywords are not allowed, ‘<code
2513 class=property>bolder</code>’ and ‘<code
2514 class=property>lighter</code>’. If these descriptors are omitted,
2515 default values are assumed.
2517 <p>The value for these font face style attributes is used in place of the
2518 style implied by the underlying font data. This allows authors to combine
2519 faces in flexible combinations, even in situations where the original font
2520 data was arranged differently. User agents that implement synthetic
2521 bolding and obliqueing must only apply synthetic styling in cases where
2522 the font descriptors imply this is needed, rather than based on the style
2523 attributes implied by the font data.
2525 <h3 id=unicode-range-desc><span class=secno>4.5 </span>Character range: the
2526 <a href="#descdef-unicode-range">unicode-range</a> descriptor</h3>
2528 <table class=descdef>
2529 <tbody>
2530 <tr>
2531 <td>Name:
2533 <td><dfn id=descdef-unicode-range>unicode-range</dfn>
2535 <tr>
2536 <td>Value:
2538 <td><urange>#
2540 <tr>
2541 <td><em>Initial:</em>
2543 <td>U+0-10FFFF
2544 </table>
2546 <p>This descriptor defines the range of Unicode characters supported by a
2547 given font. The values of <span class=index-def id=lturangegt
2548 title="<urange>"><a name=value-def-urange><urange></a></span>
2549 are expressed using hexadecimal numbers prefixed by "U+" or "u+",
2550 corresponding to <a href="http://www.unicode.org/charts/">Unicode
2551 character code points</a>. The unicode-range descriptor serves as a hint
2552 for user agents when deciding whether or not to download a font resource.
2554 <p>Unicode range values are written using hexadecimal values and are ASCII
2555 case-insensitive. Each is prefixed by "U+" or "u+" and multiple,
2556 discontinuous ranges are separated by commas. Whitespace before or after
2557 commas is ignored. Valid character code values vary between 0 and 10FFFF
2558 inclusive. A single range has three basic forms:
2560 <ul>
2561 <li>a single code point (e.g. U+416)
2563 <li>an interval value range (e.g. U+400-4ff)
2565 <li>a range where trailing ‘<code class=css>?</code>’ characters imply
2566 ‘<code class=css>any digit value</code>’ (e.g. U+4??)
2567 </ul>
2569 <p>Ranges that do not fit any of the above three forms are considered to be
2570 parse errors and the descriptor is omitted. Interval ranges consisting of
2571 a single code point are valid. Ranges specified with ‘?’ that lack an
2572 initial digit (e.g. "U+???") are also valid, and are treated as if there
2573 was a single 0 before the question marks (thus, "U+???" = "U+0???" =
2574 "U+0000-0FFF"). "U+??????" is not a syntax error, even though "U+0??????"
2575 would be. Ranges can overlap but interval ranges that descend (e.g.
2576 U+400-32f) are invalid and omitted rather than treated as parse errors;
2577 they have no effect on other ranges in a list of ranges. Ranges are
2578 clipped to the domain of Unicode code points (currently 0 – 10FFFF
2579 inclusive); a range entirely outside the domain is omitted. Without any
2580 valid ranges, the descriptor is omitted. User agents may normalize the
2581 list of ranges into a list that is different but represents the same set
2582 of character code points.
2584 <p>The character range can be a subset of the full <a
2585 href="#character-map"><em>character map</em></a> of the underlying font.
2586 The effective unicode-range used when mapping characters to fonts is the
2587 intersection of the unicode range specified and the underlying <a
2588 href="#character-map"><em>character map</em></a> of the font. This means
2589 that authors do not need to define the unicode-range of a font precisely,
2590 broad ranges for which a sparse set of code points are defined in the font
2591 can be used. Code points outside of the defined unicode-range are ignored,
2592 regardless of whether the font contains a glyph for that code point or
2593 not. User agents that download fonts for characters outside the defined
2594 unicode-range are considered non-conformant. Likewise, user agents that
2595 render a character using a font resource for which the defined
2596 unicode-range does not include that character are also considered
2597 non-conformant.
2599 <p>Example ranges for specific languages or characters:
2601 <dl>
2602 <dt>unicode-range: U+A5;
2604 <dd>a single code point, the yen/yuan symbol
2606 <dt>unicode-range: U+0-7F;
2608 <dd>code range for basic ASCII characters
2610 <dt>unicode-range: U+590-5ff;
2612 <dd>code range for Hebrew characters
2614 <dt>unicode-range: U+A5, U+4E00-9FFF, U+30??, U+FF00-FF9F;
2616 <dd>code range for Japanese kanji, hiragana and katakana characters plus
2617 yen/yuan symbol
2618 </dl>
2620 <div class=example>
2621 <p>The BBC provides news services in a wide variety of languages, many
2622 that are not well supported across all platforms. Using an
2623 <code>@font-face</code> rule, the BBC could provide a font for any of
2624 these languages, as it already does via a manual font download.</p>
2626 <pre>
2627 @font-face {
2628 font-family: BBCBengali;
2629 src: url(fonts/BBCBengali.ttf) format("opentype");
2630 unicode-range: U+00-FF, U+980-9FF;
2631 }
2632 </pre>
2633 </div>
2635 <div class=example>
2636 <p>Technical documents often require a wide range of symbols. The STIX
2637 Fonts project is one project aimed at providing fonts to support a wide
2638 range of technical typesetting in a standardized way. The example below
2639 shows the use of a font that provides glyphs for many of the mathematical
2640 and technical symbol ranges within Unicode:</p>
2642 <pre>
2643 @font-face {
2644 font-family: STIXGeneral;
2645 src: local(STIXGeneral), url(/stixfonts/STIXGeneral.otf);
2646 unicode-range: U+000-49F, U+2000-27FF, U+2900-2BFF, U+1D400-1D7FF;
2647 }
2648 </pre>
2649 </div>
2651 <p>Multiple <code>@font-face</code> rules with different unicode ranges for
2652 the same family and style descriptor values can be used to create
2653 composite fonts that mix the glyphs from different fonts for different
2654 scripts. This can be used to combine fonts that only contain glyphs for a
2655 single script (e.g. Latin, Greek, Cyrillic) or it can be used by authors
2656 as a way of segmenting a font into fonts for commonly used characters and
2657 less frequently used characters. Since the user agent will only pull down
2658 the fonts it needs this helps reduce page bandwidth.
2660 <p>If the unicode ranges overlap for a set of <code>@font-face</code> rules
2661 with the same family and style descriptor values, the rules are ordered in
2662 the reverse order they were defined; the last rule defined is the first to
2663 be checked for a given character.
2665 <div class=example>
2666 <p>This example shows how an author can override the glyphs used for Latin
2667 characters in a Japanese font with glyphs from a different font. The
2668 first rule specifies no range so it defaults to the entire range. The
2669 range specified in the second rule overlaps but takes precedence because
2670 it is defined later.</p>
2672 <pre>
2673 @font-face {
2674 font-family: JapaneseWithGentium;
2675 src: local(MSMincho);
2676 /* no range specified, defaults to entire range */
2677 }
2679 @font-face {
2680 font-family: JapaneseWithGentium;
2681 src: url(../fonts/Gentium.ttf);
2682 unicode-range: U+0-2FF;
2683 }
2684 </pre>
2685 </div>
2687 <div class=example>
2688 <p>Consider a family constructed to optimize bandwidth by separating out
2689 Latin, Japanese and other characters into different font files:</p>
2691 <pre>
2692 /* fallback font - size: 4.5MB */
2693 @font-face {
2694 font-family: DroidSans;
2695 src: url(DroidSansFallback.ttf);
2696 /* no range specified, defaults to entire range */
2697 }
2699 /* Japanese glyphs - size: 1.2MB */
2700 @font-face {
2701 font-family: DroidSans;
2702 src: url(DroidSansJapanese.ttf);
2703 unicode-range: U+3000-9FFF, U+ff??;
2704 }
2706 /* Latin, Greek, Cyrillic along with some
2707 punctuation and symbols - size: 190KB */
2708 @font-face {
2709 font-family: DroidSans;
2710 src: url(DroidSans.ttf);
2711 unicode-range: U+000-5FF, U+1e00-1fff, U+2000-2300;
2712 }
2713 </pre>
2715 <p>For simple Latin text, only the font for Latin characters is
2716 downloaded:</p>
2718 <pre>
2719 body { font-family: DroidSans; }
2721 <p>This is that</p>
2722 </pre>
2724 <p>In this case the user agent first checks the unicode-range for the font
2725 containing Latin characters (DroidSans.ttf). Since all the characters
2726 above are in the range U+0-5FF, the user agent downloads the font and
2727 renders the text with that font.</p>
2729 <p>Next, consider text that makes use of an arrow character (⇨):</p>
2731 <pre>
2732 <p>This &#x21e8; that<p>
2733 </pre>
2735 <p>The user agent again first checks the unicode-range of the font
2736 containing Latin characters. Since U+2000-2300 includes the arrow code
2737 point (U+21E8), the user agent downloads the font. For this character
2738 however the Latin font does not have a matching glyph, so the effective
2739 unicode-range used for font matching excludes this code point. Next, the
2740 user agent evaluates the Japanese font. The unicode-range for the
2741 Japanese font, U+3000-9FFF and U+ff??, does not include U+21E8, so the
2742 user agent does not download the Japanese font. Next the fallback font is
2743 considered. The <code>@font-face</code> rule for the fallback font does
2744 not define unicode-range so its value defaults to the range of all
2745 Unicode code points. The fallback font is downloaded and used to render
2746 the arrow character.</p>
2747 </div>
2749 <h3 id=font-rend-desc><span class=secno>4.6 </span>Font features: the <a
2750 href="#descdef-font-variant">font-variant</a> and <a
2751 href="#descdef-font-feature-settings">font-feature-settings</a>
2752 descriptors</h3>
2754 <table class=descdef>
2755 <tbody>
2756 <tr>
2757 <td>Name:
2759 <td><dfn id=descdef-font-variant title="font-variant
2760 (descriptor)">font-variant</dfn>
2762 <tr>
2763 <td>Value:
2765 <td>normal | [ <common-lig-values> ||
2766 <discretionary-lig-values> || <historical-lig-values> ||
2767 <contextual-alt-values> || stylistic(<feature-value-name>)
2768 || historical-forms || styleset(<feature-value-name>#) ||
2769 character-variant(<feature-value-name>#) ||
2770 swash(<feature-value-name>) ||
2771 ornaments(<feature-value-name>) ||
2772 annotation(<feature-value-name>) || [ small-caps | all-small-caps
2773 | petite-caps | all-petite-caps | unicase | titling-caps ] ||
2774 <numeric-figure-values> || <numeric-spacing-values> ||
2775 <numeric-fraction-values> || ordinal || slashed-zero ||
2776 <east-asian-variant-values> || <east-asian-width-values> ||
2777 ruby ]
2779 <tr>
2780 <td><em>Initial:</em>
2782 <td>normal
2783 </table>
2785 <table class=descdef>
2786 <tbody>
2787 <tr>
2788 <td>Name:
2790 <td><dfn id=descdef-font-feature-settings title="font-feature-settings
2791 (descriptor)">font-feature-settings</dfn>
2793 <tr>
2794 <td>Value:
2796 <td>normal | <feature-tag-value>#
2798 <tr>
2799 <td><em>Initial:</em>
2801 <td>normal
2802 </table>
2804 <p>These descriptors define settings that apply when the font defined by an
2805 <code>@font-face</code> rule is rendered. They do not affect font
2806 selection. Values are identical to those defined for the corresponding
2807 ‘<a href="#propdef-font-variant"><code
2808 class=property>font-variant</code></a>’ and ‘<a
2809 href="#propdef-font-feature-settings"><code
2810 class=property>font-feature-settings</code></a>’ properties defined
2811 below except that the value ‘<code class=property>inherit</code>’ is
2812 omitted. When multiple font feature descriptors or properties are used,
2813 the cumulative effect on text rendering is described below.
2815 <h3 id=font-face-loading><span class=secno>4.7 </span>Font loading
2816 guidelines</h3>
2818 <p>The <code>@font-face</code> rule is designed to allow lazy loading of
2819 fonts, fonts are only downloaded when needed for use within a document. A
2820 stylesheet can include <code>@font-face</code> rules for a library of
2821 fonts of which only a select set are used; user agents must only download
2822 those fonts that are referred to within the style rules applicable to a
2823 given page. User agents that download all fonts defined in
2824 <code>@font-face</code> rules without considering whether those fonts are
2825 in fact used within a page are considered non-conformant. In cases where a
2826 font might be downloaded in character fallback cases, user agents may
2827 download a font if it's listed in a font list but is not actually used for
2828 a given text run.
2830 <pre>
2831 @font-face {
2832 font-family: GeometricModern;
2833 src: url(font.ttf);
2834 }
2836 p {
2837 /* font will be downloaded for pages with p elements */
2838 font-family: GeometricModern, sans-serif;
2839 }
2841 h2 {
2842 /* font may be downloaded for pages with h2 elements, even if Futura is available locally */
2843 font-family: Futura, GeometricModern, sans-serif;
2844 }
2845 </pre>
2847 <p>In cases where textual content is loaded before downloadable fonts are
2848 available, user agents may render text as it would be rendered if
2849 downloadable font resources are not available or they may render text
2850 transparently with fallback fonts to avoid a flash of text using a
2851 fallback font. In cases where the font download fails user agents must
2852 display text, simply leaving transparent text is considered non-conformant
2853 behavior. Authors are advised to use fallback fonts in their font lists
2854 that closely match the vertical metrics of the downloadable fonts to avoid
2855 large page reflows where possible.
2857 <h3 id=same-origin-restriction><span class=secno>4.8 </span>Same-origin
2858 restriction for fonts</h3>
2860 <h4 id=default-same-origin-restriction><span class=secno>4.8.1
2861 </span>Default same-origin restriction</h4>
2862 <!-- TPAC 2011 Resolution to require same-origin restriction for loading fonts:
2863 http://lists.w3.org/Archives/Public/www-style/2011Nov/0711.html
2864 http://www.w3.org/2011/10/31-webapps-minutes.html#item02
2865 -->
2867 <p>User agents must implement a same-origin restriction when loading fonts
2868 via the <code>@font-face</code> mechanism. This restriction limits the
2869 loading of fonts for a given document to fonts loaded from the same
2870 origin. Fonts can only be loaded via the same host, port, and method
2871 combination as the containing document, using the <a
2872 href="http://www.w3.org/TR/html5/browsers.html#origin">origin matching
2873 algorithm</a> described in the <a href="#HTML5"
2874 rel=biblioentry>[HTML5]<!--{{!HTML5}}--></a> specification. The origin of
2875 the stylesheet containing <code>@font-face</code> rules is not used when
2876 deciding whether a font is same origin or not, only the origin of the
2877 containing document is used. The restriction applies to all font types.
2879 <p>Given a document located at http://example.com/page.html, fonts defined
2880 with ‘<a href="#descdef-src"><code class=property>src</code></a>’
2881 definitions considered cross origin must not be loaded:
2883 <pre>
2884 /* same origin (i.e. domain, protocol, port match document) */
2885 src: url(fonts/simple.ttf);
2886 src: url(//fonts/simple.ttf);
2888 /* cross origin, different protocol */
2889 src: url(https://example.com/fonts/simple.ttf);
2891 /* cross origin, different domain */
2892 src: url(http://another.example.com/fonts/simple.ttf);
2893 </pre>
2895 <h4 id=allowing-cross-origin-font-loading><span class=secno>4.8.2
2896 </span>Allowing cross-origin font loading</h4>
2898 <p>User agents must also implement the ability to relax this restriction
2899 using cross-site origin controls <a href="#CORS"
2900 rel=biblioentry>[CORS]<!--{{!CORS}}--></a> for fonts loaded via HTTP.
2901 Sites can explicitly allow cross-site downloading of font data using the
2902 <code>Access-Control-Allow-Origin</code> HTTP header. For other protocols,
2903 no explicit relaxation mechanism is defined or required.
2905 <p>For font loads over HTTP, cross-origin requests must be made with the
2906 following parameter settings which are used in conjunction with the <a
2907 href="http://www.w3.org/TR/cors/#cross-origin-request-0"> <em>cross-origin
2908 request algorithm</em></a> <a href="#CORS"
2909 rel=biblioentry>[CORS]<!--{{!CORS}}--></a>:
2911 <ul>
2912 <li><em>request URL</em> — the URL of the font resource in the <a
2913 href="#descdef-src"><code>src</code></a> descriptor
2915 <li><em>request method</em> — GET
2917 <li><em>author request headers</em> — none
2919 <li><em>request entity body</em> — empty
2921 <li><em>source origin</em> — the origin of the page which linked to the
2922 stylesheet
2924 <li><em>manual redirect flag</em> — false
2926 <li><em>omit credentials flag</em> — true
2928 <li><em>force preflight flag</em> — false
2929 </ul>
2931 <h2 id=font-matching-algorithm><span class=secno>5 </span>Font Matching
2932 Algorithm</h2>
2934 <p>The algorithm below describes how fonts are associated with individual
2935 runs of text. For each character in the run a font family is chosen and a
2936 particular font face is selected containing a glyph for that character.
2938 <h3 id=font-family-casing><span class=secno>5.1 </span>Case sensitivity of
2939 font family names</h3>
2941 <p>As part of the font matching algorithm outlined below, user agents must
2942 match font family names used in style rules with actual font family names
2943 contained in fonts available in a given environment or defined via
2944 <code>@font-face</code> rules. User agents must match these names case
2945 insensitively, using the "Default Caseless Matching" algorithm outlined in
2946 the Unicode specification <a href="#UNICODE6"
2947 rel=biblioentry>[UNICODE6]<!--{{!UNICODE6}}--></a>. This algorithm is
2948 detailed in section 3.13 entitled "Default Case Algorithms". Specifically,
2949 the algorithm must be applied without normalizing the strings involved and
2950 without applying any language-specific tailorings. The case folding method
2951 specified by this algorithm uses the case mappings with status field
2952 ‘<code class=property>C</code>’ or ‘<code class=property>F</code>’
2953 in the CaseFolding.txt file of the Unicode Character Database.
2955 <p class=note> Implementors should take care to verify that a given
2956 caseless string comparison implementation uses this precise algorithm and
2957 not assume that a given platform string matching routine follows it, as
2958 many of these have locale-specific behavior or use some level of string
2959 normalization.
2961 <p class=note> For authors this means that font family names are matched
2962 case insensitively, whether or not those names exist in a platform font or
2963 in the <code>@font-face</code> rules contained in a stylesheet. Authors
2964 should take care to ensure that names use a character sequence consistent
2965 with the actual font family name, particularly when using combining
2966 characters such as diacritical marks. For example, a family name that
2967 contains an uppercase A (U+0041) followed by a combining ring (U+030A)
2968 will <strong>not</strong> match a name that looks identical but which uses
2969 the precomposed lowercase a-ring character (U+00E5) instead of the
2970 combining sequence.
2972 <h3 id=font-style-matching><span class=secno>5.2 </span>Matching font
2973 styles</h3>
2975 <p>The procedure for choosing fonts consists of iterating over the font
2976 families determined by the font-family property, selecting a font face
2977 with the appropriate style based on other font properties and then
2978 determining whether a glyph exists for a given character. This is done
2979 using the <dfn id=character-map>character map</dfn> of the font, data
2980 which maps characters to the default glyph for that character. Codepoint
2981 sequences consisting of a base character followed by a sequence of
2982 combining characters are treated slightly differently, see the section on
2983 <a href="#cluster-matching">cluster matching</a> below.
2985 <p>For this procedure, the <dfn id=default-face>default face</dfn> for a
2986 given font family is defined to be the face that would be selected if all
2987 font style properties were set to their initial value.
2989 <ol id=fontmatchingalg>
2990 <li>Using the computed font property values for a given element, the user
2991 agent starts with the first family name in the fontlist specified by the
2992 <span class=property>‘<a href="#descdef-font-family"><code
2993 class=property>font-family</code></a>’</span> property.
2995 <li>If the family name is unquoted and is a generic family name, the user
2996 agent looks up the appropriate font family name to be used. User agents
2997 may choose the generic font family to use based on the language of the
2998 containing element or the Unicode range of the character.
3000 <li>For other family names, the user agent attempts to find the family
3001 name among fonts defined via <code>@font-face</code> rules and then among
3002 available system fonts, matching names with a case-insensitive comparison
3003 as outlined <a href="#font-family-casing">in the section above</a>. On
3004 systems containing fonts with multiple localized font family names, user
3005 agents must match any of these names independent of the underlying system
3006 locale or platform API used. If a font family defined via
3007 <code>@font-face</code> rules contains only invalid font data, it should
3008 be considered as if a font was present but contained an empty <a
3009 href="#character-map"><em>character map</em></a>; matching a platform
3010 font with the same name must not occur in this case.
3012 <li>If a font family match occurs, the user agent assembles the set of
3013 font faces in that family and then narrows the set to a single face using
3014 other font properties in the order given below:
3015 <ol id=fontstylematchingalg>
3016 <li><span class=property>‘<a href="#propdef-font-stretch"><code
3017 class=property>font-stretch</code></a>’</span> is tried first. If the
3018 matching set contains faces with width values matching the ‘<a
3019 href="#propdef-font-stretch"><code
3020 class=property>font-stretch</code></a>’ value, faces with other width
3021 values are removed from the matching set. If there is no face that
3022 exactly matches the width value the nearest width is used instead. If
3023 the value of ‘<a href="#propdef-font-stretch"><code
3024 class=property>font-stretch</code></a>’ is ‘<a
3025 href="#normal2"><code class=property>normal</code></a>’ or one of the
3026 condensed values, narrower width values are checked first, then wider
3027 values. If the value of ‘<a href="#propdef-font-stretch"><code
3028 class=property>font-stretch</code></a>’ is one of the expanded
3029 values, wider values are checked first, followed by narrower values.
3030 Once the closest matching width has been determined by this process,
3031 faces with other widths are removed from the matching set.
3033 <li><span class=property>‘<a href="#propdef-font-style"><code
3034 class=property>font-style</code></a>’</span> is tried next. If the
3035 value of ‘<a href="#propdef-font-style"><code
3036 class=property>font-style</code></a>’ is ‘<code
3037 class=property>italic</code>’, italic faces are checked first, then
3038 oblique, then normal faces. If the value is ‘<code
3039 class=property>oblique</code>’, oblique faces are checked first, then
3040 italic faces and then normal faces. If the value is ‘<a
3041 href="#normal2"><code class=property>normal</code></a>’, normal faces
3042 are checked first, then oblique faces, then italic faces. Faces with
3043 other style values are excluded from the matching set. User agents are
3044 permitted to distinguish between italic and oblique faces within
3045 platform font families but this is not required, they may treat all
3046 italic or oblique faces as italic faces. However, within font families
3047 defined via <code>@font-face</code> rules, italic and oblique faces
3048 must be distinguished using the value of the ‘<a
3049 href="#propdef-font-style"><code
3050 class=property>font-style</code></a>’ descriptor.
3052 <li><span class=property>‘<a href="#propdef-font-weight"><code
3053 class=property>font-weight</code></a>’</span> is matched next, it
3054 will always reduce the matching set to a single font face. If
3055 bolder/lighter relative weights are used, the effective weight is
3056 calculated based on the inherited weight value, as described in the
3057 definition of the ‘<a href="#propdef-font-weight"><code
3058 class=property>font-weight</code></a>’ property. Given the desired
3059 weight and the weights of faces in the matching set after the steps
3060 above, if the desired weight is available that face matches. Otherwise,
3061 a weight is chosen using the rules below:
3062 <ul>
3063 <li>If the desired weight is less than 400, weights below the desired
3064 weight are checked in descending order followed by weights above the
3065 desired weight in ascending order until a match is found.
3067 <li>If the desired weight is greater than 500, weights above the
3068 desired weight are checked in ascending order followed by weights
3069 below the desired weight in descending order until a match is found.
3071 <li>If the desired weight is 400, 500 is checked first and then the
3072 rule for desired weights less than 400 is used.
3074 <li>If the desired weight is 500, 400 is checked first and then the
3075 rule for desired weights less than 400 is used.
3076 </ul>
3078 <li><span class=property>‘<a href="#propdef-font-size"><code
3079 class=property>font-size</code></a>’</span> must be matched within a
3080 UA-dependent margin of tolerance. (Typically, sizes for scalable fonts
3081 are rounded to the nearest whole pixel, while the tolerance for
3082 bitmapped fonts could be as large as 20%.) Further computations, e.g.,
3083 by ‘<code class=property>em</code>’ values in other properties, are
3084 based on the <span class=property>‘<a href="#propdef-font-size"><code
3085 class=property>font-size</code></a>’</span> value that is used, not
3086 the one that is specified.
3087 </ol>
3089 <li>
3090 <p>If no matching face exists or the matched face does not contain a
3091 glyph for the character to be rendered, the next family name is selected
3092 and the previous two steps repeated. Glyphs from other faces in the
3093 family are not considered. The only exception is that user agents may
3094 optionally substitute a synthetic version of the <a
3095 href="#default-face"><em>default face</em></a> if that face supports a
3096 given glyph (e.g. a synthetic italic version of the regular face may be
3097 used if the italic face doesn't support glyphs for Arabic).</p>
3098 <!-- resolution on the above: http://lists.w3.org/Archives/Public/www-style/2012Nov/0292.html -->
3100 <p>If the matched font is defined via an <code>@font-face</code> rule and
3101 needs to be downloaded, the font resource is downloaded. While the
3102 download occurs, the user agent can either wait until the font is
3103 downloaded or render once with substituted font metrics and render again
3104 once the font is downloaded.</p>
3106 <li>If there are no more font families to be evaluated and no matching
3107 face has been found, then the user agent performs a <em>system font
3108 fallback</em> procedure to find the best match for the character to be
3109 rendered. The result of this procedure may vary across user agents.
3111 <li>If a particular character cannot be displayed using any font, the user
3112 agent should indicate by some means that a character is not being
3113 displayed, displaying either a symbolic representation of the missing
3114 glyph (e.g. using a <a
3115 href="http://en.wikipedia.org/wiki/Last_resort_font">Last Resort
3116 Font</a>) or using the missing character glyph from a default font.
3117 </ol>
3119 <h3 id=cluster-matching><span class=secno>5.3 </span>Cluster matching</h3>
3121 <p>When text contains characters such as combining diacritics, ideally the
3122 base character should be rendered using the same font as the diacritic,
3123 this assures proper placement of the diacritic. For this reason, the font
3124 matching algorithm for clusters is more specialized than the general case
3125 of matching a single character by itself. For sequences containing
3126 variation selectors, which indicate the precise glyph to be used for a
3127 given character, user agents always attempt system font fallback to find
3128 the appropriate glyph before using the default glyph of the base
3129 character.
3131 <p>A font is considered to <em>support</em> a given character if (1) the
3132 character is contained in the font's <a
3133 href="#character-map"><em>character map</em></a> and (2) if required by
3134 the containing script, shaping information is available for that
3135 character. Some legacy fonts may include a given character in the <a
3136 href="#character-map"><em>character map</em></a> but lack the shaping
3137 information (e.g. <a
3138 href="http://www.microsoft.com/typography/otspec/ttochap1.htm">OpenType
3139 layout tables</a> or <a
3140 href="http://scripts.sil.org/cms/scripts/page.php?site_id=projects&item_id=graphite_techAbout">Graphite
3141 tables</a>) necessary for correctly rendering text runs containing that
3142 character.
3144 <p>A sequence of codepoints containing combining diacritics or other
3145 modifiers is termed a grapheme cluster (see <a href="#CSS3TEXT"
3146 rel=biblioentry>[CSS3TEXT]<!--{{CSS3TEXT}}--></a> for a more complete
3147 description). For a given cluster containing a base character, <em>b</em>
3148 and a sequence of combining characters <em>c1, c2…</em>, the entire
3149 cluster is matched using these steps:
3151 <ol>
3152 <li>For each family in the font list, a face is chosen using the style
3153 selection rules defined in the previous section.
3154 <ol>
3155 <li>If all characters in the sequence <em>b + c1 + c2 …</em> are
3156 completely supported by the font, select this font for the sequence.
3158 <li>If a sequence of multiple codepoints is canonically equivalent to a
3159 single character and the font supports that character, select this font
3160 for the sequence.
3161 </ol>
3163 <li>If no font was found in the font list in step 1:
3164 <ol>
3165 <li>If <em>c1</em> is a variation selector, system fallback must be used
3166 to find a font that supports the full sequence of <em>b + c1</em>. If
3167 no font on the system supports the full sequence, match the single
3168 character <em>b</em> using the normal procedure for matching single
3169 characters and ignore the variation selector. Note: a sequence with
3170 more than one variation selector is treated as an encoding error and
3171 the trailing selectors are ignored.
3173 <li>Otherwise, the user agent may optionally use system font fallback to
3174 match a font that supports the entire cluster.
3175 </ol>
3177 <li>If no font is found in step 2, use the matching sequence from step 1
3178 to determine the longest sequence that is completely matched by a font in
3179 the font list and attempt to match the remaining combining characters
3180 separately using the rules for single characters.
3181 </ol>
3183 <h3 id=char-handling-issues><span class=secno>5.4 </span>Character handling
3184 issues</h3>
3186 <p>The procedure above is always performed on text runs containing Unicode
3187 characters, documents using legacy encodings are assumed to have been
3188 transcoded before matching fonts. For fonts containing <a
3189 href="#character-map"><em title="character map">character maps</em></a>
3190 for both legacy encodings and Unicode, the contents of the legacy encoding
3191 <a href="#character-map"><em>character map</em></a> must have no effect on
3192 the results of the font matching process.
3194 <p>The font matching process does not assume that text runs are in either
3195 normalized or denormalized form (see <a href="#CHARMOD-NORM"
3196 rel=biblioentry>[CHARMOD-NORM]<!--{{CHARMOD-NORM}}--></a> for more
3197 details). Layout engines often convert base character plus combining
3198 character sequences into precomposed characters if they exist. The font
3199 matching algorithm outlined here supports both ways and fonts can
3200 generally support either but variations can occur. Authors should always
3201 tailor their choice of fonts to their content, including whether that
3202 content contains normalized or denormalized character streams.
3204 <p>If a given character is a Private-Use Area Unicode codepoint and none of
3205 the fonts in the fontlist contain a glyph for that codepoint, user agents
3206 must display some form of missing glyph symbol for that character rather
3207 than attempting system font fallback for that codepoint. When matching the
3208 replacement character U+FFFD, user agents may skip the font matching
3209 process and immediately display some form of missing glyph symbol, they
3210 are not required to display the glyph from the font that would be selected
3211 by the font matching process.
3213 <p>In general, the fonts for a given family will all have the same or
3214 similar <a href="#character-map"><em title="character map">character
3215 maps</em></a>. The process outlined here is designed to handle even font
3216 families containing faces with widely variant <a href="#character-map"><em
3217 title="character map">character maps</em></a>. However, authors are
3218 cautioned that the use of such families can lead to unexpected results.
3220 <p>Optimizations of this process are allowed provided that an
3221 implementation behaves as if the algorithm had been followed exactly.
3222 Matching occurs in a well-defined order to insure that the results are as
3223 consistent as possible across user agents, given an identical set of
3224 available fonts and rendering technology.
3226 <h3 id=font-matching-changes><span class=secno>5.5 </span>Font matching
3227 changes since CSS 2.1</h3>
3229 <p>The algorithm above is different from CSS 2.1 in a number of key places.
3230 These changes were made to better reflect actual font matching behavior
3231 across user agent implementations.
3233 <p>Differences compared to the font matching algorithm in CSS 2.1:
3235 <ul>
3236 <li>The algorithm includes font-stretch matching.
3238 <li>All possible font-style matching scenarios are delineated.
3240 <li>Small-caps fonts are not matched as part of the font matching process,
3241 they are now handled via font features.
3243 <li>Unicode variation selector matching is required.
3245 <li>Cluster sequences are matched as a unit.
3246 </ul>
3248 <h3 id=font-matching-examples><span class=secno>5.6 </span>Font matching
3249 examples</h3>
3251 <div class=example>
3252 <p>It's useful to note that the CSS selector syntax may be used to create
3253 language-sensitive typography. For example, some Chinese and Japanese
3254 characters are unified to have the same Unicode code point, although the
3255 abstract glyphs are not the same in the two languages.
3257 <pre>*:lang(ja-jp) { font: 900 14pt/16pt "Heisei Mincho W9", serif; }
3258 *:lang(zh-tw) { font: 800 14pt/16.5pt "Li Sung", serif; }
3259 </pre>
3261 <p>This selects any element that has the given language - Japanese or
3262 Traditional Chinese - and uses the appropriate font.
3263 </div>
3265 <h2 id=font-rend-props><span class=secno>6 </span>Font Feature Properties</h2>
3267 <p>Modern font technologies support a variety of advanced typographic and
3268 language-specific font features. Using these features, a single font can
3269 provide glyphs for a wide range of ligatures, contextual and stylistic
3270 alternates, tabular and old-style figures, small capitals, automatic
3271 fractions, swashes, and alternates specific to a given language. To allow
3272 authors control over these font capabilities, the font-variant property
3273 has been expanded for CSS3, it now functions as a shorthand for a set of
3274 properties that provide control over stylistic font features.
3276 <h3 id=glyph-selection-positioning><span class=secno>6.1 </span>Glyph
3277 selection and positioning</h3>
3279 <p>Simple fonts used for displaying Latin text use a very basic processing
3280 model, fonts contain a <a href="#character-map"><em>character map</em></a>
3281 which maps a given character to a glyph for that character. Glyphs for
3282 subsequent characters are simply placed next in line along a run of text.
3283 Font formats such as OpenType and AAT (Apple Advanced Typography) use a
3284 richer processing model, the glyph for a given character can be chosen and
3285 positioned not just based on a single character, but also based on
3286 surrounding characters along with the language, script, and features
3287 enabled for the text. Font features may be required for specific scripts,
3288 or recommended as enabled by default or they may be stylistic features
3289 meant to be used under author control.
3291 <p>For a good visual overview of these features, see the <a
3292 href="#OPENTYPE-FONT-GUIDE"
3293 rel=biblioentry>[OPENTYPE-FONT-GUIDE]<!--{{OPENTYPE-FONT-GUIDE}}--></a>.
3294 For a detailed description of glyph processing for OpenType fonts, see <a
3295 href="#WINDOWS-GLYPH-PROC"
3296 rel=biblioentry>[WINDOWS-GLYPH-PROC]<!--{{WINDOWS-GLYPH-PROC}}--></a>.
3298 <p>Stylistic font features can be classified into two broad categories,
3299 ones that affect the harmonization of glyph shapes with the surrounding
3300 context, such as kerning and ligature features, and those such as the
3301 small-caps, subscript/superscript and alternate features that affect shape
3302 selection.
3304 <p>The subproperties of font-variant listed below are used to control these
3305 stylistic font features; they do not control features that are required
3306 for displaying certain scripts, such as the OpenType features used when
3307 displaying Arabic or Indic language text. They affect glyph selection and
3308 positioning, they do not affect font selection as described in the font
3309 matching section (except in cases required for compatibility with CSS
3310 2.1).
3312 <p>To assure consistent behavior across user agents, the equivalent
3313 OpenType property settings are listed for individual properties and must
3314 be considered normative. When using other font formats these should be
3315 used as a guideline to map CSS font feature property values to specific
3316 font features.
3318 <h3 id=language-specific-support><span class=secno>6.2
3319 </span>Language-specific display</h3>
3321 <p>OpenType also supports language-specific glyph selection and
3322 positioning, so that text can be displayed correctly in cases where the
3323 language dictates a specific display behavior. Languages often share a
3324 common script but the shape of certain letters may vary across those
3325 languages, such as the variations in certain Cyrillic letters used in
3326 Russian and Bulgarian text. In Latin text, it's common to render "fi" with
3327 an explicit fi-ligature that lacks a dot on the "i". However, in languages
3328 such as Turkish which uses both a dotted-i and a dotless-i, it's important
3329 to not use this ligature or use a specialized version that contains a dot
3330 over the "i". The example below shows language-specific variations based
3331 on stylistic traditions found in Spanish, Italian and French orthography:
3333 <div class=featex><img alt="language specific forms, spanish"
3334 src=locl-1.png></div>
3336 <div class=featex><img alt="language specific forms, italian"
3337 src=locl-2.png></div>
3339 <div class=featex><img alt="language specific forms, french"
3340 src=locl-3.png></div>
3342 <p>If the content language of the element is known, according to the rules
3343 of the <a
3344 href="http://www.w3.org/TR/CSS21/conform.html#doclanguage">document
3345 language</a>, user agents are required to infer the OpenType language
3346 system from the content language and use that when selecting and
3347 positioning glyphs using an OpenType font.
3349 <p>For OpenType fonts, in some cases it may be necessary to explicitly
3350 declare the OpenType language to be used, for example when displaying text
3351 in a given language that uses the typographic conventions of another
3352 language or when the font does not explicitly support a given language but
3353 supports a language that shares common typographic conventions. The ‘<a
3354 href="#propdef-font-language-override"><code
3355 class=property>font-language-override</code></a>’ property is used for
3356 this purpose.
3358 <p class=issue>Should user agents be allowed to infer the OpenType language
3359 or simply use only the default language system? Do we also need a
3360 normative definition of how the script system is inferred?</p>
3361 <!-- prop: font-kerning -->
3363 <h3 id=font-kerning-prop><span class=secno>6.3 </span>Kerning: the <a
3364 href="#propdef-font-kerning">font-kerning</a> property</h3>
3366 <table class=propdef id=namefont-kerningvalueauto-normal-noneini>
3367 <tbody>
3368 <tr>
3369 <td>Name:
3371 <td><dfn id=propdef-font-kerning>font-kerning</dfn>
3373 <tr>
3374 <td>Value:
3376 <td>auto | normal | none
3378 <tr>
3379 <td>Initial:
3381 <td>auto
3383 <tr>
3384 <td>Applies to:
3386 <td>all elements
3388 <tr>
3389 <td>Inherited:
3391 <td>yes
3393 <tr>
3394 <td>Percentages:
3396 <td>N/A
3398 <tr>
3399 <td>Media:
3401 <td>visual
3403 <tr>
3404 <td>Computed value:
3406 <td>as specified
3408 <tr>
3409 <td>Animatable:
3411 <td>no
3412 </table>
3414 <p>Kerning is the contextual adjustment of inter-glyph spacing. This
3415 property controls metric kerning, kerning that utilizes adjustment data
3416 contained in the font. The value ‘<a href="#normal2"><code
3417 class=property>normal</code></a>’ implies that kerning is applied while
3418 the value ‘<code class=property>none</code>’ implies that kerning is
3419 not applied when rendering text. If the value is ‘<code
3420 class=property>auto</code>’, a user agent is free to choose whether
3421 kerning is enabled or not by default and to vary that default based on the
3422 underlying text script.
3424 <p>For fonts that do not include kerning data this property will have no
3425 visible effect. When rendering with OpenType fonts, the <a
3426 href="#OPENTYPE" rel=biblioentry>[OPENTYPE]<!--{{!OPENTYPE}}--></a>
3427 specification suggests that kerning be enabled by default. When kerning is
3428 enabled, the OpenType <span class=tag>kern</span> feature is enabled (for
3429 vertical text runs the <span class=tag>vkrn</span> feature is enabled).
3430 User agents must also support fonts that only support kerning via data
3431 contained in a ‘<code class=property>kern</code>’ font table, as
3432 detailed in the OpenType specification. Authors may prefer to disable
3433 kerning in situations where performance is more important that precise
3434 appearance. If the ‘<code class=property>letter-spacing</code>’
3435 property is defined, kerning adjustments are considered part of the
3436 default spacing, letter spacing adjustments are made after kerning has
3437 been applied.</p>
3438 <!-- prop: font-variant-ligatures -->
3440 <h3 id=font-variant-ligatures-prop><span class=secno>6.4 </span>Ligatures:
3441 the <a href="#propdef-font-variant-ligatures">font-variant-ligatures</a>
3442 property</h3>
3444 <table class=propdef id=namefont-variant-ligaturesvaluenormal-no>
3445 <tbody>
3446 <tr>
3447 <td>Name:
3449 <td><dfn id=propdef-font-variant-ligatures>font-variant-ligatures</dfn>
3451 <tr>
3452 <td>Value:
3454 <td>normal | none | [ <common-lig-values> ||
3455 <discretionary-lig-values> || <historical-lig-values> ||
3456 <contextual-alt-values> ]
3458 <tr>
3459 <td>Initial:
3461 <td>normal
3463 <tr>
3464 <td>Applies to:
3466 <td>all elements
3468 <tr>
3469 <td>Inherited:
3471 <td>yes
3473 <tr>
3474 <td>Percentages:
3476 <td>N/A
3478 <tr>
3479 <td>Media:
3481 <td>visual
3483 <tr>
3484 <td>Computed value:
3486 <td>as specified
3488 <tr>
3489 <td>Animatable:
3491 <td>no
3492 </table>
3494 <p>Ligatures and contextual forms are ways of combining glyphs to produce
3495 more harmonized forms. A value of ‘<a href="#normal2"><code
3496 class=property>normal</code></a>’ implies that common default features
3497 are enabled, <a href="#font-feature-resolution">as described in detail in
3498 the next section</a>. For OpenType fonts, common ligatures and contextual
3499 forms are on by default, discretionary and historical ligatures are not. A
3500 value of ‘<code class=property>none</code>’ implies that all types of
3501 ligatures and contextual forms covered by this property are explicitly
3502 disabled. In situations where ligatures are not considered necessary, this
3503 may improve the speed of text rendering.
3505 <pre
3506 class=prod><dfn id=ltcommon-lig-values><var><common-lig-values></var></dfn> = [ common-ligatures | no-common-ligatures ]</pre>
3508 <pre
3509 class=prod><dfn id=ltdiscretionary-lig-values><var><discretionary-lig-values></var></dfn> = [ discretionary-ligatures | no-discretionary-ligatures ]</pre>
3511 <pre
3512 class=prod><dfn id=lthistorical-lig-values><var><historical-lig-values></var></dfn> = [ historical-ligatures | no-historical-ligatures ]</pre>
3514 <pre
3515 class=prod><dfn id=ltcontextual-alt-valuesgt><var><contextual-alt-values></var></dfn> = [ contextual | no-contextual ]</pre>
3517 <p>Individual values have the following meanings:
3519 <dl>
3520 <dt><dfn id=common-ligatures>common-ligatures</dfn>
3522 <dd>Enables display of common ligatures (OpenType features: <span
3523 class=tag>liga, clig</span>). For OpenType fonts, common ligatures are
3524 enabled by default.
3525 </dl>
3527 <div class=featex><img alt="common ligature example" src=liga.png></div>
3529 <dl>
3530 <dt><dfn id=no-common-ligatures>no-common-ligatures</dfn>
3532 <dd>Disables display of common ligatures (OpenType features: <span
3533 class=tag>liga, clig</span>).
3535 <dt><dfn id=discretionary-ligatures>discretionary-ligatures</dfn>
3537 <dd>Enables display of discretionary ligatures (OpenType feature: <span
3538 class=tag>dlig</span>). Which ligatures are discretionary, or optional,
3539 is decided by the type designer so authors will need to refer to the
3540 documentation of a given font to understand which ligatures are
3541 considered discretionary.
3542 </dl>
3544 <div class=featex><img alt="discretionary ligature example" src=dlig.png></div>
3546 <dl>
3547 <dt><dfn id=no-discretionary-ligatures>no-discretionary-ligatures</dfn>
3549 <dd>Disables display of discretionary ligatures (OpenType feature: <span
3550 class=tag>dlig</span>).
3552 <dt><dfn id=historical-ligatures>historical-ligatures</dfn>
3554 <dd>Enables display of historical ligatures (OpenType feature: <span
3555 class=tag>hlig</span>).
3556 </dl>
3558 <div class=featex><img alt="historical ligature example" src=hlig.png></div>
3560 <dl>
3561 <dt><dfn id=no-historical-ligatures>no-historical-ligatures</dfn>
3563 <dd>Disables display of historical ligatures (OpenType feature: <span
3564 class=tag>hlig</span>).
3566 <dt><dfn id=contextual>contextual</dfn>
3568 <dd>Enables display of contextual alternates (OpenType feature: <span
3569 class=tag>calt</span>). Although not strictly a ligature feature, like
3570 ligatures this feature is commonly used to harmonize the shapes of glyphs
3571 with the surrounding context. For OpenType fonts, this feature is on by
3572 default.
3573 </dl>
3575 <div class=featex><img alt="contextual alternate example" src=calt.png></div>
3577 <dl>
3578 <dt><dfn id=no-contextual>no-contextual</dfn>
3580 <dd>Disables display of contextual alternates (OpenType feature: <span
3581 class=tag>calt</span>).
3582 </dl>
3584 <p>Required ligatures, needed for correctly rendering complex scripts, are
3585 not affected by the settings above, including ‘<code
3586 class=property>none</code>’ (OpenType feature: <span
3587 class=tag>rlig</span>).</p>
3588 <!-- prop: font-variant-position -->
3590 <h3 id=font-variant-position-prop><span class=secno>6.5 </span>Subscript
3591 and superscript forms: the <a
3592 href="#propdef-font-variant-position">font-variant-position</a> property</h3>
3594 <table class=propdef id=namefont-variant-positionvaluenormal-sub>
3595 <tbody>
3596 <tr>
3597 <td>Name:
3599 <td><dfn id=propdef-font-variant-position>font-variant-position</dfn>
3601 <tr>
3602 <td>Value:
3604 <td>normal | sub | super
3606 <tr>
3607 <td>Initial:
3609 <td>normal
3611 <tr>
3612 <td>Applies to:
3614 <td>all elements
3616 <tr>
3617 <td>Inherited:
3619 <td>yes
3621 <tr>
3622 <td>Percentages:
3624 <td>N/A
3626 <tr>
3627 <td>Media:
3629 <td>visual
3631 <tr>
3632 <td>Computed value:
3634 <td>as specified
3636 <tr>
3637 <td>Animatable:
3639 <td>no
3640 </table>
3642 <p>This property is used to enable typographic subscript and superscript
3643 glyphs. These are alternate glyphs designed within the same em-box as
3644 default glyphs and are intended to be laid out on the same baseline as the
3645 default glyphs, with no resizing or repositioning of the baseline. They
3646 are explicitly designed to match the surrounding text and to be more
3647 readable without affecting the line height.
3649 <div class=figure><img alt="comparison between real subscript glyphs and
3650 synthesized ones" src=realsubscripts.png>
3651 <p class=caption>Subscript glyphs (top) vs. typical synthesized subscripts
3652 (bottom)
3653 </div>
3655 <p>The values ‘<code class=property>sub</code>’ and ‘<code
3656 class=property>super</code>’ imply the appropriate variant glyph is
3657 displayed when available in the font (OpenType features: <span
3658 class=tag>subs, sups</span>). A value of ‘<a href="#normal2"><code
3659 class=property>normal</code></a>’ implies neither of these alternate
3660 glyphs are substituted.
3662 <p>Because of the semantic nature of subscripts and superscripts, when the
3663 value is either ‘<code class=property>sub</code>’ or ‘<code
3664 class=property>super</code>’ for a given run of text and a variant glyph
3665 is not available for all the characters in the run, simulated glyphs are
3666 synthesized for all characters using reduced forms of the default glyph.
3667 This is done to avoid a mixture of variant glyphs and synthesized ones
3668 within the same run of text, since there is no guarantee that two types of
3669 glyphs would be aligned correctly.
3671 <p>In the case of OpenType fonts that lack subscript or superscript glyphs
3672 for a given character, user agents must use the appropriate subscript and
3673 superscript metrics specified in the selected font's <a
3674 href="http://www.microsoft.com/typography/otspec/os2.htm#subxs">OS/2
3675 table</a> <a href="#OPENTYPE"
3676 rel=biblioentry>[OPENTYPE]<!--{{!OPENTYPE}}--></a> to calculate the size
3677 and offset of the synthesized substitutes.
3679 <p>In the past, user agents have used font-size and vertical-align to
3680 simulate subscripts and superscripts for the <span class=tag>sub</span>
3681 and <span class=tag>sup</span> elements. To allow a backwards compatible
3682 way of defining subscripts and superscripts, it is recommended that
3683 authors use conditional rules <a href="#CSS3-CONDITIONAL"
3684 rel=biblioentry>[CSS3-CONDITIONAL]<!--{{CSS3-CONDITIONAL}}--></a> so that
3685 older user agents will still render subscripts and superscripts via the
3686 older mechanism.
3688 <p>Authors should note that fonts typically only provide subscript and
3689 superscript glyphs for a subset of all characters supported by the font.
3690 While subscript and superscript glyphs are often available for Latin
3691 numbers, glyphs for punctuation and letter characters are less frequently
3692 provided. The synthetic fallback rules defined for this property assure
3693 that subscripts and superscripts will always appear but the appearance may
3694 not match author expectations if the font used does not provide the
3695 appropriate alternate glyph for all characters contained in a subscript or
3696 superscript.
3698 <div class=figure><img alt="alternate superscripts vs. glyphs synthesized
3699 using superscript metrics" src=superscript-alt-synth.png>
3700 <p class=caption>Superscript alternate glyph (left), synthesized
3701 superscript glyphs (middle), and incorrect mixture of the two (right)
3702 </div>
3704 <p>This property is not cumulative, applying it to subelements within a
3705 subscript or superscript won't nest the placement of a subscript or
3706 superscript glyph. Images contained within text runs where the value of
3707 this property is ‘<code class=property>sub</code>’ or ‘<code
3708 class=property>super</code>’ will be drawn just as they would if the
3709 value was ‘<a href="#normal2"><code class=property>normal</code></a>’.
3710 Likewise, text decorations such as underlines or emphasis marks will
3711 render in the same position as they would for the default glyphs, since
3712 this property does not affect the baseline position.
3714 <p>Because of these limitations, font-variant-position is not recommended
3715 for use in user agent stylesheets. Authors should use it in cases where
3716 subscripts or superscripts will only contain the narrow range of
3717 characters supported by the fonts specified.
3719 <div class=example>
3720 <p>A typical user agent default style for the <span class=tag>sub</span>
3721 element:</p>
3723 <pre>sub {
3724 vertical-align: sub;
3725 font-size: smaller;
3726 line-height: normal;
3727 }
3728 </pre>
3730 <p>Using font-variant-position to specify typographic subscripts in a way
3731 that will still show subscripts in older user agents:</p>
3733 <pre>@supports ( font-variant-position: sub ) {
3735 sub {
3736 vertical-align: inherit;
3737 font-size: 100%;
3738 line-height: inherit;
3739 font-variant-position: sub;
3740 }
3742 }
3743 </pre>
3745 <p>User agents that support the ‘<a
3746 href="#propdef-font-variant-position"><code
3747 class=property>font-variant-position</code></a>’ property will select a
3748 subscript variant glyph and render this without adjusting the baseline or
3749 font-size. Older user agents will ignore the ‘<a
3750 href="#propdef-font-variant-position"><code
3751 class=property>font-variant-position</code></a>’ property definition
3752 and use the standard defaults for subscripts.</p>
3753 </div>
3754 <!-- prop: font-variant-caps -->
3756 <h3 id=font-variant-caps-prop><span class=secno>6.6 </span>Capitalization:
3757 the <a href="#propdef-font-variant-caps">font-variant-caps</a> property</h3>
3759 <table class=propdef id=namefont-variant-capsvaluenormal-small-c>
3760 <tbody>
3761 <tr>
3762 <td>Name:
3764 <td><dfn id=propdef-font-variant-caps>font-variant-caps</dfn>
3766 <tr>
3767 <td>Value:
3769 <td>normal | small-caps | all-small-caps | petite-caps | all-petite-caps
3770 | unicase | titling-caps
3772 <tr>
3773 <td>Initial:
3775 <td>normal
3777 <tr>
3778 <td>Applies to:
3780 <td>all elements
3782 <tr>
3783 <td>Inherited:
3785 <td>yes
3787 <tr>
3788 <td>Percentages:
3790 <td>N/A
3792 <tr>
3793 <td>Media:
3795 <td>visual
3797 <tr>
3798 <td>Computed value:
3800 <td>as specified
3802 <tr>
3803 <td>Animatable:
3805 <td>no
3806 </table>
3808 <p>Specifies control over capitalized forms.
3810 <p>Individual values have the following meanings:
3812 <dl>
3813 <dt><dfn id=normal>normal</dfn>
3815 <dd>None of the features listed below are enabled.
3817 <dt><dfn id=small-caps>small-caps</dfn>
3819 <dd>Enables display of small capitals (OpenType feature: <span
3820 class=tag>smcp</span>). Small-caps glyphs typically use the form of
3821 uppercase letters but are reduced to the size of lowercase letters.
3822 </dl>
3824 <div class=featex><img alt="small-caps example" src=smcp.png></div>
3826 <dl>
3827 <dt><dfn id=all-small-caps>all-small-caps</dfn>
3829 <dd>Enables display of small capitals for both upper and lowercase letters
3830 (OpenType features: <span class=tag>c2sc, smcp</span>).
3832 <dt><dfn id=petite-caps>petite-caps</dfn>
3834 <dd>Enables display of petite capitals (OpenType feature: <span
3835 class=tag>pcap</span>).
3837 <dt><dfn id=all-petite-caps>all-petite-caps</dfn>
3839 <dd>Enables display of petite capitals for both upper and lowercase
3840 letters (OpenType features: <span class=tag>c2pc, pcap</span>).
3842 <dt><dfn id=unicase>unicase</dfn>
3844 <dd>Enables display of mixture of small capitals for uppercase letters
3845 with normal lowercase letters (OpenType feature: <span
3846 class=tag>unic</span>).
3848 <dt><dfn id=titling-caps>titling-caps</dfn>
3850 <dd>Enables display of titling capitals (OpenType feature: <span
3851 class=tag>titl</span>). Uppercase letter glyphs are often designed for
3852 use with lowercase letters. When used in all uppercase titling sequences
3853 they can appear too strong. Titling capitals are designed specifically
3854 for this situation.
3855 </dl>
3857 <p>This property allows the selection of alternate glyphs used for small or
3858 petite capitals or for titling. These glyphs are specifically designed to
3859 blend well with the surrounding normal glyphs, to maintain the weight and
3860 readability which suffers when text is simply resized to fit this purpose.
3862 <p>The availability of these glyphs is based on whether a given feature is
3863 defined or not in the feature list of the font. User agents can optionally
3864 decide this on a per-script basis but should explicitly not decide this on
3865 a per-character basis.
3867 <p>Some fonts may only support a subset or none of the features described
3868 for this property. For backwards compatibility with CSS 2.1, if ‘<a
3869 href="#small-caps"><code class=property>small-caps</code></a>’ or ‘<a
3870 href="#all-small-caps"><code class=property>all-small-caps</code></a>’
3871 is specified but small-caps glyphs are not available for a given font,
3872 user agents should simulate a small-caps font, for example by taking a
3873 normal font and replacing the glyphs for lowercase letters with scaled
3874 versions of the glyphs for uppercase characters (replacing the glyphs for
3875 both upper and lowercase letters in the case of ‘<a
3876 href="#all-small-caps"><code class=property>all-small-caps</code></a>’).
3878 <div class=figure style="padding: 0; margin: auto;"><img alt="synthetic vs.
3879 real small-caps" class=hires src=synthetic-vs-real-small-caps.png
3880 width=512px>
3881 <p class=caption>Synthetic vs. real small-caps
3882 </div>
3884 <p>To match the surrounding text, a font may provide alternate glyphs for
3885 caseless characters when these features are enabled but when a user agent
3886 simulates small capitals, it must not attempt to simulate alternates for
3887 codepoints which are considered caseless.
3889 <div class=figure style="padding: 0; margin: auto;"><img alt="caseless
3890 characters with small-caps, all-small-caps enabled" class=hires
3891 src=small-capitals-variations.png width=418px>
3892 <p class=caption>Caseless characters with small-caps, all-small-caps
3893 enabled
3894 </div>
3896 <p>If either ‘<a href="#petite-caps"><code
3897 class=property>petite-caps</code></a>’ or ‘<a
3898 href="#all-petite-caps"><code class=property>all-petite-caps</code></a>’
3899 is specified for a font that doesn't support these features, the property
3900 behaves as if ‘<a href="#small-caps"><code
3901 class=property>small-caps</code></a>’ or ‘<a
3902 href="#all-small-caps"><code class=property>all-small-caps</code></a>’,
3903 respectively, had been specified. If ‘<a href="#unicase"><code
3904 class=property>unicase</code></a>’ is specified for a font that doesn't
3905 support that feature, the property behaves as if ‘<a
3906 href="#small-caps"><code class=property>small-caps</code></a>’ was
3907 applied only to lowercased uppercase letters. If ‘<a
3908 href="#titling-caps"><code class=property>titling-caps</code></a>’ is
3909 specified with a font that does not support this feature, this property
3910 has no visible effect. When simulated small capital glyphs are used, for
3911 scripts that lack uppercase and lowercase letters, ‘<a
3912 href="#small-caps"><code class=property>small-caps</code></a>’, ‘<a
3913 href="#all-small-caps"><code class=property>all-small-caps</code></a>’,
3914 ‘<a href="#petite-caps"><code class=property>petite-caps</code></a>’,
3915 ‘<a href="#all-petite-caps"><code
3916 class=property>all-petite-caps</code></a>’ and ‘<a
3917 href="#unicase"><code class=property>unicase</code></a>’ have no visible
3918 effect.
3920 <p>When casing transforms are used to simulate small capitals, the casing
3921 transformations should match those used for the <span
3922 class=property>‘<code class=property>text-transform</code>’</span>
3923 property.
3925 <p>As a last resort, unscaled uppercase letter glyphs in a normal font may
3926 replace glyphs in a small-caps font so that the text appears in all
3927 uppercase letters.
3929 <div class=figure style="padding: 0; margin: auto;"><img alt="using
3930 all-small-caps in acronym-laden text" class=hires
3931 src=acronym-laden-text.png width=596px>
3932 <p class=caption>Using small capitals to improve readability in
3933 acronym-laden text
3934 </div>
3936 <div class=example>
3937 <p>Quotes rendered italicised, with small-caps on the first line:</p>
3939 <pre>blockquote { font-style: italic; }
3940 blockquote:first-line { font-variant: small-caps; }
3942 <blockquote><a href="http://lists.w3.org/Archives/Public/www-style/2009Dec/0036.html" style="text-decoration: none">I'll be honor-bound to slap them like a haddock.</a></blockquote>
3943 </pre>
3944 </div>
3945 <!-- prop: font-variant-numeric -->
3947 <h3 id=font-variant-numeric-prop><span class=secno>6.7 </span>Numerical
3948 formatting: the <a
3949 href="#propdef-font-variant-numeric">font-variant-numeric</a> property</h3>
3951 <table class=propdef id=namefont-variant-numericvaluenormal-ltnu>
3952 <tbody>
3953 <tr>
3954 <td>Name:
3956 <td><dfn id=propdef-font-variant-numeric>font-variant-numeric</dfn>
3958 <tr>
3959 <td>Value:
3961 <td>normal | [ <numeric-figure-values> ||
3962 <numeric-spacing-values> || <numeric-fraction-values> ||
3963 ordinal || slashed-zero ]
3965 <tr>
3966 <td>Initial:
3968 <td>normal
3970 <tr>
3971 <td>Applies to:
3973 <td>all elements
3975 <tr>
3976 <td>Inherited:
3978 <td>yes
3980 <tr>
3981 <td>Percentages:
3983 <td>N/A
3985 <tr>
3986 <td>Media:
3988 <td>visual
3990 <tr>
3991 <td>Computed value:
3993 <td>as specified
3995 <tr>
3996 <td>Animatable:
3998 <td>no
3999 </table>
4001 <p>Specifies control over numerical forms.
4003 <pre
4004 class=prod><dfn id=ltnumeric-figure-valuesgt><var><numeric-figure-values></var></dfn> = [ lining-nums | oldstyle-nums ]</pre>
4006 <pre
4007 class=prod><dfn id=ltnumeric-spacing-valuesgt><var><numeric-spacing-values></var></dfn> = [ proportional-nums | tabular-nums ]</pre>
4009 <pre
4010 class=prod><dfn id=ltnumeric-fraction-valuesgt><var><numeric-fraction-values></var></dfn> = [ diagonal-fractions | stacked-fractions ]</pre>
4012 <p>Individual values have the following meanings:
4014 <dl>
4015 <dt><dfn id=normal0>normal</dfn>
4017 <dd>None of the features listed below are enabled.
4019 <dt><dfn id=lining-nums>lining-nums</dfn>
4021 <dd>Enables display of lining numerals (OpenType feature: <span
4022 class=tag>lnum</span>).
4024 <dt><dfn id=oldstyle-nums>oldstyle-nums</dfn>
4026 <dd>Enables display of old-style numerals (OpenType feature: <span
4027 class=tag>onum</span>).
4029 <dt><dfn id=proportional-nums>proportional-nums</dfn>
4031 <dd>Enables display of proportional numerals (OpenType feature: <span
4032 class=tag>pnum</span>).
4034 <dt><dfn id=tabular-nums>tabular-nums</dfn>
4036 <dd>Enables display of tabular numerals (OpenType feature: <span
4037 class=tag>tnum</span>).
4038 </dl>
4040 <p>The example below shows how these different properties can be combined
4041 to influence the rendering of tabular data with fonts that support these
4042 features. Within normal paragraph text, proportional numbers are used
4043 while tabular numbers are used so that columns of numbers line up
4044 properly:
4046 <div class=figure style="padding: 0; margin: auto;"><img alt="combining
4047 number styles" src=numberstyles.png>
4048 <p class=caption>Using number styles
4049 </div>
4051 <dl>
4052 <dt><dfn id=diagonal-fractions>diagonal-fractions</dfn>
4054 <dd>Enables display of lining diagonal fractions (OpenType feature: <span
4055 class=tag>frac</span>).
4056 </dl>
4058 <div class=featex><img alt="diagonal fraction example" src=frac.png></div>
4060 <dl>
4061 <dt><dfn id=stacked-fractions>stacked-fractions</dfn>
4063 <dd>Enables display of lining stacked fractions (OpenType feature: <span
4064 class=tag>afrc</span>).
4065 </dl>
4067 <div class=featex><img alt="stacked fraction example" src=afrc.png></div>
4069 <dl>
4070 <dt><dfn id=ordinal>ordinal</dfn>
4072 <dd>Enables display of forms used with ordinal numbers (OpenType feature:
4073 <span class=tag>ordn</span>).
4075 <dt><dfn id=slashed-zero>slashed-zero</dfn>
4077 <dd>Enables display of slashed zeros (OpenType feature: <span
4078 class=tag>zero</span>).
4079 </dl>
4081 <div class=featex><img alt="slashed zero example" src=zero.png></div>
4083 <div class=example id=steak-marinade>
4084 <p>A simple flank steak marinade recipe, rendered with automatic fractions
4085 and old-style numerals:</p>
4087 <pre>.amount { font-variant-numeric: oldstyle-nums diagonal-fractions; }
4089 <h4>Steak marinade:</h4>
4090 <ul>
4091 <li><span class="amount">2</span> tbsp olive oil</li>
4092 <li><span class="amount">1</span> tbsp lemon juice</li>
4093 <li><span class="amount">1</span> tbsp soy sauce</li>
4094 <li><span class="amount">1 1/2</span> tbsp dry minced onion</li>
4095 <li><span class="amount">2 1/2</span> tsp italian seasoning</li>
4096 <li>Salt &amp; pepper</li>
4097 </ul>
4099 <p>Mix the meat with the marinade and let it sit covered in the refrigerator
4100 for a few hours or overnight.</p>
4101 </pre>
4102 </div>
4103 <!-- prop: font-variant-alternates -->
4105 <h3 id=font-variant-alternates-prop><span class=secno>6.8 </span>Alternates
4106 and swashes: the <a
4107 href="#propdef-font-variant-alternates">font-variant-alternates</a>
4108 property</h3>
4110 <table class=propdef id=namefont-variant-alternatesvaluenormal-s>
4111 <tbody>
4112 <tr>
4113 <td>Name:
4115 <td><dfn
4116 id=propdef-font-variant-alternates>font-variant-alternates</dfn>
4118 <tr>
4119 <td>Value:
4121 <td>normal | [ stylistic(<feature-value-name>) || historical-forms
4122 || styleset(<feature-value-name>#) ||
4123 character-variant(<feature-value-name>#) ||
4124 swash(<feature-value-name>) ||
4125 ornaments(<feature-value-name>) ||
4126 annotation(<feature-value-name>) ]
4128 <tr>
4129 <td>Initial:
4131 <td>normal
4133 <tr>
4134 <td>Applies to:
4136 <td>all elements
4138 <tr>
4139 <td>Inherited:
4141 <td>yes
4143 <tr>
4144 <td>Percentages:
4146 <td>N/A
4148 <tr>
4149 <td>Media:
4151 <td>visual
4153 <tr>
4154 <td>Computed value:
4156 <td>as specified
4158 <tr>
4159 <td>Animatable:
4161 <td>no
4162 </table>
4164 <p>For any given character, fonts can provide a variety of alternate glyphs
4165 in addition to the default glyph for that character. This property
4166 provides control over the selection of these alternate glyphs.
4168 <p>In cases where multiple alternates are possible, authors define a
4169 <code><feature-value-name></code> using the
4170 <code>@font-feature-values</code> rule described below to indicate the
4171 specific alternate to be used. The nature of these alternates is font
4172 specific, so the rule defines values for a specific font family or set of
4173 families. When a particular value has not been defined for a given family,
4174 the named value is treated as if the feature had omitted from the style
4175 rule. If a given value is outside the range supported by a given font, the
4176 value is ignored. These values never apply to generic font families, nor
4177 to families selected as part of system font fallback. Values that behave
4178 this way are marked as <em>font specific</em>.
4180 <p>Individual values have the following meanings:
4182 <dl>
4183 <dt><dfn id=normal1>normal</dfn>
4185 <dd>None of the features listed below are enabled.
4187 <dt><dfn id=stylisticltfeature-value-namegt
4188 title=stylistic>stylistic(<feature-value-name>)</dfn>
4190 <dd>Enables display of stylistic alternates (<em>font specific</em>,
4191 OpenType feature: <span class=tag>salt
4192 <feature-value-name></span>).
4193 </dl>
4195 <div class=featex><img alt="stylistic alternate example" src=salt.png></div>
4197 <dl>
4198 <dt><dfn id=historical-forms>historical-forms</dfn>
4200 <dd>Enables display of historical forms (OpenType feature: <span
4201 class=tag>hist</span>).
4202 </dl>
4204 <div class=featex><img alt="historical form example" src=hist.png></div>
4206 <dl>
4207 <dt><dfn id=stylesetltfeature-value-namegt
4208 title=styleset>styleset(<feature-value-name>#)</dfn>
4210 <dd>Enables display with stylistic sets (<em>font specific</em>, OpenType
4211 feature: <span class=tag>ss<feature-index></span> OpenType
4212 currently defines <span class=tag>ss01</span> through <span
4213 class=tag>ss20</span>).
4214 </dl>
4216 <div class=featex><img alt="styleset example" src=ssnn.png></div>
4218 <dl>
4219 <dt><dfn id=character-variantltfeature-value-namegt
4220 title=character-variant>character-variant(<feature-value-name>#)</dfn>
4223 <dd>Enables display of specific character variants (<em>font
4224 specific</em>, OpenType feature: <span
4225 class=tag>cv<feature-index></span> OpenType currently defines <span
4226 class=tag>cv01</span> through <span class=tag>cv99</span>).
4228 <dt><dfn id=swashltfeature-value-namegt
4229 title=swash>swash(<feature-value-name>)</dfn>
4231 <dd>Enables display of swash glyphs (<em>font specific</em>, OpenType
4232 feature: <span class=tag>swsh <feature-index>, cswh
4233 <feature-index></span>).
4234 </dl>
4236 <div class=featex><img alt="swash example" src=swsh.png></div>
4238 <dl>
4239 <dt><dfn id=ornamentsltfeature-value-namegt
4240 title=ornaments>ornaments(<feature-value-name>)</dfn>
4242 <dd>Enables replacement of default glyphs with ornaments, if provided in
4243 the font (<em>font specific</em>, OpenType feature: <span class=tag>ornm
4244 <feature-index></span>). Some fonts may offer ornament glyphs as
4245 alternates for a wide collection of characters; however, displaying
4246 arbitrary characters (e.g., alphanumerics) as ornaments is poor practice
4247 as it distorts the semantics of the data. Font designers are encouraged
4248 to encode all ornaments (except those explicitly encoded in the Unicode
4249 Dingbats blocks, etc.) as alternates for the bullet character (U+2022) to
4250 allow authors to select the desired glyph using
4251 <feature-value-name>.
4252 </dl>
4254 <div class=featex><img alt="ornaments example" src=ornm.png></div>
4256 <dl>
4257 <dt><dfn id=annotationltfeature-value-namegt
4258 title=annotation>annotation(<feature-value-name>)</dfn>
4260 <dd>Enables display of alternate annotation forms (<em>font specific</em>,
4261 OpenType feature: <span class=tag>nalt <feature-index></span>).
4262 </dl>
4264 <div class=featex><img alt="alternate annotation form example"
4265 src=nalt.png></div>
4267 <h3 id=font-feature-values><span class=secno>6.9 </span>Defining font
4268 specific alternates: the <code>@font-feature-values</code> rule</h3>
4270 <p>Several of the possible values of ‘<a
4271 href="#propdef-font-variant-alternates"><code
4272 class=property>font-variant-alternates</code></a>’ listed above are
4273 labeled as "font specific". For these features fonts may define not just a
4274 single glyph but a set of alternate glyphs with an index to select a given
4275 alternate. Since these are font family specific, the
4276 <code>@font-feature-values</code> rule is used to define named-values for
4277 these indices for a given family.
4279 <p>In the case of the swash Q in the example shown above, the swash could
4280 be specified using these style rules:
4282 <pre>
4284 @font-feature-values Jupiter Sans {
4285 @swash {
4286 delicate: 1;
4287 flowing: 2;
4288 }
4289 }
4291 h2 { font-family: Jupiter Sans, sans-serif; }
4293 /* show the second swash variant in h2 headings */
4294 h2:first-letter { font-variant-alternates: swash(flowing); }
4296 <h2>Quick</h2></pre>
4298 <p>When Jupiter Sans is present, the second alternate swash alternate will
4299 be displayed. When not present, no swash character will be shown, since
4300 the specific named-value "flowing" is only defined for the Jupiter Sans
4301 family. The @-mark indicates the name of the property value for which a
4302 named-value can be used. The name "flowing" is chosen by the author.
4304 <p>The syntax of the <code>@font-feature-values</code> rule is defined as:
4306 <pre>@font-feature-values <font-family># {
4307 @<feature-type> {
4308 <feature-ident> : <feature-index>+;
4309 <feature-ident> : <feature-index>+;
4310 ...
4311 }
4312 ...
4313 }
4314 </pre>
4316 <p>where:
4318 <pre
4319 class=prod><dfn id=ltfont-familygt><var><font-family></var></dfn> = font family name, same syntax as font-family property</pre>
4321 <pre
4322 class=prod><dfn id=ltfeature-typegt><var><feature-type></var></dfn> = the name of one of the font specific font-variant property values
4323 (e.g. swash, styleset, annotation)</pre>
4325 <pre
4326 class=prod><dfn id=ltfeature-identgt><var><feature-ident></var></dfn> = a user-defined identifier used to describe a set of indices</pre>
4328 <pre
4329 class=prod><dfn id=ltfeature-indexgt><var><feature-index></var></dfn> = an integer value greater than 0 specific to a given font or set of fonts</pre>
4331 <p>These <code>@font-feature-values</code> rules can appear anywhere within
4332 a stylesheet and are exposed bidirectionally across @import boundaries.
4333 Within each font feature values declaration, syntax errors such as unknown
4334 property value names, invalid identifiers or values result in the
4335 declaration being dropped, similar to the way syntax errors in style
4336 declarations are handled.
4338 <p>If multiple <code>@font-feature-values</code> rules are defined for a
4339 given family, the resulting values defined are the union of these rules.
4340 This allows a set of named-values to be defined for a given font family
4341 globally for a site and specific additions made per-page. If the same
4342 <feature-value-name> is defined mulitple times for a given
4343 font-variant value, the last defined value is used.
4345 <pre>
4346 site.css:
4348 @font-feature-values Mercury Serif {
4349 @styleset {
4350 stacked-g: 3; /* "two-storey" versions of g, a */
4351 stacked-a: 4;
4352 }
4353 }
4355 page.css:
4357 @font-feature-values Mercury Serif {
4358 @styleset {
4359 geometric-m: 7; /* alternate version of m */
4360 }
4361 }
4363 body {
4364 font-family: Mercury Serif, serif;
4366 /* enable both the use of stacked g and alternate m */
4367 font-variant-alternates: styleset(stacked-g, geometric-m);
4368 }</pre>
4370 <p>Only named font families are allowed for <font-family>, rules that
4371 include generic or system fonts in the list of font families are
4372 considered syntax errors and the contents of the rules are ignored.
4373 However, if a user agent defines a generic font to be a specific named
4374 font (e.g. Helvetica), the settings associated with that family name will
4375 be used.
4377 <p>For <font-variant-property-value>, only font specific property value
4378 names supported by the ‘<a href="#propdef-font-variant"><code
4379 class=property>font-variant</code></a>’ property are recognized,
4380 definitions for other value names cause a syntax error and are ignored.
4381 Each property value that is font specific is clearly marked as such.
4382 Feature value names follow the rules of CSS user identifiers and are
4383 case-sensitive. They are unique only for a given set of font families and
4384 font-variant property value; the same identifier used with a different
4385 font-variant property value is treated as a separate and distinct value.
4387 <p>Using a commonly named value allows authors to use a single style rule
4388 to cover a set of fonts for which the underlying selector is different for
4389 each font. If either font in the example below is found, a circled number
4390 glyph will be used:
4392 <pre>@font-feature-values Taisho Gothic {
4393 @annotation { boxed: 1; circled: 4; }
4394 }
4396 @font-feature-values Otaru Kisa {
4397 @annotation { circled: 1; black-boxed: 3; }
4398 }
4400 h3.title {
4401 /* circled form defined for both fonts */
4402 font-family: Taisho Gothic, Otaru Kisa;
4403 font-variant: annotation(circled);
4404 }</pre>
4406 <p>Most font specific font-variant property values take a single value
4407 (e.g. swash). The character-variant property value allows two values and
4408 styleset allows an unlimited number. If a larger number of values are
4409 assigned to a given name, a syntax error occurs and the entire
4410 <font-feature-values-declaration> is ignored.
4412 <p>For the styleset property value, multiple values indicate the style sets
4413 to be enabled. Values between 1 and 99 enable OpenType features <span
4414 class=tag>ss01</span> through <span class=tag>ss99</span>. However, the
4415 OpenType standard only officially defines <span class=tag>ss01</span>
4416 through <span class=tag>ss20</span>. Values greater than 99 or equal to 0
4417 are ignored but do not generate a syntax error when parsed.
4419 <pre>@font-feature-values Mars Serif {
4420 @styleset {
4421 alt-g: 1; /* implies ss01 = 1 */
4422 curly-quotes: 3; /* implies ss03 = 1 */
4423 code: 4 5; /* implies ss04 = 1, ss05 = 1 */
4424 }
4426 @styleset {
4427 dumb: 125; /* >99, ignored */
4428 }
4430 @swash {
4431 swishy: 3 5; /* more than 1 value for swash, syntax error */
4432 }
4433 }
4435 p.codeblock {
4436 /* implies ss03 = 1, ss04 = 1, ss05 = 1 */
4437 font-variant-alternates: styleset(curly-quotes, code);
4438 }</pre>
4440 <p>For character-variant, a single value between 1 and 99 indicates the
4441 enabling of OpenType feature <span class=tag>cv01</span> through <span
4442 class=tag>cv99</span>. For OpenType fonts, values greater than 99 or equal
4443 to 0 are ignored but do not generate a syntax error when parsed. When two
4444 values are listed, the first value indicates the feature used and the
4445 second the value passed for that feature. When two value names imply
4446 different settings for the same underlying feature the last setting is
4447 used.
4449 <pre>@font-feature-values MM Greek {
4450 @character-variant { alpha-2: 1 2; } /* implies cv01 = 2 */
4451 @character-variant { beta-3: 2 3; } /* implies cv02 = 3 */
4452 @character-variant { epsilon: 5 3 6; } /* more than 2 values, syntax error, ignored */
4453 @character-variant { gamma: 12; } /* implies cv12 = 1 */
4454 @character-variant { zeta: 20 3; } /* implies cv20 = 3 */
4455 @character-variant { zeta-2: 20 2; } /* implies cv20 = 2 */
4456 @character-variant { silly: 105; } /* >99, ignored */
4457 @character-variant { dumb: 323 3; } /* >99, ignored */
4458 }
4460 #title {
4461 /* use the third alternate beta, first alternate gamma */
4462 font-variant-alternates: character-variant(beta-3, gamma);
4463 }
4465 p {
4466 /* zeta-2 follows zeta, implies cv20 = 2 */
4467 font-variant-alternates: character-variant(zeta, zeta-2);
4468 }
4470 .special {
4471 /* zeta follows zeta-2, implies cv20 = 3 */
4472 font-variant-alternates: character-variant(zeta-2, zeta);
4473 }</pre>
4475 <p>See the <a href="#om-fontfeaturevalues">object model reference
4476 section</a> for a description of the interfaces used to modify these rules
4477 via the CSS Object Model.
4479 <div class=figure><img alt="Matching text on Byzantine seals using
4480 character variants" src=byzantineseal.png>
4481 <p class=caption>Byzantine seal text displayed with character variants
4482 </div>
4484 <div class=example>
4485 <p>In the figure above, the text in red is rendered using a font
4486 containing character variants that mimic the character forms found on a
4487 Byzantine seal from the 8th century A.D. Two lines below is the same text
4488 displayed in a font without variants. Note the two variants for U and N
4489 used on the seal.</p>
4491 <pre>@font-feature-values Athena Ruby {
4492 @character-variant {
4493 leo-B: 2 1;
4494 leo-M: 13 3;
4495 leo-alt-N: 14 1;
4496 leo-N: 14 2;
4497 leo-T: 20 1;
4498 leo-U: 21 2;
4499 leo-alt-U: 21 4;
4500 }
4501 }
4503 p {
4504 font-variant: discretionary-ligatures,
4505 character-variant(leo-B, leo-M, leo-N, leo-T, leo-U);
4506 }
4508 span.alt-N {
4509 font-variant-alternates: character-variant(leo-alt-N);
4510 }
4512 span.alt-U {
4513 font-variant-alternates: character-variant(leo-alt-U);
4514 }
4516 <p>ENO....UP͞RSTU<span class="alt-U">U</span>͞<span class="alt-U">U</span>ΚΑΙTỤẠG̣IUPNS</p>
4518 <p>LEON|ΚΑΙCONSTA|NTI<span class="alt-N">N</span>OS..|STOIBAṢ.|LIṢROM|AIO<span class="alt-N">N</span></p>
4519 </pre>
4520 </div>
4522 <h3 id=font-variant-east-asian-prop><span class=secno>6.10 </span>East
4523 Asian text rendering: the <a
4524 href="#propdef-font-variant-east-asian">font-variant-east-asian</a>
4525 property</h3>
4527 <table class=propdef id=namefont-variant-east-asianvaluenormal-l>
4528 <tbody>
4529 <tr>
4530 <td>Name:
4532 <td><dfn
4533 id=propdef-font-variant-east-asian>font-variant-east-asian</dfn>
4535 <tr>
4536 <td>Value:
4538 <td>normal | [ <east-asian-variant-values> ||
4539 <east-asian-width-values> || ruby ]
4541 <tr>
4542 <td>Initial:
4544 <td>normal
4546 <tr>
4547 <td>Applies to:
4549 <td>all elements
4551 <tr>
4552 <td>Inherited:
4554 <td>yes
4556 <tr>
4557 <td>Percentages:
4559 <td>N/A
4561 <tr>
4562 <td>Media:
4564 <td>visual
4566 <tr>
4567 <td>Computed value:
4569 <td>as specified
4571 <tr>
4572 <td>Animatable:
4574 <td>no
4575 </table>
4577 <p>Allows control of glyph substitution and sizing in East Asian text.
4579 <pre
4580 class=prod><dfn id=lteast-asian-variant-valuesgt><var><east-asian-variant-values></var></dfn> = [ jis78 | jis83 | jis90 | jis04 | simplified | traditional ]</pre>
4582 <pre
4583 class=prod><dfn id=lteast-asian-width-valuesgt><var><east-asian-width-values></var></dfn> = [ full-width | proportional-width ]</pre>
4585 <p>Individual values have the following meanings:
4587 <dl>
4588 <dt><dfn id=normal2>normal</dfn>
4590 <dd>None of the features listed below are enabled.
4592 <dt><dfn id=jis78>jis78</dfn>
4594 <dd>Enables rendering of JIS78 forms (OpenType feature: <span
4595 class=tag>jp78</span>).
4596 </dl>
4598 <div class=featex><img alt="JIS78 form example" src=jp78.png></div>
4600 <dl>
4601 <dt><dfn id=jis83>jis83</dfn>
4603 <dd>Enables rendering of JIS83 forms (OpenType feature: <span
4604 class=tag>jp83</span>).
4606 <dt><dfn id=jis90>jis90</dfn>
4608 <dd>Enables rendering of JIS90 forms (OpenType feature: <span
4609 class=tag>jp90</span>).
4611 <dt><dfn id=jis04>jis04</dfn>
4613 <dd>Enables rendering of JIS2004 forms (OpenType feature: <span
4614 class=tag>jp04</span>).
4615 <p>The various JIS variants reflect the glyph forms defined in different
4616 Japanese national standards. Fonts generally include glyphs defined by
4617 the most recent national standard but it's sometimes necessary to use
4618 older variants, to match signage for example.</p>
4620 <dt><dfn id=simplified>simplified</dfn>
4622 <dd>Enables rendering of simplified forms (OpenType feature: <span
4623 class=tag>smpl</span>).
4624 <p>The ‘<a href="#simplified"><code
4625 class=property>simplified</code></a>’ and ‘<a
4626 href="#traditional"><code class=property>traditional</code></a>’
4627 values allow control over the glyph forms for characters which have been
4628 simplified over time but for which the older, traditional form is still
4629 used in some contexts. The exact set of characters and glyph forms will
4630 vary to some degree by context for which a given font was designed.</p>
4632 <dt><dfn id=traditional>traditional</dfn>
4634 <dd>Enables rendering of traditional forms (OpenType feature: <span
4635 class=tag>trad</span>).
4636 </dl>
4638 <div class=featex><img alt="tradtional form example" src=trad.png></div>
4640 <dl>
4641 <dt><dfn id=full-width>full-width</dfn>
4643 <dd>Enables rendering of full-width variants (OpenType feature: <span
4644 class=tag>fwid</span>).
4646 <dt><dfn id=proportional-width>proportional-width</dfn>
4648 <dd>Enables rendering of proportionally-spaced variants (OpenType feature:
4649 <span class=tag>pwid</span>).
4650 </dl>
4652 <div class=featex><img alt="proportionally spaced Japanese example"
4653 src=pwid.png></div>
4655 <dl>
4656 <dt><dfn id=ruby>ruby</dfn>
4658 <dd>Enables display of ruby variant glyphs (OpenType feature: <span
4659 class=tag>ruby</span>). Since ruby text is generally smaller than the
4660 associated body text, font designers can design special glyphs for use
4661 with ruby that are more readable than scaled down versions of the default
4662 glyphs. Only glyph selection is affected, there is no associated font
4663 scaling or other change that affects line layout. The red ruby text below
4664 is shown with default glyphs (top) and with ruby variant glyphs (bottom).
4665 Note the slight difference in stroke thickness.
4666 </dl>
4668 <div class=featex><img alt="ruby variant example" src=rubyshinkansen.png></div>
4670 <h3 id=font-variant-prop><span class=secno>6.11 </span>Overall shorthand
4671 for font rendering: the <a href="#propdef-font-variant">font-variant</a>
4672 property</h3>
4674 <table class=propdef id=namefont-variantvaluenormal-none-ltcommo>
4675 <tbody>
4676 <tr>
4677 <td>Name:
4679 <td><dfn id=propdef-font-variant>font-variant</dfn>
4681 <tr>
4682 <td>Value:
4684 <td>normal | none | [ <common-lig-values> ||
4685 <discretionary-lig-values> || <historical-lig-values> ||
4686 <contextual-alt-values> || stylistic(<feature-value-name>)
4687 || historical-forms || styleset(<feature-value-name>#) ||
4688 character-variant(<feature-value-name>#) ||
4689 swash(<feature-value-name>) ||
4690 ornaments(<feature-value-name>) ||
4691 annotation(<feature-value-name>) || [ small-caps | all-small-caps
4692 | petite-caps | all-petite-caps | unicase | titling-caps ] ||
4693 <numeric-figure-values> || <numeric-spacing-values> ||
4694 <numeric-fraction-values> || ordinal || slashed-zero ||
4695 <east-asian-variant-values> || <east-asian-width-values> ||
4696 ruby ]
4698 <tr>
4699 <td>Initial:
4701 <td>normal
4703 <tr>
4704 <td>Applies to:
4706 <td>all elements
4708 <tr>
4709 <td>Inherited:
4711 <td>yes
4713 <tr>
4714 <td>Percentages:
4716 <td>see individual properties
4718 <tr>
4719 <td>Media:
4721 <td>visual
4723 <tr>
4724 <td>Computed value:
4726 <td>see individual properties
4728 <tr>
4729 <td>Animatable:
4731 <td>see individual properties
4732 </table>
4734 <p>The value ‘<a href="#normal2"><code
4735 class=property>normal</code></a>’ resets all other font feature
4736 properties to their inital value. The ‘<code
4737 class=property>none</code>’ value sets ‘<a
4738 href="#propdef-font-variant-ligatures"><code
4739 class=property>font-variant-ligatures</code></a>’ to ‘<code
4740 class=property>none</code>’ and resets all other font feature properties
4741 to their initial value. Like other shorthands, using ‘<a
4742 href="#propdef-font-variant"><code
4743 class=property>font-variant</code></a>’ resets unspecified font-variant
4744 subproperties to their initial values. It does not reset the values of
4745 either ‘<a href="#propdef-font-language-override"><code
4746 class=property>font-language-override</code></a>’ or ‘<a
4747 href="#propdef-font-feature-settings"><code
4748 class=property>font-feature-settings</code></a>’.
4750 <h3 id=font-feature-settings-prop><span class=secno>6.12 </span>Low-level
4751 font feature settings control: the <a
4752 href="#propdef-font-feature-settings">font-feature-settings</a> property</h3>
4754 <table class=propdef id=namefont-feature-settingsvaluenormal-ltf>
4755 <tbody>
4756 <tr>
4757 <td>Name:
4759 <td><dfn id=propdef-font-feature-settings>font-feature-settings</dfn>
4761 <tr>
4762 <td>Value:
4764 <td>normal | <feature-tag-value>#
4766 <tr>
4767 <td>Initial:
4769 <td>normal
4771 <tr>
4772 <td>Applies to:
4774 <td>all elements
4776 <tr>
4777 <td>Inherited:
4779 <td>yes
4781 <tr>
4782 <td>Percentages:
4784 <td>N/A
4786 <tr>
4787 <td>Media:
4789 <td>visual
4791 <tr>
4792 <td>Computed value:
4794 <td>as specified
4796 <tr>
4797 <td>Animatable:
4799 <td>no
4800 </table>
4802 <p>This property provides low-level control over OpenType font features. It
4803 is intended as a way of providing access to font features that are not
4804 widely used but are needed for a particular use case. A value of ‘<a
4805 href="#normal2"><code class=property>normal</code></a>’ means that no
4806 change in glyph selection or positioning occurs due to this property.
4808 <p>
4810 <pre>/* enable small caps and use second swash alternate */
4811 font-feature-settings: "smcp", "swsh" 2;</pre>
4813 <p>Feature tag values have the following syntax:
4815 <pre
4816 class=prod><dfn id=ltfeature-tag-valuegt><var><feature-tag-value></var></dfn> = <string> [ <integer> | on | off ]?</pre>
4818 <p>The <string> is a case-sensitive OpenType feature tag. As
4819 specified in the OpenType specification, feature tags contain four ASCII
4820 characters. Tag strings longer or shorter than four characters, or
4821 containing characters outside the U+20–7E codepoint range are invalid.
4822 User agents must not use a feature tag created by truncating or padding
4823 the string to four characters. Feature tags need only match a feature tag
4824 defined in the font, they are not limited to explicitly registered
4825 OpenType features. Fonts defining custom feature tags should follow the <a
4826 href="http://www.microsoft.com/typography/otspec/featuretags.htm">tag name
4827 rules</a> defined in the OpenType specification <a
4828 href="#OPENTYPE-FEATURES"
4829 rel=biblioentry>[OPENTYPE-FEATURES]<!--{{!OPENTYPE-FEATURES}}--></a>.
4830 Feature tags not present in the font are ignored; a user agent must not
4831 attempt to synthesize fallback behavior based on these feature tags.
4833 <p>This means that explicitly disabling the <span class=tag>kern</span>
4834 feature will not affect the application of kerning data found in the
4835 ‘<code class=property>kern</code>’ table (as opposed to kerning data
4836 associated with the <span class=tag>kern</span> feature in the ‘<code
4837 class=property>GPOS</code>’ table). Authors should use the ‘<a
4838 href="#propdef-font-kerning"><code
4839 class=property>font-kerning</code></a>’ property to explictly enable or
4840 disable kerning since this property affects both types of kerning.
4842 <p>If present, a value indicates an index used for glyph selection. An
4843 <integer> value must be 0 or greater. A value of 0 indicates that
4844 the feature is disabled. For boolean features, a value of 1 enables the
4845 feature. For non-boolean features, a value of 1 or greater enables the
4846 feature and indicates the feature selection index. A value of ‘<code
4847 class=property>on</code>’ is synonymous with 1 and ‘<code
4848 class=property>off</code>’ is synonymous with 0. If the value is
4849 omitted, a value of 1 is assumed.
4851 <pre>
4852 font-feature-settings: "dlig" 1; /* dlig=1 enable discretionary ligatures */
4853 font-feature-settings: "smcp" on; /* smcp=1 enable small caps */
4854 font-feature-settings: 'c2sc'; /* c2sc=1 enable caps to small caps */
4855 font-feature-settings: "liga" off; /* liga=0 no common ligatures */
4856 font-feature-settings: "tnum", 'hist'; /* tnum=1, hist=1 enable tabular numbers and historical forms */
4857 font-feature-settings: "tnum" "hist"; /* invalid, need a comma-delimited list */
4858 font-feature-settings: "palin" off; /* good idea but invalid tagname */
4859 font-feature-settings: "PKRN"; /* PKRN=1 enable custom feature */
4860 font-feature-settings: dlig; /* invalid, tag must be a string */
4861 </pre>
4863 <p>Authors should generally use ‘<a href="#propdef-font-variant"><code
4864 class=property>font-variant</code></a>’ and its related subproperties
4865 whenever possible and only use this property for special cases where its
4866 use is the only way of accessing a particular infrequently used font
4867 feature.
4869 <p>Although specifically defined for OpenType feature tags, feature tags
4870 for other modern font formats that support font features may be added in
4871 the future. Where possible, features defined for other font formats should
4872 attempt to follow the pattern of registered OpenType tags.
4874 <div class=example>
4875 <p>The Japanese text below will be rendered with half-width kana
4876 characters:</p>
4878 <pre lang=ja>
4879 body { font-feature-settings: "hwid"; /* Half-width OpenType feature */ }
4881 <p>毎日<a href="http://images.google.com/images?q=%E3%82%AB%E3%83%AC%E3%83%BC" style="text-decoration: none;">カレー</a>食べてるのに、飽きない</p>
4882 </pre>
4883 </div>
4885 <h3 id=font-language-override-prop><span class=secno>6.13 </span>Font
4886 language override: the <a
4887 href="#propdef-font-language-override">font-language-override</a> property</h3>
4889 <table class=propdef id=namefont-language-overridevaluenormal-lt>
4890 <tbody>
4891 <tr>
4892 <td>Name:
4894 <td><dfn id=propdef-font-language-override>font-language-override</dfn>
4896 <tr>
4897 <td>Value:
4899 <td>normal | <string>
4901 <tr>
4902 <td>Initial:
4904 <td>normal
4906 <tr>
4907 <td>Applies to:
4909 <td>all elements
4911 <tr>
4912 <td>Inherited:
4914 <td>yes
4916 <tr>
4917 <td>Percentages:
4919 <td>N/A
4921 <tr>
4922 <td>Media:
4924 <td>visual
4926 <tr>
4927 <td>Computed value:
4929 <td>as specified
4931 <tr>
4932 <td>Animatable:
4934 <td>no
4935 </table>
4937 <p>The value of ‘<a href="#normal2"><code
4938 class=property>normal</code></a>’ implies that when rendering with
4939 OpenType fonts the language of the document is used to infer the OpenType
4940 language system, used to select language specific features when rendering.
4941 The value of the <string> is a single three-letter OpenType <a
4942 href="http://www.microsoft.com/typography/otspec/languagetags.htm">language
4943 system tag</a>, defined in the layout tag registry of the OpenType
4944 specification.
4946 <div class=example>
4947 <p>The <a href="http://www.un.org/en/documents/udhr/index.shtml">Universal
4948 Declaration of Human Rights</a> has been translated into a wide variety
4949 of languages. In Turkish, Article 9 of this document might be marked up
4950 as below:</p>
4952 <pre lang=tr><body lang="tr">
4954 <h4>Madde 9</h4>
4955 <p>Hiç kimse keyfi olarak tutuklanamaz, alıkonulanamaz veya sürülemez.</p>
4956 </pre>
4958 <p>Here the user agent uses the value of the ‘<code
4959 class=property>lang</code>’ attribute when rendering text and
4960 appropriately renders this text without ‘<code
4961 class=property>fi</code>’ ligatures. There is no need to use the ‘<a
4962 href="#propdef-font-language-override"><code
4963 class=property>font-language-override</code></a>’ property.</p>
4965 <p>However, a given font may lack support for a specific language. In this
4966 situation authors may need to use the typographic conventions of a
4967 related language that are supported by that font:</p>
4969 <pre lang=mk><body lang="mk"> <!-- Macedonian lang code -->
4971 body { font-language-override: "SRB"; /* Serbian OpenType language tag */ }
4973 <h4>Члeн 9</h4>
4974 <p>Никoj чoвeк нeмa дa бидe пoдлoжeн нa прoизвoлнo aпсeњe, притвoр или прoгoнувaњe.</p>
4976 </pre>
4978 <p>The Macedonian text here will be rendered using Serbian typographic
4979 conventions, with the assumption that the font specified supports
4980 Serbian.</p>
4981 </div>
4983 <p><a id=rendering-considerations></a>
4985 <h2 id=font-feature-resolution><span class=secno>7 </span>Font Feature
4986 Resolution</h2>
4988 <p>As described in the previous section, font features can be enabled in a
4989 variety of ways, either via the use of ‘<a
4990 href="#propdef-font-variant"><code
4991 class=property>font-variant</code></a>’ or ‘<a
4992 href="#propdef-font-feature-settings"><code
4993 class=property>font-feature-settings</code></a>’ in a style rule or
4994 within an <code>@font-face</code> rule. The resolution order for the union
4995 of these settings is defined below. Features defined via CSS properties
4996 are applied on top of layout engine default features.
4998 <h3 id=default-features><span class=secno>7.1 </span>Default features</h3>
5000 <p>For OpenType fonts, user agents must enable the default features defined
5001 in the OpenType documentation for a given script and writing mode.
5002 Required ligatures, common ligatures and contextual forms must be enabled
5003 by default (OpenType features: <span class=tag>rlig, liga, clig,
5004 calt</span>), along with localized forms (OpenType feature: <span
5005 class=tag>locl</span>), and features required for proper display of
5006 composed characters and marks (OpenType features: <span class=tag>ccmp,
5007 mark, mkmk</span>). These features must always be enabled, even when the
5008 value of the ‘<a href="#propdef-font-variant"><code
5009 class=property>font-variant</code></a>’ and ‘<a
5010 href="#propdef-font-feature-settings"><code
5011 class=property>font-feature-settings</code></a>’ properties is ‘<a
5012 href="#normal2"><code class=property>normal</code></a>’. Individual
5013 features are only disabled when explicitly overridden by the author, as
5014 when ‘<a href="#propdef-font-variant-ligatures"><code
5015 class=property>font-variant-ligatures</code></a>’ is set to ‘<a
5016 href="#no-common-ligatures"><code
5017 class=property>no-common-ligatures</code></a>’. For handling complex
5018 scripts such as <a
5019 href="http://www.microsoft.com/typography/otfntdev/arabicot/features.aspx">Arabic</a>,
5020 <a
5021 href="http://www.microsoft.com/typography/otfntdev/mongolot/features.htm">Mongolian</a>
5022 or <a
5023 href="http://www.microsoft.com/typography/otfntdev/devanot/features.aspx">Devanagari</a>
5024 additional features are required. For upright text within vertical text
5025 runs, vertical alternates (OpenType feature: <span class=tag>vert</span>)
5026 must be enabled.
5028 <h3 id=feature-precedence><span class=secno>7.2 </span>Feature precedence</h3>
5030 <p>General and font specific font feature property settings are resolved in
5031 the order below, in ascending precedence order. This ordering is used to
5032 construct a combined list of font features that affect a given text run.
5034 <ol>
5035 <li>Font features enabled by default, including features required for a
5036 given script.
5038 <li>If the font is defined via an <code>@font-face</code> rule, the font
5039 features implied by the font-variant descriptor in the
5040 <code>@font-face</code> rule.
5042 <li>If the font is defined via an <code>@font-face</code> rule, the font
5043 features implied by the font-feature-settings descriptor in the
5044 <code>@font-face</code> rule.
5046 <li>Feature settings determined by properties other than ‘<a
5047 href="#propdef-font-variant"><code
5048 class=property>font-variant</code></a>’ or ‘<a
5049 href="#propdef-font-feature-settings"><code
5050 class=property>font-feature-settings</code></a>’. For example, setting
5051 a non-default value for the ‘<code
5052 class=property>letter-spacing</code>’ property disables ligatures.
5054 <li>Font features implied by the value of the ‘<a
5055 href="#propdef-font-variant"><code
5056 class=property>font-variant</code></a>’ property, the related
5057 font-variant subproperties and any other CSS property that may use
5058 OpenType features (e.g. the ‘<a href="#propdef-font-kerning"><code
5059 class=property>font-kerning</code></a>’ property).
5061 <li>Font features implied by the value of ‘<a
5062 href="#propdef-font-feature-settings"><code
5063 class=property>font-feature-settings</code></a>’ property.
5064 </ol>
5066 <p>This ordering allows authors to set up a general set of defaults for
5067 fonts within their <code>@font-face</code> rules, then override them with
5068 property settings for specific elements. General property settings
5069 override the settings in <code>@font-face</code> rules and low-level font
5070 feature settings override ‘<a href="#propdef-font-variant"><code
5071 class=property>font-variant</code></a>’ property settings.
5073 <p>For situations where the combined list of font feature settings contains
5074 more than one value for the same feature, the last value is used. When a
5075 font lacks support for a given underlying font feature, text is simply
5076 rendered as if that font feature was not enabled; font fallback does not
5077 occur and no attempt is made to synthesize the feature except where
5078 explicitly noted for specific properties.
5080 <h3 id=feature-precedence-examples><span class=secno>7.3 </span>Feature
5081 precedence examples</h3>
5083 <div class=example>
5084 <p>With the styles below, numbers are rendered proportionally when used
5085 within a paragraph but are shown in tabular form within tables of prices:</p>
5087 <pre>body {
5088 font-variant-numeric: proportional-nums;
5089 }
5091 table.prices td {
5092 font-variant-numeric: tabular-nums;
5093 }
5094 </pre>
5095 </div>
5097 <div class=example>
5098 <p>When the font-variant descriptor is used within an
5099 <code>@font-face</code> rule, it only applies to the font defined by that
5100 rule.</p>
5102 <pre>@font-face {
5103 font-family: MainText;
5104 src: url(http://example.com/font.ttf);
5105 font-variant: oldstyle-nums proportional-nums styleset(1,3);
5106 }
5108 body {
5109 font-family: MainText, Helvetica;
5110 }
5112 table.prices td {
5113 font-variant-numeric: tabular-nums;
5114 }
5115 </pre>
5117 <p>In this case, old-style numerals will be used throughout but only where
5118 the font "MainText" is used. Just as in the previous example, tabular
5119 values will be used in price tables since ‘<a
5120 href="#tabular-nums"><code class=property>tabular-nums</code></a>’
5121 appears in a general style rule and its use is mutually exclusive with
5122 ‘<a href="#proportional-nums"><code
5123 class=property>proportional-nums</code></a>’. Stylistic alternate sets
5124 will only be used where MainText is used.</p>
5125 </div>
5127 <div class=example>
5128 <p>The <code>@font-face</code> rule can also be used to access font
5129 features in locally available fonts via the use of local() in the ‘<a
5130 href="#descdef-src"><code class=property>src</code></a>’ descriptor of
5131 the <code>@font-face</code> definition:</p>
5133 <pre>@font-face {
5134 font-family: BodyText;
5135 src: local("HiraMaruPro-W4");
5136 font-variant: proportional-width;
5137 font-feature-settings: "ital"; /* Latin italics within CJK text feature */
5138 }
5140 body { font-family: BodyText, serif; }
5141 </pre>
5143 <p>If available, a Japanese font "Hiragino Maru Gothic" will be used. When
5144 text rendering occurs, Japanese kana will be proportionally spaced and
5145 Latin text will be italicised. Text rendered with the fallback serif font
5146 will use default rendering properties.</p>
5147 </div>
5149 <div class=example>
5150 <p>In the example below, discretionary ligatures are enabled only for a
5151 downloadable font but are disabled within spans of class "special":</p>
5153 <pre>@font-face {
5154 font-family: main;
5155 src: url(fonts/ffmeta.woff) format("woff");
5156 font-variant: discretionary-ligatures;
5157 }
5159 body { font-family: main, Helvetica; }
5160 span.special { font-variant-ligatures: no-discretionary-ligatures; }
5161 </pre>
5163 <p>Adding an discretionary style rule with the <code>@font-face</code>
5164 above:</p>
5166 <pre>body { font-family: main, Helvetica; }
5167 span { font-feature-settings: "dlig"; }
5168 span.special { font-variant-ligatures: no-discretionary-ligatures; }
5169 </pre>
5171 <p>Within spans of class "special", discretionary ligatures <em>will</em>
5172 be rendered. This is because both the ‘<a
5173 href="#propdef-font-feature-settings"><code
5174 class=property>font-feature-settings</code></a>’ and ‘<a
5175 href="#propdef-font-variant-ligatures"><code
5176 class=property>font-variant-ligatures</code></a>’ properties apply to
5177 these spans. Although the ‘<code class=css>no-discretionary
5178 ligatures</code>’ setting of ‘<a
5179 href="#propdef-font-variant-ligatures"><code
5180 class=property>font-variant-ligatures</code></a>’ effectively disables
5181 the OpenType <span class=tag>dlig</span> feature, because the ‘<a
5182 href="#propdef-font-feature-settings"><code
5183 class=property>font-feature-settings</code></a>’ is resolved after
5184 that, the ‘<code class=property>dlig</code>’ value reenables
5185 discretionary ligatures.</p>
5186 </div>
5188 <h2 id=object-model><span class=secno>8 </span>Object Model</h2>
5190 <p>The contents of <code>@font-face</code> and
5191 <code>@font-feature-values</code> rules can be accessed via the following
5192 extensions to the CSS Object Model.
5194 <h3 id=om-fontface><span class=secno>8.1 </span>The <a
5195 href="#cssfontfacerule"><code>CSSFontFaceRule</code></a> interface</h3>
5197 <p>The <dfn id=cssfontfacerule>CSSFontFaceRule</dfn> interface represents a
5198 <code>@font-face</code> rule.
5200 <pre class=idl>
5201 interface CSSFontFaceRule : CSSRule {
5202 attribute DOMString family;
5203 attribute DOMString src;
5204 attribute DOMString style;
5205 attribute DOMString weight;
5206 attribute DOMString stretch;
5207 attribute DOMString unicodeRange;
5208 attribute DOMString variant;
5209 attribute DOMString featureSettings;
5210 }</pre>
5212 <p>The DOM Level 2 Style specification <a href="#DOM-LEVEL-2-STYLE"
5213 rel=biblioentry>[DOM-LEVEL-2-STYLE]<!--{{DOM-LEVEL-2-STYLE}}--></a>
5214 defined a different variant of this rule. This definition supercedes that
5215 one.
5217 <h3 id=om-fontfeaturevalues><span class=secno>8.2 </span>The <a
5218 href="#cssfontfeaturevaluesrule"><code>CSSFontFeatureValuesRule</code></a>
5219 interface</h3>
5221 <p>The <code>CSSRule</code> interface is extended as follows:
5223 <pre class=idl>partial interface CSSRule {
5224 const unsigned short FONT_FEATURE_VALUES_RULE = 14;
5225 }</pre>
5227 <p>The <dfn id=cssfontfeaturevaluesrule>CSSFontFeatureValuesRule</dfn>
5228 interface represents a <code>@font-feature-values</code> rule.
5230 <pre class=idl>interface CSSFontFeatureValuesRule : CSSRule {
5231 readonly attribute DOMString familyList;
5232 readonly attribute DOMString valueText;
5233 };</pre>
5235 <dl class=idl-attributes>
5236 <dt><var>familyList</var> of type <code>DOMString</code>, readonly
5238 <dd>The list of one or more font families for which a given set of feature
5239 values is defined.
5241 <dt><var>valueText</var> of type <code>DOMString</code>, readonly
5243 <dd>Serialized set of feature values.
5244 </dl>
5246 <h2 id=font-load-events><span class=secno>9 </span>Font Load Events</h2>
5248 <p>Since fonts defined via <code>@font-face</code> rules are loaded on
5249 demand, pages may need to know precisely when fonts have completed
5250 downloading before measuring text elements on the page or to show some
5251 form of interim user interface state.
5253 <h3 id=document-fontloader><span class=secno>9.1 </span>Extension to the
5254 <code>document</code> interface</h3>
5256 <p>To allow font loading to be tracked explicitly within content the
5257 following event target is added to the <code>document</code> of the page:
5259 <pre class=idl>partial interface Document {
5260 readonly attribute FontLoader fontloader;
5261 };
5262 </pre>
5264 <h3 id=fontloader-interface><span class=secno>9.2 </span>The
5265 <code>FontLoader</code> Interface</h3>
5267 <pre class=idl>dictionary CSSFontFaceLoadEventInit : EventInit {
5268 CSSFontFaceRule fontface = null;
5269 DOMError error = null;
5270 };
5272 dictionary LoadFontParameters {
5273 DOMString font;
5274 DOMString text = " ";
5275 FontsReadyCallback onsuccess;
5276 FontsReadyCallback onerror;
5277 };
5279 [Constructor(DOMString type, optional CSSFontFaceLoadEventInit eventInitDict)]
5280 interface CSSFontFaceLoadEvent : Event {
5281 readonly attribute CSSFontFaceRule fontface;
5282 readonly attribute DOMError error;
5283 }
5285 callback FontsReadyCallback = void ();
5287 interface FontLoader : EventTarget {
5289 // -- events for when loading state changes
5290 attribute EventHandler <a href="#fontloader-loading">onloading</a>;
5291 attribute EventHandler <a href="#fontloader-loadingdone">onloadingdone</a>;
5293 // -- events for each individual font load
5294 attribute EventHandler <a href="#fontloader-loadstart">onloadstart</a>;
5295 attribute EventHandler <a href="#fontloader-load">onload</a>;
5296 attribute EventHandler <a href="#fontloader-error">onerror</a>;
5298 // check and start load if appropriate
5299 // and fire callback when all loads complete
5300 void <a href="#fontloader-loadfont">loadFont</a>(LoadFontParameters params);
5302 // return whether all fonts in the fontlist are loaded
5303 // (does not initiate load if not available)
5304 boolean <a href="#fontloader-checkfont">checkFont</a>(DOMString font, optional DOMString text = " ");
5306 // async notify upon completion, pending layout changes
5307 void <a href="#fontloader-notifywhenfontsready">notifyWhenFontsReady</a>(FontsReadyCallback fontsReadyCallback);
5309 // loading state, true while one or more fonts loading, false otherwise
5310 readonly attribute boolean loading;
5311 };</pre>
5313 <p>Because font families defined with <code>@font-face</code> rules are
5314 loaded only when they are used, content sometimes needs to understand when
5315 the loading of fonts occurs. Authors can use the events and methods
5316 defined here to allow greater control over actions that are dependent upon
5317 the availability of specific fonts.
5319 <p>The term <dfn id=font-load>font load</dfn> is used below to indicate
5320 when the loading of content for a given <code>@font-face</code> rule
5321 completes. An <code>@font-face</code> rule may list multiple alternate
5322 resources within the ‘<a href="#descdef-src"><code
5323 class=property>src</code></a>’ descriptor, including references to local
5324 fonts, but the term font load only refers to the loading of the finally
5325 selected resource for a given rule, not to the loading of each individual
5326 resource.
5328 <h4 id=events><span class=secno>9.2.1 </span>Events</h4>
5330 <p>The following are the event handlers (and their corresponding event
5331 handler event types) that must be supported by <code>FontLoader</code>
5332 objects as IDL attributes:
5334 <table class=data id=eventhandlers>
5335 <thead>
5336 <tr>
5337 <th>Event handler
5339 <th>Event handler event type
5341 <tbody>
5342 <tr>
5343 <th><code class=idl-code>onloading</code>
5345 <td><code class=idl-code>loading</code>
5347 <tr>
5348 <th><code class=idl-code>onloadingdone</code>
5350 <td><code class=idl-code>loadingdone</code>
5352 <tr>
5353 <th><code class=idl-code>onloadstart</code>
5355 <td><code class=idl-code>loadstart</code>
5357 <tr>
5358 <th><code class=idl-code>onload</code>
5360 <td><code class=idl-code>load</code>
5362 <tr>
5363 <th><code class=idl-code>onerror</code>
5365 <td><code class=idl-code>error</code>
5366 </table>
5368 <p>To <dfn id=fire-a-font-load-event>fire a font load event</dfn> named
5369 <var>e</var> at a <code>FontLoader</code> target means to <a
5370 href="http://www.w3.org/TR/html5/webappapis.html#event-firing">fire a
5371 simple event</a> named <var>e</var> using the
5372 <code>CSSFontFaceLoadEvent</code> interface that also meets these
5373 conditions:
5375 <ol>
5376 <li>The <code class=idl-code>fontface</code> attribute is initialized to
5377 the given <var>font face rule</var>.
5379 <li>The <code class=idl-code>error</code> attribute is initialized to the
5380 given <var>error</var>.
5381 </ol>
5383 <p>When the user agent determines that one or more fonts defined via
5384 <code>@font-face</code> rules in a document <var>doc</var> need to be
5385 loaded, it must run the following steps:
5387 <ol>
5388 <li>Let <var>font loader</var> be the value of the <code
5389 class=idl-code>fontloader</code> attribute of <var>doc</var>.
5391 <li>Set the <code class=idl-code>loading</code> attribute of <var>font
5392 loader</var> to true.
5394 <li><a href="#fire-a-font-load-event">Fire a font load event</a> named <a
5395 id=fontloader-loading><code class=idl-code>"loading"</code></a> with
5396 <var>font face rule</var> and <var>error</var> at <var>font loader</var>.
5398 <li>When the user agent begins loading the first resource for a given
5399 <code>@font-face</code> rule, it must <a
5400 href="#fire-a-font-load-event">fire a font load event</a> named <a
5401 id=fontloader-loadstart><code class=idl-code>"loadstart"</code></a> with
5402 <var>font face</var> set to the <code>@font-face</code> rule that caused
5403 this load to start and <var>error</var> set to <code>????</code> at
5404 <var>font loader</var>.
5405 </ol>
5407 <p class=issue>What are the error types that should be used here?
5409 <p>The term “font load” covers any of the resources listed in the
5410 ‘src’ descriptor, including local fonts. When multiple resources are
5411 listed, the “font load” is the first resource in the list to
5412 successfully load or the error that occurs on the last resource for which
5413 a load is attempted.
5415 <p class=issue>Given that a set of <code>@font-face</code> rules might load
5416 concurrently, does it make sense to have a non-null value for the <code
5417 class=idl-code>"loading"</code> event?
5419 <p>When the user agent completes each font load for a document
5420 <var>doc</var>, it must run the following steps:
5422 <ol>
5423 <li>Let <var>font loader</var> be the value of the <code
5424 class=idl-code>fontloader</code> attribute of <var>doc</var>.
5426 <li>If none of the resources listed for the ‘<a
5427 href="#descdef-src"><code class=property>src</code></a>’ descriptor
5428 contain valid data, <a href="#fire-a-font-load-event">fire a font load
5429 event</a> named <a id=fontloader-error><code
5430 class=idl-code>"error"</code></a> with <var>font face</var> the
5431 <code>@font-face</code> rule that caused this load to start and
5432 <var>error</var> [something?] at <var>font loader</var>.
5434 <li>Otherwise, <a href="#fire-a-font-load-event">fire a font load
5435 event</a> named <a id=fontloader-load><code
5436 class=idl-code>"load"</code></a> with <var>font face</var> the
5437 <code>@font-face</code> rule that caused this load to start and
5438 <var>error</var> [something?] at <var>font loader</var>.
5439 </ol>
5441 <p>When the user agent completes the final font load for document
5442 <var>doc</var>, it must run the following steps:
5444 <ol>
5445 <li>Let <var>font loader</var> be the value of the <code
5446 class=idl-code>fontloader</code> attribute of <var>doc</var>.
5448 <li>Set the <code class=idl-code>loading</code> attribute of <var>font
5449 loader</var> to false.
5451 <li><a href="#fire-a-font-load-event">Fire a font load event</a> named <a
5452 id=fontloader-loadingdone><code class=idl-code>"loadingdone"</code></a>
5453 with <var>font face rule</var>, set to the last font to load, and
5454 <var>error</var> at <var>font loader</var>.
5455 </ol>
5457 <p>Note: For example, if three fonts are loaded at the same time, a <code
5458 class=idl-code>"loading"</code> event followed by three <code
5459 class=idl-code>"loadstart"</code> events and three <code
5460 class=idl-code>"load"</code> or <code class=idl-code>"error"</code>
5461 events, followed by a <code class=idl-code>"loadingdone"</code> event will
5462 occur.
5464 <h4 id=methods><span class=secno>9.2.2 </span>Methods</h4>
5466 <p>The methods <code class=idl-code>loadFont</code> and <code
5467 class=idl-code>checkFont</code> must determine whether all fonts in the
5468 given font list have been loaded and are available. If all fonts are
5469 available, <code class=idl-code>checkFont</code> must return true, false
5470 if one or more fonts are not available. In the case of <code
5471 class=idl-code>loadFont</code>, if any fonts are downloadable fonts and
5472 have not already been loaded, the user agent must initiate the load of
5473 each of these fonts.
5475 <p>The <a id=fontloader-loadfont><code
5476 class=idl-code>loadFont(params)</code></a> method must use these steps:
5478 <ol>
5479 <li>Parse the value of the <code class=idl-code>font</code> member of
5480 <code class=idl-code>params</code>, using the CSS value syntax of the
5481 ‘<a href="#propdef-font"><code class=property>font</code></a>’
5482 property.
5484 <li>If a syntax error occurs, return.
5486 <li>Otherwise, let <var>font family list</var> be the set of families and
5487 <var>font style</var> be the other font style attributes.
5489 <li>For each family in <var>font family list</var>, use the font matching
5490 rules to select the font faces that match the <var>font style</var>. In
5491 the case where these are font faces defined via <code>@font-face</code>
5492 rules, the use of ‘<a href="#descdef-unicode-range"><code
5493 class=property>unicode-range</code></a>’ means that this may be more
5494 than just a single font face.
5496 <li>Remove from the set of font faces all faces that have defined ‘<a
5497 href="#descdef-unicode-range"><code
5498 class=property>unicode-range</code></a>’ values that don't intersect
5499 the range of character values in the <code class=idl-code>text</code>
5500 member of <code class=idl-code>params</code> and set this to be the
5501 <var>font load list</var>.
5503 <li>For all of the font faces in the <var>font load list</var>, initiate
5504 the load of any font that has not already been loaded and return.
5506 <li>When all fonts in the <var>font load list</var> have been loaded, fire
5507 the appropriate callback handler. If all fonts loaded successfully, call
5508 the callback specified by the <code class=idl-code>onsuccess</code>
5509 member of <code class=idl-code>params</code>. If an error occurred with
5510 any one of the fonts in the <var>font load list</var> or if the list is
5511 empty, call the callback specified by the <code
5512 class=idl-code>onerror</code> member of <code
5513 class=idl-code>params</code>.
5514 </ol>
5516 <p>Callbacks for <code class=idl-code>loadFont</code> fire in addition to
5517 the callbacks that fire due to font event handlers.
5519 <p>The <a id=fontloader-checkfont><code class=idl-code>checkFont(font,
5520 text)</code></a> method must use these steps:
5522 <ol>
5523 <li>Parse the value of the <code class=idl-code>font</code> parameter,
5524 using the CSS value syntax of the ‘<a href="#propdef-font"><code
5525 class=property>font</code></a>’ property.
5527 <li>If a syntax error occurs, return <code class=idl-code>false</code>.
5529 <li>Otherwise, let <var>font family list</var> be the set of families and
5530 <var>font style</var> be the other font style attributes.
5532 <li>For each family in <var>font family list</var>, use the font matching
5533 rules to select the font faces that match the <var>font style</var>. In
5534 the case where these are font faces defined via <code>@font-face</code>
5535 rules, the use of ‘<a href="#descdef-unicode-range"><code
5536 class=property>unicode-range</code></a>’ means that this may be more
5537 than just a single font face.
5539 <li>Remove from the set of font faces all faces that have defined ‘<a
5540 href="#descdef-unicode-range"><code
5541 class=property>unicode-range</code></a>’ values that don't intersect
5542 the range of character values in the <code class=idl-code>text</code>
5543 parameter and set this to be the <var>font load list</var>.
5545 <li>If the <var>font load list</var> contains no font faces, return <code
5546 class=idl-code>false</code>.
5548 <li>If all fonts in the <var>font load list</var> have already
5549 successfully been loaded, return <code class=idl-code>true</code>.
5550 Otherwise, return <code class=idl-code>false</code>.
5551 </ol>
5553 <p>The <code class=idl-code>font</code> parameter of <code
5554 class=idl-code>checkFont</code> and the <code class=idl-code>font</code>
5555 member of <code class=idl-code>params</code> parameter of <code
5556 class=idl-code>loadFont</code> both specify the list of fonts to load.
5557 These values must be parsed using the same syntax as values for the CSS
5558 ‘<a href="#propdef-font"><code class=property>font</code></a>’
5559 property, the same way the <code class=idl-code>font</code> attribute of
5560 the <code>CanvasRenderingContext2D</code> is interpreted. <a href="#HTML5"
5561 rel=biblioentry>[HTML5]<!--{{!HTML5}}--></a> This yields a list of font
5562 families along with font style attributes.
5564 <p>Because the number of fonts loaded depends on the how many fonts are
5565 used for a given piece of text, in some cases whether fonts need to be
5566 loaded or not may not be known. The <a
5567 id=fontloader-notifywhenfontsready><code
5568 class=idl-code>notifyWhenFontsReady</code></a> method provides a way for
5569 authors to avoid having to keep track of which fonts have or haven't been
5570 loaded before examining content affected by which font is used.
5572 <p>The <code class=idl-code>notifyWhenFontsReady(fontsReadyCallback)</code>
5573 method must use these steps:
5575 <ol>
5576 <li>Let <var>font loader</var> be the value of the <code
5577 class=idl-code>fontloader</code> attribute of <var>doc</var>.
5579 <li>Add the value of the <code class=idl-code>fontsReadyCallback</code>
5580 parameter to the <var>notify</var> callback list of the <var>font
5581 loader</var> and return.
5583 <li>Once all pending layout operations have completed, determine whether
5584 font resources need to be loaded.
5586 <li>If no loads are in progress, copy the contents of the
5587 <var>notify</var> callback list to the <var>notify pending</var> list of
5588 the <var>font loader</var> and clear out the <var>notify</var> list.
5589 After the <code class=idl-code>"loadingdone"</code> event fires, call
5590 each of the callbacks in the <var>notify pending</var> list and clear out
5591 the <var>notify pending</var> list.
5593 <li>Otherwise, after all font loads complete and subsequent layout
5594 operations finish, again check whether loads are in progress. If no loads
5595 are in progress, execute the previous step. If fonts are still loading,
5596 continue waiting until those loads complete and repeat this step.
5597 </ol>
5599 <p>Authors should note here that the callback only fires once, the method
5600 needs to be called again when further font loads might occur. This method
5601 is similar to the callback function of the <code
5602 class=idl-code>"loadingdone"</code> event handler, except that in this
5603 case the callback will <strong>always</strong> get called, even when no
5604 font loads occur because the fonts in question are already loaded. It's a
5605 simple, easy way to sync code to font loads without the need to keep track
5606 of what fonts are needed and precisely when they load.
5608 <p>Note that the user agent may need to iterate over multiple font loads
5609 before the notify callback is called. This can occur with font fallback
5610 situations, where one font in the fontlist is loaded but doesn't contain a
5611 particular glyph and other fonts in the fontlist need to be loaded. The
5612 notify callback only fires after layout operations complete and no
5613 additional font loads are necessary.
5615 <h3 id=font-load-event-examples><span class=secno>9.3 </span>Font load
5616 event examples</h3>
5618 <div class=example>
5619 <p>To show content only after all font loads complete:</p>
5621 <pre> document.fontloader.onloadingdone = function() {
5622 var content = document.getElementById("content");
5623 content.style.visibility = "visible";
5624 }
5625 </pre>
5626 </div>
5628 <div class=example>
5629 <p>Drawing text in a canvas with a downloadable font, explicitly
5630 initiating the font download and drawing upon completion:</p>
5632 <pre> function drawStuff() {
5633 var ctx = document.getElementById("c").getContext("2d");
5635 ctx.fillStyle = "red";
5636 ctx.font = "50px MyDownloadableFont";
5637 ctx.fillText("Hello!", 100, 100);
5638 }
5640 document.fontloader.loadFont({font: "50px MyDownloadableFont",
5641 onsuccess: drawStuff,
5642 onerror: handleError});</pre>
5643 </div>
5645 <div class=example>
5646 <p>A rich text editing application may need to measure text elements after
5647 editing operations have taken place. Since style changes may or may not
5648 require additional fonts to be downloaded, or the fonts may already have
5649 been downloaded, the measurement procedures need to occur after those
5650 font loads complete:</p>
5652 <pre> function measureTextElements() {
5653 // contents can now be measured using the metrics of
5654 // the downloadable font(s)
5655 }
5657 function doEditing() {
5659 // content/layout operations that may cause additional font loads
5661 document.fontloader.notifyWhenFontsReady(measureTextElements);
5662 }
5663 </pre>
5664 </div>
5666 <h2 class=no-num id=platform-props-to-css>Appendix A: Mapping platform font
5667 properties to CSS properties</h2>
5669 <p><em>This appendix is included as background for some of the problems and
5670 situations that are described in other sections. It should be viewed as
5671 informative only.</em>
5673 <p>Font properties in CSS are designed to be independent of the underlying
5674 font formats used; they can be used to specify bitmap fonts, Type1 fonts,
5675 SVG fonts in addition to the common TrueType and OpenType fonts. But there
5676 are facets of the TrueType and OpenType formats that often cause confusion
5677 for authors and present challenges to implementers on different platforms.
5679 <p>Originally developed at Apple, TrueType was designed as an outline font
5680 format for both screen and print. Microsoft joined Apple in developing the
5681 TrueType format and both platforms have supported TrueType fonts since
5682 then. Font data in the TrueType format consists of a set of tables
5683 distinguished with common four-letter tag names, each containing a
5684 specific type of data. For example, naming information, including
5685 copyright and license information, is stored in the ‘<code
5686 class=property>name</code>’ table. The <a
5687 href="#character-map"><em>character map</em></a> (‘<code
5688 class=property>cmap</code>’) table contains a mapping of character
5689 encodings to glyphs. Apple later added additional tables for supporting
5690 enhanced typographic functionality; these are now called Apple Advanced
5691 Typography, or AAT, fonts. Microsoft and Adobe developed a separate set of
5692 tables for advanced typography and called their format OpenType <a
5693 href="#OPENTYPE" rel=biblioentry>[OPENTYPE]<!--{{!OPENTYPE}}--></a>.
5695 <p>In many cases the font data used under Microsoft Windows or Linux is
5696 slightly different from the data used under Apple's Mac OS X because the
5697 TrueType format allowed for explicit variation across platforms. This
5698 includes font metrics, names and <a href="#character-map"><em>character
5699 map</em></a> data.
5701 <p>Specifically, font family name data is handled differently across
5702 platforms. For TrueType and OpenType fonts these names are contained in
5703 the ‘<code class=property>name</code>’ table, in name records with
5704 name ID 1. Mulitple names can be stored for different locales but
5705 Microsoft recommends fonts always include at least a US English version of
5706 the name. On Windows, Microsoft made the decision for backwards
5707 compatibility to limit this family name to a maximum of four faces; for
5708 larger groupings the "preferred family" (name ID 16) or "WWS family" (name
5709 ID 21) can be used. Other platforms such as OSX don't have this
5710 limitation, the family name is used to define all possible groupings.
5712 <p>Other name table data provides names used to uniquely identify a
5713 specific face within a family. The full font name (name ID 4) and the
5714 Postscript name (name ID 6) describe a single face uniquely. The bold face
5715 of the Gill Sans family has a fullname of "Gill Sans Bold" and a
5716 Postscript name of "GillSans-Bold". There can be multiple localized
5717 versions of the fullname for a given face but the Postscript name is
5718 always a unique name made from a limited set of ASCII characters.
5720 <p>On various platforms, different names are used to search for a font. For
5721 example, with the Windows GDI CreateIndirectFont API, either a family or
5722 fullname can be used to lookup a face while on Mac OS X the
5723 ATSFontFindFromName and ATSFontFindFromPostScriptName API calls are used
5724 to lookup a given face using the fullname and Postscript name. Under
5725 Linux, the fontconfig API allows fonts to be searched using any of these
5726 names. In situations where platform API's automatically substitute other
5727 font choices, it may be necessary to verify a returned font matches a
5728 given name.
5730 <p>The weight of a given face can be determined via the usWeightClass field
5731 of the OS/2 table or inferred from the style name (name ID 2). Likewise,
5732 the width can be determined via the usWidthClass of the OS/2 table or
5733 inferred from the style name. For historical reasons related to synthetic
5734 bolding at weights 200 or lower with the Windows GDI API, font designers
5735 have sometimes skewed values in the OS/2 table to avoid these weights.
5737 <p>Rendering complex scripts that use contextual shaping such as Thai,
5738 Arabic and Devanagari requires features present only in OpenType or AAT
5739 fonts. Currently, complex script rendering is supported on Windows and
5740 Linux using OpenType font features while AAT font features are used under
5741 Mac OS X. Apple has indicated it intends to support complex script
5742 rendering using OpenType font features in the future.
5744 <h2 class=no-num id=ch-ch-ch-changes>Changes</h2>
5746 <h3 class=no-num id=recent-changes> Changes from the <a
5747 href="http://www.w3.org/TR/2012/WD-css3-fonts-20121211/">December 2012
5748 CSS3 Fonts Working Draft</a></h3>
5750 <p>Major changes include:
5752 <ul>
5753 <li><code>loadFont</code> method takes a dictionary parameter that
5754 includes callbacks
5756 <li>Added example of system font names used as normal font family name
5758 <li>Added conformance section
5760 <li>Added CORS cross-origin request algorithm parameters
5762 <li>Added specification of Unicode caseless matching for font family names
5763 based on WG resolution
5765 <li>Include issue of synthetic oblique angle in CJK vertical text runs
5767 <li>Minor editorial tweaks hither and thither
5768 </ul>
5770 <h2 class=no-num id=acknowledgments>Acknowledgments</h2>
5772 <p>I'd like to thank Tal Leming, Jonathan Kew and Christopher Slye for all
5773 their help and feedback. John Hudson was kind enough to take the time to
5774 explain the subtleties of OpenType language tags and provided the example
5775 of character variant usage for displaying text on Byzantine seals. Ken
5776 Lunde and Eric Muller provided valuable feedback on CJK OpenType features
5777 and Unicode variation selectors. The idea for supporting font features by
5778 using font-variant subproperties originated with Håkon Wium Lie, Adam
5779 Twardoch and Tal Leming. Elika Etemad supplied some of the initial design
5780 ideas for the <code>@font-feature-values</code> rule. Several members of
5781 the Google Fonts team provided helpful feedback on font load events, as
5782 did Boris Zbarsky, Jonas Sicking and ms2ger. Thanks also to House
5783 Industries for allowing the use of Ed Interlock in the discretionary
5784 ligatures example.
5786 <p>A special thanks to Robert Bringhurst for the sublime mind expansion
5787 that is <em>The Elements of Typographic Style</em>.
5789 <h2 class=no-num id=conformance> Conformance</h2>
5791 <h3 class=no-num id=conventions> Document Conventions</h3>
5793 <p>Conformance requirements are expressed with a combination of descriptive
5794 assertions and RFC 2119 terminology. The key words “MUST”, “MUST
5795 NOT”, “REQUIRED”, “SHALL”, “SHALL NOT”, “SHOULD”,
5796 “SHOULD NOT”, “RECOMMENDED”, “MAY”, and “OPTIONAL” in the
5797 normative parts of this document are to be interpreted as described in RFC
5798 2119. However, for readability, these words do not appear in all uppercase
5799 letters in this specification.
5801 <p>All of the text of this specification is normative except sections
5802 explicitly marked as non-normative, examples, and notes. <a
5803 href="#RFC2119" rel=biblioentry>[RFC2119]<!--{{!RFC2119}}--></a>
5805 <p>Examples in this specification are introduced with the words “for
5806 example” or are set apart from the normative text with
5807 <code>class="example"</code>, like this:
5809 <div class=example>
5810 <p>This is an example of an informative example.
5811 </div>
5813 <p>Informative notes begin with the word “Note” and are set apart from
5814 the normative text with <code>class="note"</code>, like this:
5816 <p class=note>Note, this is an informative note.
5818 <h3 class=no-num id=conformance-classes> Conformance Classes</h3>
5820 <p>Conformance to CSS Fonts Level 3 Module is defined for three conformance
5821 classes:
5823 <dl>
5824 <dt><dfn id=style-sheet title="style sheet!!as conformance class">style
5825 sheet</dfn>
5827 <dd>A <a href="http://www.w3.org/TR/CSS21/conform.html#style-sheet">CSS
5828 style sheet</a>.
5830 <dt><dfn id=renderer>renderer</dfn>
5832 <dd>A <a href="http://www.w3.org/TR/CSS21/conform.html#user-agent">UA</a>
5833 that interprets the semantics of a style sheet and renders documents that
5834 use them.
5836 <dt><dfn id=authoring-tool>authoring tool</dfn>
5838 <dd>A <a href="http://www.w3.org/TR/CSS21/conform.html#user-agent">UA</a>
5839 that writes a style sheet.
5840 </dl>
5842 <p>A style sheet is conformant to CSS Fonts Level 3 Module if all of its
5843 declarations that use properties defined in this module have values that
5844 are valid according to the generic CSS grammar and the individual grammars
5845 of each property as given in this module.
5847 <p>A renderer is conformant to CSS Fonts Level 3 Module if, in addition to
5848 interpreting the style sheet as defined by the appropriate specifications,
5849 it supports all the features defined by CSS Fonts Level 3 Module by
5850 parsing them correctly and rendering the document accordingly. However,
5851 the inability of a UA to correctly render a document due to limitations of
5852 the device does not make the UA non-conformant. (For example, a UA is not
5853 required to render color on a monochrome monitor.)
5855 <p>An authoring tool is conformant to CSS Fonts Level 3 Module if it writes
5856 style sheets that are syntactically correct according to the generic CSS
5857 grammar and the individual grammars of each feature in this module, and
5858 meet all other conformance requirements of style sheets as described in
5859 this module.
5861 <h3 class=no-num id=partial> Partial Implementations</h3>
5863 <p>So that authors can exploit the forward-compatible parsing rules to
5864 assign fallback values, CSS renderers <strong>must</strong> treat as
5865 invalid (and <a
5866 href="http://www.w3.org/TR/CSS21/conform.html#ignore">ignore as
5867 appropriate</a>) any at-rules, properties, property values, keywords, and
5868 other syntactic constructs for which they have no usable level of support.
5869 In particular, user agents <strong>must not</strong> selectively ignore
5870 unsupported component values and honor supported values in a single
5871 multi-value property declaration: if any value is considered invalid (as
5872 unsupported values must be), CSS requires that the entire declaration be
5873 ignored.
5875 <h3 class=no-num id=experimental> Experimental Implementations</h3>
5877 <p>To avoid clashes with future CSS features, the CSS2.1 specification
5878 reserves a <a
5879 href="http://www.w3.org/TR/CSS21/syndata.html#vendor-keywords">prefixed
5880 syntax</a> for proprietary and experimental extensions to CSS.
5882 <p>Prior to a specification reaching the Candidate Recommendation stage in
5883 the W3C process, all implementations of a CSS feature are considered
5884 experimental. The CSS Working Group recommends that implementations use a
5885 vendor-prefixed syntax for such features, including those in W3C Working
5886 Drafts. This avoids incompatibilities with future changes in the draft.
5888 <h3 class=no-num id=testing> Non-Experimental Implementations</h3>
5890 <p>Once a specification reaches the Candidate Recommendation stage,
5891 non-experimental implementations are possible, and implementors should
5892 release an unprefixed implementation of any CR-level feature they can
5893 demonstrate to be correctly implemented according to spec.
5895 <p>To establish and maintain the interoperability of CSS across
5896 implementations, the CSS Working Group requests that non-experimental CSS
5897 renderers submit an implementation report (and, if necessary, the
5898 testcases used for that implementation report) to the W3C before releasing
5899 an unprefixed implementation of any CSS features. Testcases submitted to
5900 W3C are subject to review and correction by the CSS Working Group.
5902 <p>Further information on submitting testcases and implementation reports
5903 can be found from on the CSS Working Group's website at <a
5904 href="http://www.w3.org/Style/CSS/Test/">http://www.w3.org/Style/CSS/Test/</a>.
5905 Questions should be directed to the <a
5906 href="http://lists.w3.org/Archives/Public/public-css-testsuite">public-css-testsuite@w3.org</a>
5907 mailing list.
5909 <h2 class=no-num id=references>References</h2>
5911 <h3 class=no-num id=normative-references>Normative References</h3>
5912 <!--begin-normative-->
5913 <!-- Sorted by label -->
5915 <dl class=bibliography>
5916 <dt style="display: none"><!-- keeps the doc valid if the DL is empty -->
5917 <!---->
5919 <dt id=CHARMOD>[CHARMOD]
5921 <dd>Martin J. Dürst; et al. <a
5922 href="http://www.w3.org/TR/2005/REC-charmod-20050215/"><cite>Character
5923 Model for the World Wide Web 1.0: Fundamentals.</cite></a> 15 February
5924 2005. W3C Recommendation. URL: <a
5925 href="http://www.w3.org/TR/2005/REC-charmod-20050215/">http://www.w3.org/TR/2005/REC-charmod-20050215/</a>
5926 </dd>
5927 <!---->
5929 <dt id=CORS>[CORS]
5931 <dd>Anne van Kesteren. <a
5932 href="http://www.w3.org/TR/2013/CR-cors-20130129/"><cite>Cross-Origin
5933 Resource Sharing.</cite></a> 29 January 2013. W3C Candidate
5934 Recommendation. (Work in progress.) URL: <a
5935 href="http://www.w3.org/TR/2013/CR-cors-20130129/">http://www.w3.org/TR/2013/CR-cors-20130129/</a>
5936 </dd>
5937 <!---->
5939 <dt id=CSS21>[CSS21]
5941 <dd>Bert Bos; et al. <a
5942 href="http://www.w3.org/TR/2011/REC-CSS2-20110607/"><cite>Cascading Style
5943 Sheets Level 2 Revision 1 (CSS 2.1) Specification.</cite></a> 7 June
5944 2011. W3C Recommendation. URL: <a
5945 href="http://www.w3.org/TR/2011/REC-CSS2-20110607/">http://www.w3.org/TR/2011/REC-CSS2-20110607/</a>
5946 </dd>
5947 <!---->
5949 <dt id=CSS3VAL>[CSS3VAL]
5951 <dd>Håkon Wium Lie; Tab Atkins; Elika J. Etemad. <a
5952 href="http://www.w3.org/TR/2012/CR-css3-values-20120828/"><cite>CSS
5953 Values and Units Module Level 3.</cite></a> 28 August 2012. W3C Candidate
5954 Recommendation. (Work in progress.) URL: <a
5955 href="http://www.w3.org/TR/2012/CR-css3-values-20120828/">http://www.w3.org/TR/2012/CR-css3-values-20120828/</a>
5956 </dd>
5957 <!---->
5959 <dt id=HTML5>[HTML5]
5961 <dd>Ian Hickson. <a
5962 href="http://www.w3.org/TR/2012/CR-html5-20121217/"><cite>HTML5.</cite></a>
5963 17 December 2012. W3C Candidate Recommendation. (Work in progress.) URL:
5964 <a
5965 href="http://www.w3.org/TR/2012/CR-html5-20121217/">http://www.w3.org/TR/2012/CR-html5-20121217/</a>
5966 </dd>
5967 <!---->
5969 <dt id=OPEN-FONT-FORMAT>[OPEN-FONT-FORMAT]
5971 <dd><a
5972 href="http://standards.iso.org/ittf/PubliclyAvailableStandards/c052136_ISO_IEC_14496-22_2009(E).zip"><cite>Information
5973 technology — Coding of audio-visual objects — Part 22: Open Font
5974 Format.</cite></a> International Organization for Standardization.
5975 ISO/IEC 14496-22:2009. URL: <a
5976 href="http://standards.iso.org/ittf/PubliclyAvailableStandards/c052136_ISO_IEC_14496-22_2009(E).zip">http://standards.iso.org/ittf/PubliclyAvailableStandards/c052136_ISO_IEC_14496-22_2009(E).zip</a>
5977 </dd>
5978 <!---->
5980 <dt id=OPENTYPE>[OPENTYPE]
5982 <dd><a
5983 href="http://www.microsoft.com/typography/otspec/default.htm"><cite>OpenType
5984 specification.</cite></a> Microsoft. URL: <a
5985 href="http://www.microsoft.com/typography/otspec/default.htm">http://www.microsoft.com/typography/otspec/default.htm</a>
5986 </dd>
5987 <!---->
5989 <dt id=OPENTYPE-FEATURES>[OPENTYPE-FEATURES]
5991 <dd><a
5992 href="http://www.microsoft.com/typography/otspec/featurelist.htm"><cite>OpenType
5993 feature registry.</cite></a> Microsoft. URL: <a
5994 href="http://www.microsoft.com/typography/otspec/featurelist.htm">http://www.microsoft.com/typography/otspec/featurelist.htm</a>
5995 </dd>
5996 <!---->
5998 <dt id=RFC2119>[RFC2119]
6000 <dd>S. Bradner. <a href="http://www.ietf.org/rfc/rfc2119.txt"><cite>Key
6001 words for use in RFCs to Indicate Requirement Levels.</cite></a> Internet
6002 RFC 2119. URL: <a
6003 href="http://www.ietf.org/rfc/rfc2119.txt">http://www.ietf.org/rfc/rfc2119.txt</a>
6004 </dd>
6005 <!---->
6007 <dt id=UAX15>[UAX15]
6009 <dd>Mark Davis; Ken Whistler. <a
6010 href="http://www.unicode.org/reports/tr15/"><cite>Unicode Normalization
6011 Forms.</cite></a> 31 August 2012. Unicode Standard Annex #15. URL: <a
6012 href="http://www.unicode.org/reports/tr15/">http://www.unicode.org/reports/tr15/</a>
6013 </dd>
6014 <!---->
6016 <dt id=UAX29>[UAX29]
6018 <dd>Mark Davis. <a
6019 href="http://www.unicode.org/reports/tr29/"><cite>Unicode Text
6020 Segmentation.</cite></a> 12 September 2012. Unicode Standard Annex #29.
6021 URL: <a
6022 href="http://www.unicode.org/reports/tr29/">http://www.unicode.org/reports/tr29/</a>
6023 </dd>
6024 <!---->
6026 <dt id=UNICODE6>[UNICODE6]
6028 <dd>The Unicode Consortium. <a
6029 href="http://www.unicode.org/versions/Unicode6.2.0/"><cite>The Unicode
6030 Standard, Version 6.2.0.</cite></a> Defined by: The Unicode Standard,
6031 Version 6.2.0 URL: <a
6032 href="http://www.unicode.org/versions/Unicode6.2.0/">http://www.unicode.org/versions/Unicode6.2.0/</a>
6033 </dd>
6034 <!---->
6035 </dl>
6036 <!--end-normative-->
6037 <!--{{!CSS21}}-->
6038 <!--{{!CSS3VAL}}-->
6039 <!--{{!OPENTYPE}}-->
6040 <!--{{!OPENTYPE-FEATURES}}-->
6041 <!--{{!OPEN-FONT-FORMAT}}-->
6042 <!--{{!UNICODE6}}-->
6043 <!--{{!UAX15}}-->
6044 <!--{{!UAX29}}-->
6045 <!--{{!CORS}}-->
6046 <!--{{!HTML5}}-->
6047 <!--{{!CHARMOD}}-->
6049 <h3 class=no-num id=other-references>Other References</h3>
6050 <!--begin-informative-->
6051 <!-- Sorted by label -->
6053 <dl class=bibliography>
6054 <dt style="display: none"><!-- keeps the doc valid if the DL is empty -->
6055 <!---->
6057 <dt id=AAT-FEATURES>[AAT-FEATURES]
6059 <dd><a href="http://developer.apple.com/fonts/registry/"><cite>Apple
6060 Advanced Typography font feature registry.</cite></a> Apple. URL: <a
6061 href="http://developer.apple.com/fonts/registry/">http://developer.apple.com/fonts/registry/</a>
6062 </dd>
6063 <!---->
6065 <dt id=ARABIC-TYPO>[ARABIC-TYPO]
6067 <dd>Huda Smitshuijzen AbiFares. <cite>Arabic Typography: A Comprehensive
6068 Sourcebook.</cite> Saqi Books. 2001. ISBN 0-86356-347-3.</dd>
6069 <!---->
6071 <dt id=CHARMOD-NORM>[CHARMOD-NORM]
6073 <dd>François Yergeau; et al. <a
6074 href="http://www.w3.org/TR/2012/WD-charmod-norm-20120501/"><cite>Character
6075 Model for the World Wide Web 1.0: Normalization.</cite></a> 1 May 2012.
6076 W3C Working Draft. (Work in progress.) URL: <a
6077 href="http://www.w3.org/TR/2012/WD-charmod-norm-20120501/">http://www.w3.org/TR/2012/WD-charmod-norm-20120501/</a>
6078 </dd>
6079 <!---->
6081 <dt id=CJKV-INFO-PROCESSING>[CJKV-INFO-PROCESSING]
6083 <dd>Ken Lunde. <cite>CJKV Information Processing, Second Edition.</cite>
6084 O'Reilly Media, Inc. 2009. ISBN 0-596-51447-1.</dd>
6085 <!---->
6087 <dt id=CSS3-CONDITIONAL>[CSS3-CONDITIONAL]
6089 <dd>L. David Baron. <a
6090 href="http://www.w3.org/TR/2012/WD-css3-conditional-20121213/"><cite>CSS
6091 Conditional Rules Module Level 3.</cite></a> 13 December 2012. W3C
6092 Working Draft. (Work in progress.) URL: <a
6093 href="http://www.w3.org/TR/2012/WD-css3-conditional-20121213/">http://www.w3.org/TR/2012/WD-css3-conditional-20121213/</a>
6094 </dd>
6095 <!---->
6097 <dt id=CSS3TEXT>[CSS3TEXT]
6099 <dd>Elika J. Etemad; Koji Ishii. <a
6100 href="http://www.w3.org/TR/2012/WD-css3-text-20121113/"><cite>CSS Text
6101 Module Level 3.</cite></a> 13 November 2012. W3C Working Draft. (Work in
6102 progress.) URL: <a
6103 href="http://www.w3.org/TR/2012/WD-css3-text-20121113/">http://www.w3.org/TR/2012/WD-css3-text-20121113/</a>
6104 </dd>
6105 <!---->
6107 <dt id=DIGITAL-TYPOGRAPHY>[DIGITAL-TYPOGRAPHY]
6109 <dd>Richard Rubinstein. <cite>Digital Typography, An Introduction to Type
6110 and Composition for Computer System Design.</cite> Addison-Wesley. 1988.
6111 ISBN 0-201-17633-5.</dd>
6112 <!---->
6114 <dt id=DOM-LEVEL-2-STYLE>[DOM-LEVEL-2-STYLE]
6116 <dd>Chris Wilson; Philippe Le Hégaret; Vidur Apparao. <a
6117 href="http://www.w3.org/TR/2000/REC-DOM-Level-2-Style-20001113/"><cite>Document
6118 Object Model (DOM) Level 2 Style Specification.</cite></a> 13 November
6119 2000. W3C Recommendation. URL: <a
6120 href="http://www.w3.org/TR/2000/REC-DOM-Level-2-Style-20001113/">http://www.w3.org/TR/2000/REC-DOM-Level-2-Style-20001113/</a>
6121 </dd>
6122 <!---->
6124 <dt id=ELEMTYPO>[ELEMTYPO]
6126 <dd>Robert Bringhurst. <cite>The Elements of Typographic Style, Version
6127 3.1.</cite> Hartley & Marks. 2005. ISBN 0-88179-206-3.</dd>
6128 <!---->
6130 <dt id=LANGCULTTYPE>[LANGCULTTYPE]
6132 <dd>John D. Berry, Ed. <cite>Language Culture Type.</cite> Graphis. 2001.
6133 ISBN 1-932026-01-0.</dd>
6134 <!---->
6136 <dt id=OPENTYPE-FONT-GUIDE>[OPENTYPE-FONT-GUIDE]
6138 <dd><a
6139 href="https://www.fontfont.com/staticcontent/downloads/FF_OT_User_Guide.pdf"><cite>OpenType
6140 User Guide.</cite></a> FontShop International. URL: <a
6141 href="https://www.fontfont.com/staticcontent/downloads/FF_OT_User_Guide.pdf">https://www.fontfont.com/staticcontent/downloads/FF_OT_User_Guide.pdf</a>
6142 </dd>
6143 <!---->
6145 <dt id=RASTER-TRAGEDY>[RASTER-TRAGEDY]
6147 <dd>Beat Stamm. <a href="http://www.rastertragedy.com/"><cite>The Raster
6148 Tragedy at Low-Resolution Revisited.</cite></a> 7 December 2011. URL: <a
6149 href="http://www.rastertragedy.com/">http://www.rastertragedy.com/</a></dd>
6150 <!---->
6152 <dt id=WINDOWS-GLYPH-PROC>[WINDOWS-GLYPH-PROC]
6154 <dd>John Hudson. <a
6155 href="http://www.microsoft.com/typography/developers/opentype/default.htm"><cite>Windows
6156 Glyph Processing.</cite></a> Microsoft Typogrraphy. URL: <a
6157 href="http://www.microsoft.com/typography/developers/opentype/default.htm">http://www.microsoft.com/typography/developers/opentype/default.htm</a>
6158 </dd>
6159 <!---->
6160 </dl>
6161 <!--end-informative-->
6162 <!--{{ARABIC-TYPO}}-->
6163 <!--{{CJKV-INFO-PROCESSING}}-->
6164 <!--{{DIGITAL-TYPOGRAPHY}}-->
6165 <!--{{DOM-LEVEL-2-STYLE}}-->
6166 <!--{{ELEMTYPO}}-->
6167 <!--{{LANGCULTTYPE}}-->
6168 <!--{{OPENTYPE-FONT-GUIDE}}-->
6169 <!--{{RASTER-TRAGEDY}}-->
6170 <!--{{WINDOWS-GLYPH-PROC}}-->
6171 <!--{{CHARMOD-NORM}}-->
6172 <!--{{AAT-FEATURES}}-->
6173 <!--{{CSS3-CONDITIONAL}}-->
6174 <!--{{CSS3TEXT}}-->
6176 <h2 class=no-num id=index>Index</h2>
6177 <!--begin-index-->
6179 <ul class=indexlist>
6180 <li><absolute-size>, <a href="#ltabsolute-sizegt"
6181 title="<absolute-size>"><strong>3.5</strong></a>
6183 <li><var><common-lig-values></var>, <a href="#ltcommon-lig-values"
6184 title="<common-lig-values>"><strong>6.4</strong></a>
6186 <li><var><contextual-alt-values></var>, <a
6187 href="#ltcontextual-alt-valuesgt"
6188 title="<contextual-alt-values>"><strong>6.4</strong></a>
6190 <li><var><discretionary-lig-values></var>, <a
6191 href="#ltdiscretionary-lig-values"
6192 title="<discretionary-lig-values>"><strong>6.4</strong></a>
6194 <li><var><east-asian-variant-values></var>, <a
6195 href="#lteast-asian-variant-valuesgt"
6196 title="<east-asian-variant-values>"><strong>6.10</strong></a>
6198 <li><var><east-asian-width-values></var>, <a
6199 href="#lteast-asian-width-valuesgt"
6200 title="<east-asian-width-values>"><strong>6.10</strong></a>
6202 <li><var><feature-ident></var>, <a href="#ltfeature-identgt"
6203 title="<feature-ident>"><strong>6.9</strong></a>
6205 <li><var><feature-index></var>, <a href="#ltfeature-indexgt"
6206 title="<feature-index>"><strong>6.9</strong></a>
6208 <li><var><feature-tag-value></var>, <a href="#ltfeature-tag-valuegt"
6209 title="<feature-tag-value>"><strong>6.12</strong></a>
6211 <li><var><feature-type></var>, <a href="#ltfeature-typegt"
6212 title="<feature-type>"><strong>6.9</strong></a>
6214 <li><font-description>, <a href="#ltfont-descriptiongt"
6215 title="<font-description>"><strong>4.1</strong></a>
6217 <li><font-face-name>, <a href="#ltfont-face-namegt"
6218 title="<font-face-name>"><strong>4.3</strong></a>
6220 <li><var><font-family></var>, <a href="#ltfont-familygt"
6221 title="<font-family>"><strong>6.9</strong></a>
6223 <li><var><font-variant-css21></var>, <a
6224 href="#ltfont-variant-css21gt"
6225 title="<font-variant-css21>"><strong>3.7</strong></a>
6227 <li><var><historical-lig-values></var>, <a
6228 href="#lthistorical-lig-values"
6229 title="<historical-lig-values>"><strong>6.4</strong></a>
6231 <li><length>, <a href="#ltlengthgt" title="<length>">3.5</a>
6233 <li><number>, <a href="#ltnumbergt" title="<number>">3.6</a>
6235 <li><var><numeric-figure-values></var>, <a
6236 href="#ltnumeric-figure-valuesgt"
6237 title="<numeric-figure-values>"><strong>6.7</strong></a>
6239 <li><var><numeric-fraction-values></var>, <a
6240 href="#ltnumeric-fraction-valuesgt"
6241 title="<numeric-fraction-values>"><strong>6.7</strong></a>
6243 <li><var><numeric-spacing-values></var>, <a
6244 href="#ltnumeric-spacing-valuesgt"
6245 title="<numeric-spacing-values>"><strong>6.7</strong></a>
6247 <li><percentage>, <a href="#ltpercentagegt-"
6248 title="<percentage>">3.5</a>
6250 <li><relative-size>, <a href="#ltrelative-sizegt"
6251 title="<relative-size>"><strong>3.5</strong></a>
6253 <li><urange>, <a href="#lturangegt"
6254 title="<urange>"><strong>4.5</strong></a>
6256 <li>@font-face, <a href="#font-face"
6257 title="@font-face"><strong>4.1</strong></a>, <a href="#font-face0"
6258 title="@font-face">4.1</a>, <a href="#font-face1"
6259 title="@font-face">4.3</a>
6261 <li>all-petite-caps, <a href="#all-petite-caps"
6262 title=all-petite-caps><strong>6.6</strong></a>
6264 <li>all-small-caps, <a href="#all-small-caps"
6265 title=all-small-caps><strong>6.6</strong></a>
6267 <li>annotation, <a href="#annotationltfeature-value-namegt"
6268 title=annotation><strong>6.8</strong></a>
6270 <li>aspect value, <a href="#aspect-value0" title="aspect
6271 value"><strong>3.6</strong></a>
6273 <li>at-rules, <a href="#at-rule" title=at-rules>4.1</a>
6275 <li>authoring tool, <a href="#authoring-tool" title="authoring
6276 tool"><strong>#</strong></a>
6278 <li>character map, <a href="#character-map" title="character
6279 map"><strong>5.2</strong></a>
6281 <li>character-variant, <a href="#character-variantltfeature-value-namegt"
6282 title=character-variant><strong>6.8</strong></a>
6284 <li>common-ligatures, <a href="#common-ligatures"
6285 title=common-ligatures><strong>6.4</strong></a>
6287 <li>contextual, <a href="#contextual"
6288 title=contextual><strong>6.4</strong></a>
6290 <li>CSSFontFaceRule, <a href="#cssfontfacerule"
6291 title=CSSFontFaceRule><strong>8.1</strong></a>
6293 <li>CSSFontFeatureValuesRule, <a href="#cssfontfeaturevaluesrule"
6294 title=CSSFontFeatureValuesRule><strong>8.2</strong></a>
6296 <li>cursive, definition of, <a href="#cursive0" title="cursive, definition
6297 of"><strong>#</strong></a>
6299 <li>default face, <a href="#default-face" title="default
6300 face"><strong>5.2</strong></a>
6302 <li>diagonal-fractions, <a href="#diagonal-fractions"
6303 title=diagonal-fractions><strong>6.7</strong></a>
6305 <li>discretionary-ligatures, <a href="#discretionary-ligatures"
6306 title=discretionary-ligatures><strong>6.4</strong></a>
6308 <li>fantasy, definition of, <a href="#fantasy0" title="fantasy, definition
6309 of"><strong>#</strong></a>
6311 <li>fire a font load event, <a href="#fire-a-font-load-event" title="fire
6312 a font load event"><strong>9.2.1</strong></a>
6314 <li>font, <a href="#propdef-font" title=font><strong>3.7</strong></a>
6316 <li>font load, <a href="#font-load" title="font
6317 load"><strong>9.2</strong></a>
6319 <li>font-family, <a href="#descdef-font-family"
6320 title=font-family><strong>4.2</strong></a>, <a
6321 href="#propdef-font-family" title=font-family><strong>3.1</strong></a>
6323 <li>font-feature-settings, <a href="#propdef-font-feature-settings"
6324 title=font-feature-settings><strong>6.12</strong></a>
6326 <li>font-feature-settings (descriptor), <a
6327 href="#descdef-font-feature-settings" title="font-feature-settings
6328 (descriptor)"><strong>4.6</strong></a>
6330 <li>font-kerning, <a href="#propdef-font-kerning"
6331 title=font-kerning><strong>6.3</strong></a>
6333 <li>font-language-override, <a href="#propdef-font-language-override"
6334 title=font-language-override><strong>6.13</strong></a>
6336 <li>font-size, <a href="#propdef-font-size"
6337 title=font-size><strong>3.5</strong></a>
6339 <li>font-size-adjust, <a href="#propdef-font-size-adjust"
6340 title=font-size-adjust><strong>3.6</strong></a>
6342 <li>font-stretch, <a href="#propdef-font-stretch"
6343 title=font-stretch><strong>3.3</strong></a>
6345 <li>font-stretch (descriptor), <a href="#descdef-font-stretch"
6346 title="font-stretch (descriptor)"><strong>4.4</strong></a>
6348 <li>font-style, <a href="#propdef-font-style"
6349 title=font-style><strong>3.4</strong></a>
6351 <li>font-style (descriptor), <a href="#descdef-font-style"
6352 title="font-style (descriptor)"><strong>4.4</strong></a>
6354 <li>font-synthesis, <a href="#propdef-font-synthesis"
6355 title=font-synthesis><strong>3.8</strong></a>
6357 <li>font-variant, <a href="#propdef-font-variant"
6358 title=font-variant><strong>6.11</strong></a>
6360 <li>font-variant (descriptor), <a href="#descdef-font-variant"
6361 title="font-variant (descriptor)"><strong>4.6</strong></a>
6363 <li>font-variant-alternates, <a href="#propdef-font-variant-alternates"
6364 title=font-variant-alternates><strong>6.8</strong></a>
6366 <li>font-variant-caps, <a href="#propdef-font-variant-caps"
6367 title=font-variant-caps><strong>6.6</strong></a>
6369 <li>font-variant-east-asian, <a href="#propdef-font-variant-east-asian"
6370 title=font-variant-east-asian><strong>6.10</strong></a>
6372 <li>font-variant-ligatures, <a href="#propdef-font-variant-ligatures"
6373 title=font-variant-ligatures><strong>6.4</strong></a>
6375 <li>font-variant-numeric, <a href="#propdef-font-variant-numeric"
6376 title=font-variant-numeric><strong>6.7</strong></a>
6378 <li>font-variant-position, <a href="#propdef-font-variant-position"
6379 title=font-variant-position><strong>6.5</strong></a>
6381 <li>font-weight, <a href="#propdef-font-weight"
6382 title=font-weight><strong>3.2</strong></a>
6384 <li>font-weight (descriptor), <a href="#descdef-font-weight"
6385 title="font-weight (descriptor)"><strong>4.4</strong></a>
6387 <li>full-width, <a href="#full-width"
6388 title=full-width><strong>6.10</strong></a>
6390 <li>historical-forms, <a href="#historical-forms"
6391 title=historical-forms><strong>6.8</strong></a>
6393 <li>historical-ligatures, <a href="#historical-ligatures"
6394 title=historical-ligatures><strong>6.4</strong></a>
6396 <li>jis04, <a href="#jis04" title=jis04><strong>6.10</strong></a>
6398 <li>jis78, <a href="#jis78" title=jis78><strong>6.10</strong></a>
6400 <li>jis83, <a href="#jis83" title=jis83><strong>6.10</strong></a>
6402 <li>jis90, <a href="#jis90" title=jis90><strong>6.10</strong></a>
6404 <li>lining-nums, <a href="#lining-nums"
6405 title=lining-nums><strong>6.7</strong></a>
6407 <li>monospace, definition of, <a href="#monospace0" title="monospace,
6408 definition of"><strong>#</strong></a>
6410 <li>no-common-ligatures, <a href="#no-common-ligatures"
6411 title=no-common-ligatures><strong>6.4</strong></a>
6413 <li>no-contextual, <a href="#no-contextual"
6414 title=no-contextual><strong>6.4</strong></a>
6416 <li>no-discretionary-ligatures, <a href="#no-discretionary-ligatures"
6417 title=no-discretionary-ligatures><strong>6.4</strong></a>
6419 <li>no-historical-ligatures, <a href="#no-historical-ligatures"
6420 title=no-historical-ligatures><strong>6.4</strong></a>
6422 <li>normal, <a href="#normal" title=normal><strong>6.6</strong></a>, <a
6423 href="#normal0" title=normal><strong>6.7</strong></a>, <a href="#normal1"
6424 title=normal><strong>6.8</strong></a>, <a href="#normal2"
6425 title=normal><strong>6.10</strong></a>
6427 <li>oldstyle-nums, <a href="#oldstyle-nums"
6428 title=oldstyle-nums><strong>6.7</strong></a>
6430 <li>ordinal, <a href="#ordinal" title=ordinal><strong>6.7</strong></a>
6432 <li>ornaments, <a href="#ornamentsltfeature-value-namegt"
6433 title=ornaments><strong>6.8</strong></a>
6435 <li>petite-caps, <a href="#petite-caps"
6436 title=petite-caps><strong>6.6</strong></a>
6438 <li>proportional-nums, <a href="#proportional-nums"
6439 title=proportional-nums><strong>6.7</strong></a>
6441 <li>proportional-width, <a href="#proportional-width"
6442 title=proportional-width><strong>6.10</strong></a>
6444 <li>renderer, <a href="#renderer" title=renderer><strong>#</strong></a>
6446 <li>ruby, <a href="#ruby" title=ruby><strong>6.10</strong></a>
6448 <li>sans-serif, definition of, <a href="#sans-serif0" title="sans-serif,
6449 definition of"><strong>#</strong></a>
6451 <li>serif, definition of, <a href="#serif0" title="serif, definition
6452 of"><strong>#</strong></a>
6454 <li>simplified, <a href="#simplified"
6455 title=simplified><strong>6.10</strong></a>
6457 <li>slashed-zero, <a href="#slashed-zero"
6458 title=slashed-zero><strong>6.7</strong></a>
6460 <li>small-caps, <a href="#small-caps"
6461 title=small-caps><strong>6.6</strong></a>
6463 <li>src, <a href="#descdef-src" title=src><strong>4.3</strong></a>
6465 <li>stacked-fractions, <a href="#stacked-fractions"
6466 title=stacked-fractions><strong>6.7</strong></a>
6468 <li>style sheet
6469 <ul>
6470 <li>as conformance class, <a href="#style-sheet" title="style sheet, as
6471 conformance class"><strong>#</strong></a>
6472 </ul>
6474 <li>styleset, <a href="#stylesetltfeature-value-namegt"
6475 title=styleset><strong>6.8</strong></a>
6477 <li>stylistic, <a href="#stylisticltfeature-value-namegt"
6478 title=stylistic><strong>6.8</strong></a>
6480 <li>swash, <a href="#swashltfeature-value-namegt"
6481 title=swash><strong>6.8</strong></a>
6483 <li>tabular-nums, <a href="#tabular-nums"
6484 title=tabular-nums><strong>6.7</strong></a>
6486 <li>titling-caps, <a href="#titling-caps"
6487 title=titling-caps><strong>6.6</strong></a>
6489 <li>traditional, <a href="#traditional"
6490 title=traditional><strong>6.10</strong></a>
6492 <li>unicase, <a href="#unicase" title=unicase><strong>6.6</strong></a>
6494 <li>unicode-range, <a href="#descdef-unicode-range"
6495 title=unicode-range><strong>4.5</strong></a>
6497 <li>weight, <a href="#weight" title=weight><strong>2</strong></a>
6499 <li>width, <a href="#width" title=width><strong>2</strong></a>
6500 </ul>
6501 <!--end-index-->
6503 <h2 class=no-num id=property-index>Property index</h2>
6504 <!--begin-properties-->
6506 <table class=proptable>
6507 <thead>
6508 <tr>
6509 <th>Property
6511 <th>Values
6513 <th>Initial
6515 <th>Applies to
6517 <th>Inh.
6519 <th>Percentages
6521 <th>Media
6523 <tbody>
6524 <tr>
6525 <th><a class=property href="#propdef-font">font</a>
6527 <td>[ [ <‘font-style’> || <font-variant-css21> ||
6528 <‘font-weight’> || <‘font-stretch’> ]?
6529 <‘font-size’> [ / <‘line-height’> ]?
6530 <‘font-family’> ] | caption | icon | menu | message-box |
6531 small-caption | status-bar
6533 <td>see individual properties
6535 <td>all elements
6537 <td>yes
6539 <td>see individual properties
6541 <td>visual
6543 <tr>
6544 <th><a class=property href="#descdef-font-family">font-family</a>
6546 <td>[ <family-name> | <generic-family> ]#
6548 <td>depends on user agent
6550 <td>all elements
6552 <td>yes
6554 <td>N/A
6556 <td>visual
6558 <tr>
6559 <th><a class=property
6560 href="#propdef-font-feature-settings">font-feature-settings</a>
6562 <td>normal | <feature-tag-value>#
6564 <td>normal
6566 <td>all elements
6568 <td>yes
6570 <td>N/A
6572 <td>visual
6574 <tr>
6575 <th><a class=property href="#propdef-font-kerning">font-kerning</a>
6577 <td>auto | normal | none
6579 <td>auto
6581 <td>all elements
6583 <td>yes
6585 <td>N/A
6587 <td>visual
6589 <tr>
6590 <th><a class=property
6591 href="#propdef-font-language-override">font-language-override</a>
6593 <td>normal | <string>
6595 <td>normal
6597 <td>all elements
6599 <td>yes
6601 <td>N/A
6603 <td>visual
6605 <tr>
6606 <th><a class=property href="#propdef-font-size">font-size</a>
6608 <td><absolute-size> | <relative-size> | <length> |
6609 <percentage>
6611 <td>medium
6613 <td>all elements
6615 <td>yes
6617 <td>refer to parent element's font size
6619 <td>visual
6621 <tr>
6622 <th><a class=property
6623 href="#propdef-font-size-adjust">font-size-adjust</a>
6625 <td>none | auto | <number>
6627 <td>none
6629 <td>all elements
6631 <td>yes
6633 <td>N/A
6635 <td>visual
6637 <tr>
6638 <th><a class=property href="#propdef-font-stretch">font-stretch</a>
6640 <td>normal | ultra-condensed | extra-condensed | condensed |
6641 semi-condensed | semi-expanded | expanded | extra-expanded |
6642 ultra-expanded
6644 <td>normal
6646 <td>all elements
6648 <td>yes
6650 <td>N/A
6652 <td>visual
6654 <tr>
6655 <th><a class=property href="#propdef-font-style">font-style</a>
6657 <td>normal | italic | oblique
6659 <td>normal
6661 <td>all elements
6663 <td>yes
6665 <td>N/A
6667 <td>visual
6669 <tr>
6670 <th><a class=property href="#propdef-font-synthesis">font-synthesis</a>
6672 <td>none | [ weight || style ]
6674 <td>weight style
6676 <td>all elements
6678 <td>yes
6680 <td>N/A
6682 <td>visual
6684 <tr>
6685 <th><a class=property href="#propdef-font-variant">font-variant</a>
6687 <td>normal | none | [ <common-lig-values> ||
6688 <discretionary-lig-values> || <historical-lig-values> ||
6689 <contextual-alt-values> || stylistic(<feature-value-name>)
6690 || historical-forms || styleset(<feature-value-name>#) ||
6691 character-variant(<feature-value-name>#) ||
6692 swash(<feature-value-name>) ||
6693 ornaments(<feature-value-name>) ||
6694 annotation(<feature-value-name>) || [ small-caps | all-small-caps
6695 | petite-caps | all-petite-caps | unicase | titling-caps ] ||
6696 <numeric-figure-values> || <numeric-spacing-values> ||
6697 <numeric-fraction-values> || ordinal || slashed-zero ||
6698 <east-asian-variant-values> || <east-asian-width-values> ||
6699 ruby ]
6701 <td>normal
6703 <td>all elements
6705 <td>yes
6707 <td>see individual properties
6709 <td>visual
6711 <tr>
6712 <th><a class=property
6713 href="#propdef-font-variant-alternates">font-variant-alternates</a>
6715 <td>normal | [ stylistic(<feature-value-name>) || historical-forms
6716 || styleset(<feature-value-name>#) ||
6717 character-variant(<feature-value-name>#) ||
6718 swash(<feature-value-name>) ||
6719 ornaments(<feature-value-name>) ||
6720 annotation(<feature-value-name>) ]
6722 <td>normal
6724 <td>all elements
6726 <td>yes
6728 <td>N/A
6730 <td>visual
6732 <tr>
6733 <th><a class=property
6734 href="#propdef-font-variant-caps">font-variant-caps</a>
6736 <td>normal | small-caps | all-small-caps | petite-caps | all-petite-caps
6737 | unicase | titling-caps
6739 <td>normal
6741 <td>all elements
6743 <td>yes
6745 <td>N/A
6747 <td>visual
6749 <tr>
6750 <th><a class=property
6751 href="#propdef-font-variant-east-asian">font-variant-east-asian</a>
6753 <td>normal | [ <east-asian-variant-values> ||
6754 <east-asian-width-values> || ruby ]
6756 <td>normal
6758 <td>all elements
6760 <td>yes
6762 <td>N/A
6764 <td>visual
6766 <tr>
6767 <th><a class=property
6768 href="#propdef-font-variant-ligatures">font-variant-ligatures</a>
6770 <td>normal | none | [ <common-lig-values> ||
6771 <discretionary-lig-values> || <historical-lig-values> ||
6772 <contextual-alt-values> ]
6774 <td>normal
6776 <td>all elements
6778 <td>yes
6780 <td>N/A
6782 <td>visual
6784 <tr>
6785 <th><a class=property
6786 href="#propdef-font-variant-numeric">font-variant-numeric</a>
6788 <td>normal | [ <numeric-figure-values> ||
6789 <numeric-spacing-values> || <numeric-fraction-values> ||
6790 ordinal || slashed-zero ]
6792 <td>normal
6794 <td>all elements
6796 <td>yes
6798 <td>N/A
6800 <td>visual
6802 <tr>
6803 <th><a class=property
6804 href="#propdef-font-variant-position">font-variant-position</a>
6806 <td>normal | sub | super
6808 <td>normal
6810 <td>all elements
6812 <td>yes
6814 <td>N/A
6816 <td>visual
6818 <tr>
6819 <th><a class=property href="#propdef-font-weight">font-weight</a>
6821 <td>normal | bold | bolder | lighter | 100 | 200 | 300 | 400 | 500 | 600
6822 | 700 | 800 | 900
6824 <td>normal
6826 <td>all elements
6828 <td>yes
6830 <td>N/A
6832 <td>visual
6833 </table>
6834 <!--end-properties-->
6835 <!--begin-descriptors-->
6837 <table class=proptable>
6838 <thead>
6839 <tr>
6840 <th>Descriptor
6842 <th>Value
6844 <th>Initial
6846 <th>Percentages
6848 <th>Media
6850 <tbody>
6851 <tr>
6852 <th><a class=property href="#descdef-font-family">font-family</a>
6854 <td><family-name>
6856 <td>N/A
6858 <tr>
6859 <th><a class=property
6860 href="#propdef-font-feature-settings">font-feature-settings</a>
6862 <td>normal | <feature-tag-value>#
6864 <td>normal
6866 <tr>
6867 <th><a class=property href="#propdef-font-stretch">font-stretch</a>
6869 <td>normal | ultra-condensed | extra-condensed | condensed |
6870 semi-condensed | semi-expanded | expanded | extra-expanded |
6871 ultra-expanded
6873 <td>normal
6875 <tr>
6876 <th><a class=property href="#propdef-font-style">font-style</a>
6878 <td>normal | italic | oblique
6880 <td>normal
6882 <tr>
6883 <th><a class=property href="#propdef-font-variant">font-variant</a>
6885 <td>normal | [ <common-lig-values> ||
6886 <discretionary-lig-values> || <historical-lig-values> ||
6887 <contextual-alt-values> || stylistic(<feature-value-name>)
6888 || historical-forms || styleset(<feature-value-name>#) ||
6889 character-variant(<feature-value-name>#) ||
6890 swash(<feature-value-name>) ||
6891 ornaments(<feature-value-name>) ||
6892 annotation(<feature-value-name>) || [ small-caps | all-small-caps
6893 | petite-caps | all-petite-caps | unicase | titling-caps ] ||
6894 <numeric-figure-values> || <numeric-spacing-values> ||
6895 <numeric-fraction-values> || ordinal || slashed-zero ||
6896 <east-asian-variant-values> || <east-asian-width-values> ||
6897 ruby ]
6899 <td>normal
6901 <tr>
6902 <th><a class=property href="#propdef-font-weight">font-weight</a>
6904 <td>normal | bold | 100 | 200 | 300 | 400 | 500 | 600 | 700 | 800 | 900
6906 <td>normal
6908 <tr>
6909 <th><a class=property href="#descdef-src">src</a>
6911 <td>[ <uri> [format(<string>#)]? | <font-face-name> ]#
6913 <td>N/A
6915 <tr>
6916 <th><a class=property href="#descdef-unicode-range">unicode-range</a>
6918 <td><urange>#
6920 <td>U+0-10FFFF
6921 </table>
6922 <!--end-descriptors-->
6923 <script type="text/javascript">
6924 window.onload = function () {
6925 if (!("devicePixelRatio" in window && window.devicePixelRatio > 1)) return;
6926 var i, hiresElements = document.getElementsByClassName("hires");
6927 for (i = 0; i < hiresElements.length; i++) {
6928 var h = hiresElements[i];
6929 if (h.tagName != "IMG") continue;
6930 var src = h.getAttribute("src");
6931 var src2x = src.replace(/\.\w+$/, function(m) { return "@2x" + m; });
6932 h.src = src2x;
6933 }
6934 }
6935 </script>
6936 </html>
6937 <!-- Keep this comment at the end of the file
6938 Local variables:
6939 mode: sgml
6940 sgml-declaration:"~/SGML/HTML4.decl"
6941 sgml-default-doctype-name:"html"
6942 sgml-minimize-attributes:t
6943 sgml-nofill-elements:("pre" "style" "br")
6944 sgml-live-element-indicator:t
6945 sgml-omittag:nil
6946 sgml-shorttag:nil
6947 sgml-namecase-general:t
6948 sgml-general-insert-case:lower
6949 sgml-always-quote-attributes:t
6950 sgml-indent-step:nil
6951 sgml-indent-data:t
6952 sgml-parent-document:nil
6953 sgml-exposed-tags:nil
6954 sgml-local-catalogs:nil
6955 sgml-local-ecat-files:nil
6956 End:
6957 -->
6958 <!--
6960 to do:
6962 - wording of OpenType family name handling
6963 - handling combining sequences in the font matching algorithm
6964 - fix-up fi ligature example
6966 -->