Mon, 20 May 2013 17:48:43 +0800
[css-fonts] more editorial revisions
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-ED.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=editors-draft-20-may-2013>Editor's Draft 20
116 May 2013</h2>
118 <dl id=authors>
119 <dt>This version:
121 <dd><a
122 href="http://dev.w3.org/csswg/css-fonts/">http://dev.w3.org/csswg/css-fonts/</a>
123 <!-- <dd><a href="http://www.w3.org/TR/2013/ED-css3-fonts-20130520/">http://www.w3.org/TR/2013/ED-css3-fonts-20130520/</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/css-fonts/">http://dev.w3.org/csswg/css-fonts/</a>
135 (<a
136 href="https://dvcs.w3.org/hg/csswg/log/tip/css-fonts/Fonts.html">change
137 log</a>)
139 <dt>Previous version:
141 <dd><a
142 href="http://www.w3.org/TR/2013/WD-css3-fonts-20130212/">http://www.w3.org/TR/2013/WD-css3-fonts-20130212/</a>
144 <dt>Issues List:
146 <dd><a href="http://www.w3.org/Style/CSS/Tracker/products/18">CSS3 Fonts
147 issues in Tracker</a>
149 <dd><a
150 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
151 Fonts issues in Bugzilla</a>
153 <dt>Discussion:
155 <dd><a
156 href="mailto:www-style@w3.org?subject=%5Bcss-fonts%5D%20feedback">www-style@w3.org</a>
157 with subject line “<kbd>[css-fonts] <var>… message topic
158 …</var></kbd>” (<a
159 href="http://lists.w3.org/Archives/Public/www-style/"
160 rel=discussion>archives</a>)
162 <dt>Editor:
164 <dd><a href="mailto:jdaggett@mozilla.com">John Daggett (Mozilla)</a>
165 </dl>
166 <!--begin-copyright-->
167 <p class=copyright><a
168 href="http://www.w3.org/Consortium/Legal/ipr-notice#Copyright"
169 rel=license>Copyright</a> © 2013 <a href="http://www.w3.org/"><abbr
170 title="World Wide Web Consortium">W3C</abbr></a><sup>®</sup> (<a
171 href="http://www.csail.mit.edu/"><abbr title="Massachusetts Institute of
172 Technology">MIT</abbr></a>, <a href="http://www.ercim.eu/"><abbr
173 title="European Research Consortium for Informatics and
174 Mathematics">ERCIM</abbr></a>, <a href="http://www.keio.ac.jp/">Keio</a>,
175 <a href="http://ev.buaa.edu.cn/">Beihang</a>), All Rights Reserved. W3C
176 <a
177 href="http://www.w3.org/Consortium/Legal/ipr-notice#Legal_Disclaimer">liability</a>,
178 <a
179 href="http://www.w3.org/Consortium/Legal/ipr-notice#W3C_Trademarks">trademark</a>
180 and <a
181 href="http://www.w3.org/Consortium/Legal/copyright-documents">document
182 use</a> rules apply.</p>
183 <!--end-copyright-->
184 <hr title="Separator for header">
185 </div>
187 <h2 class="no-num no-toc" id=abstract>Abstract</h2>
189 <p>This CSS3 module describes how font properties are specified and how
190 font resources are loaded dynamically. The contents of this specification
191 are a consolidation of content previously divided into <a
192 href="http://www.w3.org/TR/2002/WD-css3-fonts-20020802/">CSS3 Fonts</a>
193 and <a href="http://www.w3.org/TR/2002/WD-css3-webfonts-20020802/">CSS3
194 Web Fonts</a> modules. The description of font load events was moved into
195 the <a href="http://dev.w3.org/csswg/css3-font-load-events/">CSS3 Font
196 Load Events</a> module.
198 <h2 class="no-num no-toc" id=status>Status of this document</h2>
199 <!--begin-status-->
201 <p>This is a public copy of the editors' draft. It is provided for
202 discussion only and may change at any moment. Its publication here does
203 not imply endorsement of its contents by W3C. Don't cite this document
204 other than as work in progress.
206 <p>The (<a
207 href="http://lists.w3.org/Archives/Public/www-style/">archived</a>) public
208 mailing list <a
209 href="mailto:www-style@w3.org?Subject=%5Bcss3-fonts%5D%20PUT%20SUBJECT%20HERE">
210 www-style@w3.org</a> (see <a
211 href="http://www.w3.org/Mail/Request">instructions</a>) is preferred for
212 discussion of this specification. When sending e-mail, please put the text
213 “css3-fonts” in the subject, preferably like this:
214 “[<!---->css3-fonts<!---->] <em>…summary of comment…</em>”
216 <p>This document was produced by the <a
217 href="http://www.w3.org/Style/CSS/members">CSS Working Group</a> (part of
218 the <a href="http://www.w3.org/Style/">Style Activity</a>).
220 <p>This document was produced by a group operating under the <a
221 href="http://www.w3.org/Consortium/Patent-Policy-20040205/">5 February
222 2004 W3C Patent Policy</a>. W3C maintains a <a
223 href="http://www.w3.org/2004/01/pp-impl/32061/status"
224 rel=disclosure>public list of any patent disclosures</a> made in
225 connection with the deliverables of the group; that page also includes
226 instructions for disclosing a patent. An individual who has actual
227 knowledge of a patent which the individual believes contains <a
228 href="http://www.w3.org/Consortium/Patent-Policy-20040205/#def-essential">Essential
229 Claim(s)</a> must disclose the information in accordance with <a
230 href="http://www.w3.org/Consortium/Patent-Policy-20040205/#sec-Disclosure">section
231 6 of the W3C Patent Policy</a>.</p>
232 <!--end-status-->
233 <!--
234 <h3 class="no-num no-toc" id="atrisk">Features at risk</h3>
236 <p>The following features are at risk and may be removed when exiting CR:</p>
238 <ul>
239 </ul>
240 -->
242 <h2 class="no-num no-toc" id=contents>Table of contents</h2>
243 <!--begin-toc-->
245 <ul class=toc>
246 <li><a href="#introduction"><span class=secno>1 </span>Introduction</a>
248 <li><a href="#typography-background"><span class=secno>2 </span>Typography
249 Background</a>
251 <li><a href="#basic-font-props"><span class=secno>3 </span>Basic Font
252 Properties</a>
253 <ul class=toc>
254 <li><a href="#font-family-prop"><span class=secno>3.1 </span>Font
255 family: the font-family property</a>
256 <ul class=toc>
257 <li><a href="#generic-font-families"><span class=secno>3.1.1
258 </span>Generic font families</a>
259 </ul>
261 <li><a href="#font-weight-prop"><span class=secno>3.2 </span>Font
262 weight: the font-weight property</a>
264 <li><a href="#font-stretch-prop"><span class=secno>3.3 </span>Font
265 width: the font-stretch property</a>
267 <li><a href="#font-style-prop"><span class=secno>3.4 </span>Font style:
268 the font-style property</a>
270 <li><a href="#font-size-prop"><span class=secno>3.5 </span>Font size:
271 the font-size property</a>
273 <li><a href="#font-size-adjust-prop"><span class=secno>3.6
274 </span>Relative sizing: the font-size-adjust property</a>
276 <li><a href="#font-prop"><span class=secno>3.7 </span>Shorthand font
277 property: the font property</a>
279 <li><a href="#font-synthesis-prop"><span class=secno>3.8
280 </span>Controlling synthetic faces: the font-synthesis property</a>
281 </ul>
283 <li><a href="#font-resources"><span class=secno>4 </span>Font
284 Resources</a>
285 <ul class=toc>
286 <li><a href="#font-face-rule"><span class=secno>4.1 </span>The
287 <code>@font-face</code> rule</a>
289 <li><a href="#font-family-desc"><span class=secno>4.2 </span>Font
290 family: the font-family descriptor</a>
292 <li><a href="#src-desc"><span class=secno>4.3 </span>Font reference: the
293 src descriptor</a>
295 <li><a href="#font-prop-desc"><span class=secno>4.4 </span>Font property
296 descriptors: the font-style, font-weight, font-stretch descriptors</a>
298 <li><a href="#unicode-range-desc"><span class=secno>4.5 </span>Character
299 range: the unicode-range descriptor</a>
301 <li><a href="#font-rend-desc"><span class=secno>4.6 </span>Font
302 features: the font-variant and font-feature-settings descriptors</a>
304 <li><a href="#font-face-loading"><span class=secno>4.7 </span>Font
305 loading guidelines</a>
307 <li><a href="#same-origin-restriction"><span class=secno>4.8
308 </span>Same-origin restriction for fonts</a>
309 <ul class=toc>
310 <li><a href="#default-same-origin-restriction"><span class=secno>4.8.1
311 </span>Default same-origin restriction</a>
313 <li><a href="#allowing-cross-origin-font-loading"><span
314 class=secno>4.8.2 </span>Allowing cross-origin font loading</a>
315 </ul>
316 </ul>
318 <li><a href="#font-matching-algorithm"><span class=secno>5 </span>Font
319 Matching Algorithm</a>
320 <ul class=toc>
321 <li><a href="#font-family-casing"><span class=secno>5.1 </span>Case
322 sensitivity of font family names</a>
324 <li><a href="#font-style-matching"><span class=secno>5.2 </span>Matching
325 font styles</a>
327 <li><a href="#cluster-matching"><span class=secno>5.3 </span>Cluster
328 matching</a>
330 <li><a href="#char-handling-issues"><span class=secno>5.4
331 </span>Character handling issues</a>
333 <li><a href="#font-matching-changes"><span class=secno>5.5 </span>Font
334 matching changes since CSS 2.1</a>
336 <li><a href="#font-matching-examples"><span class=secno>5.6 </span>Font
337 matching examples</a>
338 </ul>
340 <li><a href="#font-rend-props"><span class=secno>6 </span>Font Feature
341 Properties</a>
342 <ul class=toc>
343 <li><a href="#glyph-selection-positioning"><span class=secno>6.1
344 </span>Glyph selection and positioning</a>
346 <li><a href="#language-specific-support"><span class=secno>6.2
347 </span>Language-specific display</a>
349 <li><a href="#font-kerning-prop"><span class=secno>6.3 </span>Kerning:
350 the font-kerning property</a>
352 <li><a href="#font-variant-ligatures-prop"><span class=secno>6.4
353 </span>Ligatures: the font-variant-ligatures property</a>
355 <li><a href="#font-variant-position-prop"><span class=secno>6.5
356 </span>Subscript and superscript forms: the font-variant-position
357 property</a>
359 <li><a href="#font-variant-caps-prop"><span class=secno>6.6
360 </span>Capitalization: the font-variant-caps property</a>
362 <li><a href="#font-variant-numeric-prop"><span class=secno>6.7
363 </span>Numerical formatting: the font-variant-numeric property</a>
365 <li><a href="#font-variant-alternates-prop"><span class=secno>6.8
366 </span>Alternates and swashes: the font-variant-alternates property</a>
369 <li><a href="#font-feature-values"><span class=secno>6.9 </span>Defining
370 font specific alternates: the <code>@font-feature-values</code>
371 rule</a>
373 <li><a href="#font-variant-east-asian-prop"><span class=secno>6.10
374 </span>East Asian text rendering: the font-variant-east-asian
375 property</a>
377 <li><a href="#font-variant-prop"><span class=secno>6.11 </span>Overall
378 shorthand for font rendering: the font-variant property</a>
380 <li><a href="#font-feature-settings-prop"><span class=secno>6.12
381 </span>Low-level font feature settings control: the
382 font-feature-settings property</a>
384 <li><a href="#font-language-override-prop"><span class=secno>6.13
385 </span>Font language override: the font-language-override property</a>
386 </ul>
388 <li><a href="#font-feature-resolution"><span class=secno>7 </span>Font
389 Feature Resolution </a>
390 <ul class=toc>
391 <li><a href="#default-features"><span class=secno>7.1 </span>Default
392 features</a>
394 <li><a href="#feature-precedence"><span class=secno>7.2 </span>Feature
395 precedence</a>
397 <li><a href="#feature-precedence-examples"><span class=secno>7.3
398 </span>Feature precedence examples</a>
399 </ul>
401 <li><a href="#object-model"><span class=secno>8 </span>Object Model</a>
402 <ul class=toc>
403 <li><a href="#om-fontface"><span class=secno>8.1 </span>The
404 <code>CSSFontFaceRule</code> interface</a>
406 <li><a href="#om-fontfeaturevalues"><span class=secno>8.2 </span>The
407 <code>CSSFontFeatureValuesRule</code> interface</a>
408 </ul>
410 <li class=no-num><a href="#platform-props-to-css">Appendix A: Mapping
411 platform font properties to CSS properties</a>
413 <li class=no-num><a href="#ch-ch-ch-changes">Changes</a>
414 <ul class=toc>
415 <li class=no-num><a href="#recent-changes"> Changes from the February
416 2013 CSS3 Fonts Working Draft</a>
417 </ul>
419 <li class=no-num><a href="#acknowledgments">Acknowledgments</a>
421 <li class=no-num><a href="#conformance"> Conformance</a>
422 <ul class=toc>
423 <li class=no-num><a href="#conventions"> Document Conventions</a>
425 <li class=no-num><a href="#conformance-classes"> Conformance Classes</a>
428 <li class=no-num><a href="#partial"> Partial Implementations</a>
430 <li class=no-num><a href="#experimental"> Experimental
431 Implementations</a>
433 <li class=no-num><a href="#testing"> Non-Experimental
434 Implementations</a>
435 </ul>
437 <li class=no-num><a href="#references">References</a>
438 <ul class=toc>
439 <li class=no-num><a href="#normative-references">Normative
440 References</a>
442 <li class=no-num><a href="#other-references">Other References</a>
443 </ul>
445 <li class=no-num><a href="#index">Index</a>
447 <li class=no-num><a href="#property-index">Property index</a>
448 </ul>
449 <!--end-toc-->
451 <h2 id=introduction><span class=secno>1 </span>Introduction</h2>
453 <p>A font provides a resource containing the visual representation of
454 characters. At the simplest level it contains information that maps
455 character codes to shapes (called glyphs) that represent these characters.
456 Fonts sharing a common design style are commonly grouped into font
457 families classified by a set of standard font properties. Within a family,
458 the shape displayed for a given character can vary by stroke weight, slant
459 or relative width, among others. An individual font face is described by a
460 unique combination of these properties. For a given range of text, CSS
461 font properties are used to select a font family and a specific font face
462 within that family to be used when rendering that text. As a simple
463 example, to use the bold form of Helvetica one could use:
465 <pre>body {
466 font-family: Helvetica;
467 font-weight: bold;
468 }</pre>
470 <p>Font resources may be installed locally on the system on which a user
471 agent is running or downloadable. For local font resources descriptive
472 information can be obtained directly from the font resource. For
473 downloadable font resources (sometimes referred to as web fonts), the
474 descriptive information is included with the reference to the font
475 resource.
477 <p>Families of fonts typically don't contain a single face for each
478 possible variation of font properties. The CSS font selection mechanism
479 describes how to match a given set of CSS font properties to a single font
480 face.
482 <h2 id=typography-background><span class=secno>2 </span>Typography
483 Background</h2>
485 <p><em>This section is non-normative.</em>
487 <p> Typographic traditions vary across the globe, so there is no unique way
488 to classify all fonts across languages and cultures. For even common Latin
489 letters, wide variations are possible:
491 <div class=figure><img alt="variations in glyphs for a single character"
492 src=aaaaaa.png>
493 <p class=caption>One character, many glyph variations
494 </div>
496 <p>Differences in the anatomy of letterforms is one way to distinguish
497 fonts. For Latin fonts, flourishes at the ends of a character's main
498 strokes, or serifs, can distinguish a font from those without. Similar
499 comparisons exist in non-Latin fonts between fonts with tapered strokes
500 and those using primarily uniform strokes:
502 <div class=figure><img alt="serif vs. non-serifs" src=serifvssansserif.png>
503 <p class=caption>Letterforms with and without serifs
504 </div>
506 <div class=figure><img alt="serif vs. non-serifs for japanese"
507 src=minchovsgothic.png>
508 <p class=caption>Similar groupings for Japanese typefaces
509 </div>
511 <p>Fonts contain letterforms and the data needed to map characters to these
512 letterforms. Often this may be a simple one-to-one mapping, but more
513 complex mappings are also possible. The use of combining diacritic marks
514 creates many variations for an underlying letterform:
516 <div class=figure><img alt="diacritic marks" src=aaaaaa-diacritics.png>
517 <p class=caption>Variations with diacritic marks
518 </div>
520 <p>A sequence of characters can be represented by a single glyph known as a
521 ligature:
523 <div class=figure><img alt="example of a fi ligature"
524 src=final-ligature.png>
525 <p class=caption>Ligature example
526 </div>
528 <p>Visual transformations based on textual context are often stylistic
529 option in European languages. They are required to correctly render
530 languages like Arabic, the lam and alef characters below <em>must</em> be
531 combined when they exist in sequence:
533 <div class=figure><img alt="lam alef ligature" src=lamaleflig.png>
534 <p class=caption>Required Arabic ligature
535 </div>
537 <p>The relative complexity of these shaping transformations requires
538 additional data within the font.
540 <p>Sets of font faces with various stylistic variations are often grouped
541 together into font families. In the simplest case a regular face is
542 supplemented with bold and italic faces, but much more extensive groupings
543 are possible. Variations in the thickness of letterform strokes, the <dfn
544 id=weight>weight</dfn>, and the overall proportions of the letterform, the
545 <dfn id=width>width</dfn>, are most common. In the example below, each
546 letter uses a different font face within the Univers font family. The
547 width used increases from top to bottom and the weight increases from left
548 to right:
550 <div class=figure><img alt="various width and weight variations within a
551 single family" src=weightwidthvariations.png>
552 <p class=caption>Weight and width variations within a single font family
553 </div>
555 <p>Creating fonts that support multiple scripts is a difficult task;
556 designers need to understand the cultural traditions surrounding the use
557 of type in different scripts and come up with letterforms that somehow
558 share a common theme. Many languages often share a common script and each
559 of these languages may have noticeable stylistic differences. For example,
560 the Arabic script is shared by Persian and Urdu and Cyrillic is used with
561 many languages, not just Russian.
563 <p>The character map of a font defines the mapping of characters to glyphs
564 for that font. If a document contains characters not supported by the
565 character maps of the fonts contained in a font family list, a user agent
566 may use a system font fallback procedure to locate an appropriate font
567 that does. If no appropriate font can be found, some form of "missing
568 glyph" character will be rendered by the user agent. System fallback can
569 occur when the specified list of font families does not include a font
570 that supports a given character.
572 <p>Although the character map of a font maps a given character to a glyph
573 for that character, modern font technologies such as OpenType and AAT
574 (Apple Advanced Typography) provide ways of mapping a character to
575 different glyphs based upon feature settings. Fonts in these formats allow
576 these features to be embedded in the font itself and controlled by
577 applications. Common typographic features which can be specified this way
578 include ligatures, swashes, contextual alternates, proportional and
579 tabular figures, and automatic fractions, to list just a few. For a visual
580 overview of OpenType features, see the <a href="#OPENTYPE-FONT-GUIDE"
581 rel=biblioentry>[OPENTYPE-FONT-GUIDE]<!--{{OPENTYPE-FONT-GUIDE}}--></a>.
583 <h2 id=basic-font-props><span class=secno>3 </span>Basic Font Properties</h2>
585 <p>The particular font face used to render a character is determined by the
586 font family and other font properties that apply to a given element. This
587 structure allows settings to be varied independent of each other.</p>
588 <!-- prop: font-family -->
590 <h3 id=font-family-prop><span class=secno>3.1 </span>Font family: the <a
591 href="#propdef-font-family">font-family</a> property</h3>
593 <table class=propdef id=namefont-familyvalue-ltfamily-name-ltgen>
594 <tbody>
595 <tr>
596 <td>Name:
598 <td><dfn id=propdef-font-family>font-family</dfn>
600 <tr>
601 <td>Value:
603 <td>[ <family-name> | <generic-family> ]#
605 <tr>
606 <td>Initial:
608 <td>depends on user agent
610 <tr>
611 <td>Applies to:
613 <td>all elements
615 <tr>
616 <td>Inherited:
618 <td>yes
620 <tr>
621 <td>Percentages:
623 <td>N/A
625 <tr>
626 <td>Media:
628 <td>visual
630 <tr>
631 <td>Computed value:
633 <td>as specified
635 <tr>
636 <td>Animatable:
638 <td>no
639 </table>
641 <p>This property specifies a prioritized list of font family names or
642 generic family names. A font family defines a set of faces that vary in
643 weight, width or slope. CSS uses the combination of a family name with
644 other style attributes to select an individual face. Using this selection
645 mechanism, rather than selecting a face via the style name as is often
646 done in design applications, allows some degree of regularity in textual
647 display when fallback occurs.
649 <p class=note>Designers should note that the CSS definition of font
650 attributes used for selection are explicitly not intended to define a font
651 taxonomy. A type designer's idea of a family may often extend to a set of
652 faces that vary along axes other than just the standard axes of weight,
653 width and slope. A family may extend to include both a set of serif faces
654 and a set of sans-serif faces or vary along axes that are unique to that
655 family. The CSS font selection mechanism merely provides a way to
656 determine the “closest” substitute when substitution is necessary.
658 <p>Unlike other CSS properties, component values are a comma-separated list
659 indicating alternatives. A user agent iterates through the list of family
660 names until it matches an available font that contains a glyph for the
661 character to be rendered. This allows for differences in available fonts
662 across platforms and for differences in the range of characters supported
663 by individual fonts.
665 <p>A font family name only specifies a name given to a set of font faces,
666 it does not specify an individual face. For example, given the
667 availability of the fonts below, Futura would match but Futura Medium
668 would not:
670 <div class=figure><img alt="family and face names"
671 src=familyvsfacename.png>
672 <p class=caption>Family and individual face names
673 </div>
675 <p>Consider the example below:
677 <div class=example>
678 <pre>body {
679 font-family: Helvetica, Verdana, sans-serif;
680 }</pre>
682 <p>If Helvetica is available it will be used when rendering. If neither
683 Helvetica nor Verdana is present, then the user-agent-defined sans serif
684 font will be used.</p>
685 </div>
687 <p>There are two types of font family names:
689 <dl>
690 <dt><family-name>
692 <dd>The name of a font family of choice such as Helvetica or Verdana in
693 the previous example.
695 <dt><generic-family>
697 <dd> The following generic family keywords are defined: ‘<a
698 href="#serif"><code class=property>serif</code></a>’, ‘<a
699 href="#sans-serif"><code class=property>sans-serif</code></a>’, ‘<a
700 href="#cursive"><code class=property>cursive</code></a>’, ‘<a
701 href="#fantasy"><code class=property>fantasy</code></a>’, and ‘<a
702 href="#monospace"><code class=property>monospace</code></a>’. These
703 keywords can be used as a general fallback mechanism when an author's
704 desired font choices are not available. As keywords, they must not be
705 quoted. Authors are encouraged to append a generic font family as a last
706 alternative for improved robustness.
707 </dl>
709 <p>Font family names must either be given quoted as <a
710 href="//www.w3.org/TR/CSS21/syndata.html#strings">strings,</a> or unquoted
711 as a sequence of one or more <a
712 href="//www.w3.org/TR/CSS21/syndata.html#value-def-identifier">identifiers.</a>
713 This means most punctuation characters and digits at the start of each
714 token must be escaped in unquoted font family names.
716 <p>To illustrate this, the following declarations are invalid:
718 <pre>
719 font-family: Red/Black, sans-serif;
720 font-family: "Lucida" Grande, sans-serif;
721 font-family: Ahem!, sans-serif;
722 font-family: test@foo, sans-serif;
723 font-family: #POUND, sans-serif;
724 font-family: Hawaii 5-0, sans-serif;
725 </pre>
727 <p>If a sequence of identifiers is given as a font family name, the
728 computed value is the name converted to a string by joining all the
729 identifiers in the sequence by single spaces.
731 <p>To avoid mistakes in escaping, it is recommended to quote font family
732 names that contain white space, digits, or punctuation characters other
733 than hyphens:
735 <pre>
736 body { font-family: "New Century Schoolbook", serif }
738 <BODY STYLE="font-family: '21st Century', fantasy">
739 </pre>
741 <p>Font family <em>names</em> that happen to be the same as a keyword value
742 (‘<code class=property>inherit</code>’, ‘<a href="#serif"><code
743 class=property>serif</code></a>’, ‘<a href="#sans-serif"><code
744 class=property>sans-serif</code></a>’, ‘<a href="#monospace"><code
745 class=property>monospace</code></a>’, ‘<a href="#fantasy"><code
746 class=property>fantasy</code></a>’, and ‘<a href="#cursive"><code
747 class=property>cursive</code></a>’) must be quoted to prevent confusion
748 with the keywords with the same names. The keywords ‘<code
749 class=property>initial</code>’ and ‘<code
750 class=property>default</code>’ are reserved for future use and must also
751 be quoted when used as font names. UAs must not consider these keywords as
752 matching the ‘<code class=css><family-name></code>’ type.
754 <p>The precise way a set of fonts are grouped into font families varies
755 depending upon the platform font management API's. The Windows GDI API
756 only allows four faces to be grouped into a family while the DirectWrite
757 API and API's on OSX and other platforms support font families with a
758 variety of weights, widths and slopes (see <a
759 href="#platform-props-to-css">Appendix A</a> for more details).
761 <p>Some font formats allow fonts to carry multiple localizations of the
762 family name. User agents must recognize and correctly match all of these
763 names independent of the underlying platform localization, system API used
764 or document encoding:
766 <div class=figure><img alt="examples of localized family names"
767 src=localizedfamilynames.png>
768 <p class=caption>Localized family names
769 </div>
771 <h4 id=generic-font-families><span class=secno>3.1.1 </span>Generic font
772 families</h4>
774 <p>All five generic font families are defined to exist in all CSS
775 implementations (they need not necessarily map to five distinct actual
776 fonts). User agents should provide reasonable default choices for the
777 generic font families, which express the characteristics of each family as
778 well as possible within the limits allowed by the underlying technology.
779 User agents are encouraged to allow users to select alternative choices
780 for the generic fonts.
782 <h5 class="no-num no-toc"> <span class=index-def id=serif0 title="serif,
783 definition of"><a name=serif-def><dfn id=serif>serif</dfn></a></span></h5>
785 <p>Serif fonts represent the formal text style for a script. This often
786 means but is not limited to glyphs that have finishing strokes, flared or
787 tapering ends, or have actual serifed endings (including slab serifs).
788 Serif fonts are typically proportionately-spaced. They often display a
789 greater variation between thick and thin strokes than fonts from the ‘<a
790 href="#sans-serif"><code class=property>sans-serif</code></a>’ generic
791 font family. CSS uses the term ‘<a href="#serif"><code
792 class=property>serif</code></a>’ to apply to a font for any script,
793 although other names may be more familiar for particular scripts, such as
794 Mincho (Japanese), Sung, Song or Kai (Chinese), Batang (Korean). For
795 Arabic, the Naskh style would correspond to ‘<a href="#serif"><code
796 class=property>serif</code></a>’ more due to its typographic role rather
797 than its actual design style. Any font that is so described may be used to
798 represent the generic ‘<a href="#serif"><code
799 class=property>serif</code></a>’ family.
801 <div class=figure><img alt="sample serif fonts" src=serifexamples.png>
802 <p class=caption>Sample serif fonts
803 </div>
805 <h5 class="no-num no-toc"> <span class=index-def id=sans-serif0
806 title="sans-serif, definition of"> <a name=sans-serif-def><dfn
807 id=sans-serif>sans-serif</dfn></a></span></h5>
809 <p>Glyphs in sans-serif fonts, as the term is used in CSS, are generally
810 low contrast (vertical and horizontal stems have the close to the same
811 thickness) and have stroke endings that are plain -- without any flaring,
812 cross stroke, or other ornamentation. Sans-serif fonts are typically
813 proportionately-spaced. They often have little variation between thick and
814 thin strokes, compared to fonts from the ‘<a href="#serif"><code
815 class=property>serif</code></a>’ family. CSS uses the term ‘<a
816 href="#sans-serif"><code class=property>sans-serif</code></a>’ to apply
817 to a font for any script, although other names may be more familiar for
818 particular scripts, such as Gothic (Japanese), Hei (Chinese), or Gulim
819 (Korean). Any font that is so described may be used to represent the
820 generic ‘<a href="#sans-serif"><code
821 class=property>sans-serif</code></a>’ family.
823 <div class=figure><img alt="sample sans-serif fonts"
824 src=sansserifexamples.png>
825 <p class=caption>Sample sans-serif fonts
826 </div>
828 <h5 class="no-num no-toc"> <span class=index-def id=cursive0
829 title="cursive, definition of"> <a name=cursive-def><dfn
830 id=cursive>cursive</dfn></a></span></h5>
832 <p>Glyphs in cursive fonts generally use a more informal script style, and
833 the result looks more like handwritten pen or brush writing than printed
834 letterwork. CSS uses the term ‘<a href="#cursive"><code
835 class=property>cursive</code></a>’ to apply to a font for any script,
836 although other names such as Chancery, Brush, Swing and Script are also
837 used in font names.
839 <div class=figure><img alt="sample cursive fonts" src=cursiveexamples.png>
840 <p class=caption>Sample cursive fonts
841 </div>
843 <h5 class="no-num no-toc"> <span class=index-def id=fantasy0
844 title="fantasy, definition of"> <a name=fantasy-def><dfn
845 id=fantasy>fantasy</dfn></a></span></h5>
847 <p>Fantasy fonts are primarily decorative or expressive fonts that contain
848 playful representations of characters. These do not include Pi or Picture
849 fonts which do not represent actual characters.
851 <div class=figure><img alt="sample fantasy fonts" src=fantasyexamples.png>
852 <p class=caption>Sample fantasy fonts
853 </div>
855 <h5 class="no-num no-toc"> <span class=index-def id=monospace0
856 title="monospace, definition of"> <a name=monospace-def><dfn
857 id=monospace>monospace</dfn></a></span></h5>
859 <p>The sole criterion of a monospace font is that all glyphs have the same
860 fixed width. This is often used to render samples of computer code.
862 <div class=figure><img alt="sample monospace fonts"
863 src=monospaceexamples.png>
864 <p class=caption>Sample monospace fonts
865 </div>
866 <!-- prop: font-weight -->
868 <h3 id=font-weight-prop><span class=secno>3.2 </span>Font weight: the <a
869 href="#propdef-font-weight">font-weight</a> property</h3>
871 <table class=propdef id=namefont-weightvaluenormal-bold-bolder-l>
872 <tbody>
873 <tr>
874 <td>Name:
876 <td><dfn id=propdef-font-weight>font-weight</dfn>
878 <tr>
879 <td>Value:
881 <td>normal | bold | bolder | lighter | 100 | 200 | 300 | 400 | 500 | 600
882 | 700 | 800 | 900
884 <tr>
885 <td>Initial:
887 <td>normal
889 <tr>
890 <td>Applies to:
892 <td>all elements
894 <tr>
895 <td>Inherited:
897 <td>yes
899 <tr>
900 <td>Percentages:
902 <td>N/A
904 <tr>
905 <td>Media:
907 <td>visual
909 <tr>
910 <td>Computed value:
912 <td>numeric weight value (see description)
914 <tr>
915 <td>Animatable:
917 <td>as <a
918 href="http://dev.w3.org/csswg/css3-transitions/#animtype-font-weight">font
919 weight</a>
920 </table>
922 <p>The <a class=noxref href="#font-weight-prop"><span
923 class=property>‘<code class=property>font-weight</code>’</span></a>
924 property specifies the weight of glyphs in the font, their degree of
925 blackness or stroke thickness.
927 <p>Values have the following meanings:
929 <dl>
930 <dt>100 to 900
932 <dd>These values form an ordered sequence, where each number indicates a
933 weight that is at least as dark as its predecessor. These roughly
934 correspond to the commonly used weight names below:
935 </dl>
937 <ul>
938 <li>100 - Thin
940 <li>200 - Extra Light (Ultra Light)
942 <li>300 - Light
944 <li>400 - Normal
946 <li>500 - Medium
948 <li>600 - Semi Bold (Demi Bold)
950 <li>700 - Bold
952 <li>800 - Extra Bold (Ultra Bold)
954 <li>900 - Black (Heavy)
955 </ul>
957 <dl>
958 <dt><a href="#normal2"><strong>normal</strong></a>
960 <dd>Same as ‘<code class=css>400</code>’.
962 <dt><strong>bold</strong>
964 <dd>Same as ‘<code class=css>700</code>’.
966 <dt><strong>bolder</strong>
968 <dd>Specifies a bolder weight than the inherited value.
970 <dt><strong>lighter</strong>
972 <dd>Specifies a lighter weight than the inherited value.
973 </dl>
975 <p>Font formats that use a scale other than a nine-step scale should map
976 their scale onto the CSS scale so that 400 roughly corresponds with a face
977 that would be labeled as Regular, Book, Roman and 700 roughly matches a
978 face that would be labeled as Bold. Or weights may be inferred from the
979 style names, ones that correspond roughly with the scale above. The scale
980 is relative, so a face with a larger weight value must never appear
981 lighter. If style names are used to infer weights, care should be taken to
982 handle variations in style names across locales.
984 <p>Quite often there are only a few weights available for a particular font
985 family. When a weight is specified for which no face exists, a face with a
986 nearby weight is used. In general, bold weights map to faces with heavier
987 weights and light weights map to faces with lighter weights (see the <a
988 href="#font-matching-algorithm">font matching section below</a> for a
989 precise definition). The examples here illustrate which face is used for
990 different weights, grey indicates a face for that weight does not exist so
991 a face with a nearby weight is used:
993 <div class=figure><img alt="weight mappings for a family with 400, 700 and
994 900 weights" src=optimaweights.png>
995 <p class=caption>Weight mappings for a font family with 400, 700 and 900
996 weight faces
997 </div>
999 <div class=figure><img alt="weight mappings for a family with 300, 600
1000 weights" src=hiraginoweights.png>
1001 <p class=caption>Weight mappings for a font family with 300 and 600 weight
1002 faces
1003 </div>
1005 <p>Although the practice is not well-loved by typographers, bold faces are
1006 often synthesized by user agents for faces that lack actual bold faces.
1007 For the purposes of style matching, these faces must be treated as if they
1008 exist within the family. Authors can explicitly avoid this behavior by
1009 using the ‘<a href="#propdef-font-synthesis"><code
1010 class=property>font-synthesis</code></a>’ property.
1012 <p>Specified values of ‘<code class=property>bolder</code>’ and
1013 ‘<code class=property>lighter</code>’ indicate weights relative to the
1014 weight of the parent element. The computed weight is calculated based on
1015 the inherited ‘<a href="#propdef-font-weight"><code
1016 class=property>font-weight</code></a>’ value using the chart below.
1018 <table class=data id=bolderlighter summary="Bolder/lighter mappings">
1019 <thead>
1020 <tr>
1021 <th>Inherited value
1023 <th>bolder
1025 <th>lighter
1027 <tbody>
1028 <tr>
1029 <th>100
1031 <td>400
1033 <td>100
1035 <tr>
1036 <th>200
1038 <td>400
1040 <td>100
1042 <tr>
1043 <th>300
1045 <td>400
1047 <td>100
1049 <tr>
1050 <th>400
1052 <td>700
1054 <td>100
1056 <tr>
1057 <th>500
1059 <td>700
1061 <td>100
1063 <tr>
1064 <th>600
1066 <td>900
1068 <td>400
1070 <tr>
1071 <th>700
1073 <td>900
1075 <td>400
1077 <tr>
1078 <th>800
1080 <td>900
1082 <td>700
1084 <tr>
1085 <th>900
1087 <td>900
1089 <td>700
1090 </table>
1092 <p>The table above is equivalent to selecting the next relative bolder or
1093 lighter face, given a font family containing normal and bold faces along
1094 with a thin and a heavy face. Authors who desire finer control over the
1095 exact weight values used for a given element may use numerical values
1096 instead of relative weights.</p>
1097 <!-- prop: font-stretch -->
1099 <h3 id=font-stretch-prop><span class=secno>3.3 </span>Font width: the <a
1100 href="#propdef-font-stretch">font-stretch</a> property</h3>
1102 <table class=propdef id=namefont-stretchvaluenormal-ultra-conden>
1103 <tbody>
1104 <tr>
1105 <td>Name:
1107 <td><dfn id=propdef-font-stretch>font-stretch</dfn>
1109 <tr>
1110 <td>Value:
1112 <td>normal | ultra-condensed | extra-condensed | condensed |
1113 semi-condensed | semi-expanded | expanded | extra-expanded |
1114 ultra-expanded
1116 <tr>
1117 <td>Initial:
1119 <td>normal
1121 <tr>
1122 <td>Applies to:
1124 <td>all elements
1126 <tr>
1127 <td>Inherited:
1129 <td>yes
1131 <tr>
1132 <td>Percentages:
1134 <td>N/A
1136 <tr>
1137 <td>Media:
1139 <td>visual
1141 <tr>
1142 <td>Computed value:
1144 <td>as specified
1146 <tr>
1147 <td>Animatable:
1149 <td>as <a href="#font-stretch-animation">font stretch</a>
1150 </table>
1152 <p>The <a class=noxref href="#font-stretch-prop"><span
1153 class=property>‘<code class=property>font-stretch</code>’</span></a>
1154 property selects a normal, condensed, or expanded face from a font family.
1155 Absolute keyword values have the following ordering, from narrowest to
1156 widest:
1158 <ul>
1159 <li><code>ultra-condensed</code>
1161 <li><code>extra-condensed</code>
1163 <li><code>condensed</code>
1165 <li><code>semi-condensed </code>
1167 <li><code>normal</code>
1169 <li><code>semi-expanded</code>
1171 <li><code>expanded</code>
1173 <li><code>extra-expanded</code>
1175 <li><code>ultra-expanded</code>
1176 </ul>
1178 <p>When a face does not exist for a given width, normal or condensed values
1179 map to a narrower face, otherwise a wider face. Conversely, expanded
1180 values map to a wider face, otherwise a narrower face. The figure below
1181 shows how the nine font-stretch property settings affect font selection
1182 for font family containing a variety of widths, grey indicates a width for
1183 which no face exists and a different width is substituted:
1185 <div class=figure><img alt="width mappings for a family with condensed,
1186 normal and expanded faces" src=universwidths.png>
1187 <p class=caption>Width mappings for a font family with condensed, normal
1188 and expanded width faces
1189 </div>
1191 <p id=font-stretch-animation>Animation of font stretch: Font stretch is
1192 interpolated in discrete steps. The interpolation happens as though the
1193 ordered values are equally spaced real numbers. The interpolation result
1194 is rounded to the nearest value, with values exactly halfway between two
1195 values rounded towards the later value in the list above.</p>
1196 <!-- prop: font-style -->
1198 <h3 id=font-style-prop><span class=secno>3.4 </span>Font style: the <a
1199 href="#propdef-font-style">font-style</a> property</h3>
1201 <table class=propdef id=namefont-stylevaluenormal-italic-oblique>
1202 <tbody>
1203 <tr>
1204 <td>Name:
1206 <td><dfn id=propdef-font-style>font-style</dfn>
1208 <tr>
1209 <td>Value:
1211 <td>normal | italic | oblique
1213 <tr>
1214 <td>Initial:
1216 <td>normal
1218 <tr>
1219 <td>Applies to:
1221 <td>all elements
1223 <tr>
1224 <td>Inherited:
1226 <td>yes
1228 <tr>
1229 <td>Percentages:
1231 <td>N/A
1233 <tr>
1234 <td>Media:
1236 <td>visual
1238 <tr>
1239 <td>Computed value:
1241 <td>as specified
1243 <tr>
1244 <td>Animatable:
1246 <td>no
1247 </table>
1249 <p>The <a class=noxref href="#font-style-prop"><span
1250 class=property>‘<code class=property>font-style</code>’</span></a>
1251 property allows italic or oblique faces to be selected. Italic forms are
1252 generally cursive in nature while oblique faces are typically sloped
1253 versions of the regular face. Oblique faces can be simulated by
1254 artificially sloping the glyphs of the regular face. Compare the
1255 artificially sloped renderings of Palatino ‘<code
1256 class=property>a</code>’ and Baskerville ‘<code
1257 class=property>N</code>’ in grey with the actual italic versions:
1259 <div class=figure><img alt="artificial sloping vs. real italics"
1260 src=realvsfakeitalics.png>
1261 <p class=caption>Artificial sloping versus real italics
1262 </div>
1264 <p>A value of ‘<a href="#normal2"><code
1265 class=property>normal</code></a>’ selects a face that is classified as
1266 ‘<a href="#normal2"><code class=property>normal</code></a>’, while
1267 ‘<code class=property>oblique</code>’ selects a font that is labeled
1268 ‘<code class=property>oblique</code>’. A value of ‘<code
1269 class=property>italic</code>’ selects a font that is labeled ‘<code
1270 class=property>italic</code>’, or, if that is not available, one labeled
1271 ‘<code class=property>oblique</code>’. If no italic or oblique face is
1272 available, oblique faces can be synthesized by rendering non-obliqued
1273 faces with a right sloping transformation applied. When synthesizing these
1274 faces, the transformation should apply to all glyphs in the same way and
1275 not vary based on codepoint or due to horizontal or vertical line
1276 orientation.
1278 <p>Many scripts lack the tradition of mixing a cursive form within text
1279 rendered with a normal face. Chinese, Japanese and Korean fonts almost
1280 always lack italic or oblique faces. Fonts that support a mixture of
1281 scripts will sometimes omit specific scripts such as Arabic from the set
1282 of glyphs supported in the italic face. User agents should be careful
1283 about making character map assumptions across faces.
1285 <p class=issue>For synthetic italics in vertical runs of Chinese, Japanese,
1286 or Korean text, is there a need to define explicitly the direction of the
1287 faux oblique for runs that include a mixture of ideographic and Latin
1288 text?</p>
1289 <!-- prop: font-size -->
1291 <h3 id=font-size-prop><span class=secno>3.5 </span>Font size: the <a
1292 href="#propdef-font-size">font-size</a> property</h3>
1294 <table class=propdef id=namefont-sizevalueltabsolute-size-ltrela>
1295 <tbody>
1296 <tr>
1297 <td>Name:
1299 <td><dfn id=propdef-font-size>font-size</dfn>
1301 <tr>
1302 <td>Value:
1304 <td><absolute-size> | <relative-size> | <length> |
1305 <percentage>
1307 <tr>
1308 <td>Initial:
1310 <td>medium
1312 <tr>
1313 <td>Applies to:
1315 <td>all elements
1317 <tr>
1318 <td>Inherited:
1320 <td>yes
1322 <tr>
1323 <td>Percentages:
1325 <td>refer to parent element's font size
1327 <tr>
1328 <td>Media:
1330 <td>visual
1332 <tr>
1333 <td>Computed value:
1335 <td>absolute length
1337 <tr>
1338 <td>Animatable:
1340 <td>as <a
1341 href="http://dev.w3.org/csswg/css3-transitions/#animtype-length">length</a>
1342 </table>
1344 <p>This property indicates the desired height of glyphs from the font. For
1345 scalable fonts, the font-size is a scale factor applied to the EM unit of
1346 the font. (Note that certain glyphs may bleed outside their EM box.) For
1347 non-scalable fonts, the font-size is converted into absolute units and
1348 matched against the declared font-size of the font, using the same
1349 absolute coordinate space for both of the matched values. Values have the
1350 following meanings:
1352 <dl>
1353 <dt><a name=x18><span class=index-def id=ltabsolute-sizegt
1354 title="<absolute-size>">
1355 <strong><absolute-size></strong></span></a>
1357 <dd> An <a class=value-def
1358 name=value-def-absolute-size><absolute-size></a> keyword refers to
1359 an entry in a table of font sizes computed and kept by the user agent.
1360 Possible values are:
1361 <p> [ xx-small | x-small | small | medium | large | x-large | xx-large ]</p>
1363 <dt><a name=x19><span class=index-def id=ltrelative-sizegt
1364 title="<relative-size>">
1365 <strong><relative-size></strong></span></a>
1367 <dd> A <a class=value-def
1368 name=value-def-relative-size><relative-size></a> keyword is
1369 interpreted relative to the table of font sizes and the computed ‘<a
1370 href="#propdef-font-size"><code class=property>font-size</code></a>’ of
1371 the parent element. Possible values are:
1372 <p> [ larger | smaller ]
1374 <p> For example, if the parent element has a font size of ‘<code
1375 class=property>medium</code>’, a value of ‘<code
1376 class=property>larger</code>’ will make the font size of the current
1377 element be ‘<code class=property>large</code>’. If the parent
1378 element's size is not close to a table entry, the user agent is free to
1379 interpolate between table entries or round off to the closest one. The
1380 user agent may have to extrapolate table values if the numerical value
1381 goes beyond the keywords.
1383 <dt><span class=index-inst id=ltlengthgt
1384 title="<length>"><length></span>
1386 <dd>A length value specifies an absolute font size (independent of the
1387 user agent's font table). Negative lengths are illegal.
1389 <dt><span class=index-inst id=ltpercentagegt-
1390 title="<percentage>"><percentage> </span>
1392 <dd>A percentage value specifies an absolute font size relative to the
1393 parent element's font size. Use of percentage values, or values in
1394 ‘<code class=property>em</code>’s, leads to more robust and
1395 cascadable style sheets.
1396 </dl>
1398 <p>The following table provides user agent guidelines for the absolute-size
1399 scaling factor and their mapping to HTML heading and absolute font-sizes.
1400 The ‘<code class=property>medium</code>’ value is used as the
1401 reference middle value. The user agent may fine-tune these values for
1402 different fonts or different types of display devices.
1404 <table class=data>
1405 <thead>
1406 <tr>
1407 <th>CSS absolute-size values
1409 <th>xx-small
1411 <th>x-small
1413 <th>small
1415 <th>medium
1417 <th>large
1419 <th>x-large
1421 <th>xx-large
1423 <th>
1425 <tbody>
1426 <tr>
1427 <th>scaling factor
1429 <td>3/5
1431 <td>3/4
1433 <td>8/9
1435 <td>1
1437 <td>6/5
1439 <td>3/2
1441 <td>2/1
1443 <td>3/1
1445 <tr>
1446 <th>HTML headings
1448 <td>h6
1450 <td>
1452 <td>h5
1454 <td>h4
1456 <td>h3
1458 <td>h2
1460 <td>h1
1462 <td>
1464 <tr>
1465 <th>HTML font sizes
1467 <td>1
1469 <td>
1471 <td>2
1473 <td>3
1475 <td>4
1477 <td>5
1479 <td>6
1481 <td>7
1482 </table>
1484 <p class=note><em><strong>Note 1.</strong> To preserve readability, an UA
1485 applying these guidelines should nevertheless avoid creating font-size
1486 resulting in less than 9 device pixels per EM unit on a computer display
1487 .</em>
1489 <p class=note><em><strong>Note 2.</strong> In CSS1, the suggested scaling
1490 factor between adjacent indexes was 1.5 which user experience proved to be
1491 too large. In CSS2, the suggested scaling factor for computer screen
1492 between adjacent indexes was 1.2 which still created issues for the small
1493 sizes. The new scaling factor varies between each index to provide a
1494 better readability.</em>
1496 <p>The actual value of this property may differ from the computed value due
1497 a numerical value on ‘<a href="#propdef-font-size-adjust"><code
1498 class=property>font-size-adjust</code></a>’ and the unavailability of
1499 certain font sizes.
1501 <p>Child elements inherit the computed <a class=noxref
1502 href="#font-size-prop"> <span class=property>‘<code
1503 class=property>font-size</code>’</span></a> value (otherwise, the effect
1504 of <a class=noxref href="#font-size-adjust-prop"><span
1505 class=property>‘<code
1506 class=property>font-size-adjust</code>’</span></a> would compound).
1508 <div class=example>
1509 <p style="display:none">Example(s):
1511 <p>
1513 <pre>p { font-size: 12pt; }
1514 blockquote { font-size: larger }
1515 em { font-size: 150% }
1516 em { font-size: 1.5em }
1517 </pre>
1518 </div>
1519 <!-- prop: font-size-adjust -->
1521 <h3 id=font-size-adjust-prop><span class=secno>3.6 </span>Relative sizing:
1522 the <a href="#propdef-font-size-adjust">font-size-adjust</a> property</h3>
1524 <table class=propdef id=namefont-size-adjustvaluenone-auto-ltnum>
1525 <tbody>
1526 <tr>
1527 <td>Name:
1529 <td><dfn id=propdef-font-size-adjust>font-size-adjust</dfn>
1531 <tr>
1532 <td>Value:
1534 <td>none | auto | <number>
1536 <tr>
1537 <td>Initial:
1539 <td>none
1541 <tr>
1542 <td>Applies to:
1544 <td>all elements
1546 <tr>
1547 <td>Inherited:
1549 <td>yes
1551 <tr>
1552 <td>Percentages:
1554 <td>N/A
1556 <tr>
1557 <td>Media:
1559 <td>visual
1561 <tr>
1562 <td>Computed value:
1564 <td>as specified
1566 <tr>
1567 <td>Animatable:
1569 <td>as <a
1570 href="http://dev.w3.org/csswg/css3-transitions/#animtype-number">number</a>
1571 </table>
1573 <p>For any given font size, the apparent size and legibility of text varies
1574 across fonts. For scripts such as Latin or Cyrillic that distinguish
1575 between upper and lowercase letters, the relative height of lowercase
1576 letters compared to their uppercase counterparts is a determining factor
1577 of legibility. This is commonly referred to as the <a class=index-def
1578 href="#aspect-value" id=aspect-value0 title="aspect value"><dfn
1579 id=aspect-value>aspect value</dfn></a>. Precisely defined, it is equal to
1580 the x-height of a font divided by the font size.
1582 <p>In situations where font fallback occurs, fallback fonts may not share
1583 the same aspect ratio as the desired font family and will thus appear less
1584 readable. The font-size-adjust property is a way to preserve the
1585 readability of text when font fallback occurs. It does this by adjusting
1586 the font-size so that the x-height is the same regardless of the font
1587 used.
1589 <div class=example>
1590 <p>The style defined below defines Verdana as the desired font family, but
1591 if Verdana is not available Futura or Times will be used.</p>
1593 <pre>p {
1594 font-family: Verdana, Futura, Times;
1595 }
1597 <p>Lorem ipsum dolor sit amet, ...</p>
1598 </pre>
1600 <p>Verdana has a relatively high aspect ratio, lowercase letters are
1601 relatively tall compared to uppercase letters, so at small sizes text
1602 appears legible. Times has a lower aspect ratio and so if fallback
1603 occurs, the text will be less legible at small sizes than Verdana.</p>
1604 </div>
1606 <p>How text rendered in each of these fonts compares is shown below, the
1607 columns show text rendered in Verdana, Futura and Times. The same
1608 font-size value is used across cells within each row and red lines are
1609 included to show the differences in x-height. In the upper half each row
1610 is rendered in the same font-size value. The same is true for the lower
1611 half but in this half the font-size-adjust property is also set so that
1612 the actual font size is adjusted to preserve the x-height across each row.
1613 Note how small text remains relatively legible across each row in the
1614 lower half.
1616 <div class=figure><img alt="text with and without font-size-adjust"
1617 src=fontsizeadjust.png>
1618 <p class=caption>Text with and without the use of font-size-adjust
1619 </div>
1621 <p>This property allows authors to specify an aspect value for an element
1622 that will effectively preserve the x-height of the first choice font,
1623 whether it is substituted or not. Values have the following meanings:
1625 <dl>
1626 <dt><strong>none</strong>
1628 <dd>Do not preserve the font's x-height.
1630 <dt><strong>auto</strong>
1632 <dd>Behaves just like <number>, except the number used is the aspect
1633 value calculated by user agents for the first font in the list of fonts
1634 defined for the initial value of the ‘<a
1635 href="#descdef-font-family"><code
1636 class=property>font-family</code></a>’ property. Effectively this is
1637 the default font used when ‘<a href="#descdef-font-family"><code
1638 class=property>font-family</code></a>’ is not otherwise specified.
1639 <p>Authors can use this value to specify that font size should be
1640 normalized across fonts based on the x-height without the need to
1641 specify the aspect ratio explicitly.</p>
1643 <dt><span class=index-inst id=ltnumbergt
1644 title="<number>"><number></span>
1646 <dd>Specifies the aspect value used in the calculation below to calculate
1647 the adjusted font size:
1648 <pre>c = ( a / a' ) s
1649 </pre>
1651 <p>where:</p>
1653 <pre>s = font-size value
1654 a = aspect value as specified by the font-size-adjust property
1655 a' = aspect value of actual font
1656 c = adjusted font-size to use
1657 </pre>
1659 <p>This value applies to any font that is selected but in typical usage
1660 it should be based on the aspect value of the first font in the
1661 font-family list. If this is specified accurately, the <tt>(a/a')</tt>
1662 term in the formula above is effectively 1 for the first font and no
1663 adjustment occurs. If the value is specified inaccurately, text rendered
1664 using the first font in the family list will display differently in
1665 older user agents that don't support font-size-adjust.</p>
1666 </dl>
1668 <p>Authors can calculate the aspect value for a given font by comparing
1669 spans with the same content but different font-size-adjust properties. If
1670 the same font-size is used, the spans will match when the font-size-adjust
1671 value is accurate for the given font.
1673 <div class=example>
1674 <p>Two spans with borders are used to determine the aspect value of a
1675 font. The font-size is the same for both spans but the font-size-adjust
1676 property is specified only for the right span. Starting with a value of
1677 0.5, the aspect value can be adjusted until the borders around the two
1678 letters line up.</p>
1680 <pre>p {
1681 font-family: Futura;
1682 font-size: 500px;
1683 }
1685 span {
1686 border: solid 1px red;
1687 }
1689 .adjust {
1690 font-size-adjust: 0.5;
1691 }
1693 <p><span>b</span><span class="adjust">b</span></p>
1694 </pre>
1696 <div class=figure><img alt="Futura with an aspect value of 0.5"
1697 src=beforefontsizeadjust.png>
1698 <p class=caption>Futura with an aspect value of 0.5
1699 </div>
1701 <p>The box on the right is a bit bigger than the one on the left, so the
1702 aspect value of this font is something less than 0.5. Adjust the value
1703 until the boxes align.</p>
1704 </div>
1705 <!-- prop: font -->
1706 <!-- jtdfix, crap, preprocessor is inserting links to descriptors rather than properties. bert, make it stop... -->
1707 <!-- <a href="#font-stretch-prop" class="noxref"><span class="property">'font-stretch'</span></a> -->
1709 <h3 id=font-prop><span class=secno>3.7 </span>Shorthand font property: the
1710 <a href="#propdef-font">font</a> property</h3>
1712 <table class=propdef id=namefontvalue-ltlsquofont-stylersquo-ltf>
1713 <tbody>
1714 <tr>
1715 <td>Name:
1717 <td><dfn id=propdef-font>font</dfn>
1719 <tr>
1720 <td>Value:
1722 <td>[ [ <‘<a href="#propdef-font-style"><code
1723 class=property>font-style</code></a>’> || <font-variant-css21> ||
1724 <‘<a href="#propdef-font-weight"><code
1725 class=property>font-weight</code></a>’> || <‘<a
1726 href="#propdef-font-stretch"><code
1727 class=property>font-stretch</code></a>’> ]? <‘<a
1728 href="#propdef-font-size"><code class=property>font-size</code></a>’>
1729 [ / <‘<code class=property>line-height</code>’> ]? <‘<a
1730 href="#descdef-font-family"><code
1731 class=property>font-family</code></a>’> ] | caption | icon | menu |
1732 message-box | small-caption | status-bar
1734 <tr>
1735 <td>Initial:
1737 <td>see individual properties
1739 <tr>
1740 <td>Applies to:
1742 <td>all elements
1744 <tr>
1745 <td>Inherited:
1747 <td>yes
1749 <tr>
1750 <td>Percentages:
1752 <td>see individual properties
1754 <tr>
1755 <td>Media:
1757 <td>visual
1759 <tr>
1760 <td>Computed value:
1762 <td>see individual properties
1764 <tr>
1765 <td>Animatable:
1767 <td>see individual properties
1768 </table>
1770 <p>The <span class=property>‘<a href="#propdef-font"><code
1771 class=property>font</code></a>’</span> property is, except as described
1772 below, a shorthand property for setting ‘<a
1773 href="#propdef-font-style"><code class=property>font-style</code></a>’,
1774 <span class=property>‘<a href="#propdef-font-variant"><code
1775 class=property>font-variant</code></a>’</span>, <span
1776 class=property>‘<a href="#propdef-font-weight"><code
1777 class=property>font-weight</code></a>’</span>, <span
1778 class=property>‘<a href="#propdef-font-stretch"><code
1779 class=property>font-stretch</code></a>’</span>, <span
1780 class=property>‘<a href="#propdef-font-size"><code
1781 class=property>font-size</code></a>’</span>, ‘<code
1782 class=property>line-height</code>’, <span class=property>‘<a
1783 href="#descdef-font-family"><code
1784 class=property>font-family</code></a>’</span> at the same place in the
1785 stylesheet. Values for the <span class=property>‘<a
1786 href="#propdef-font-variant"><code
1787 class=property>font-variant</code></a>’</span> property may also be
1788 included but only those supported in CSS 2.1, none of the font-variant
1789 values added in this specification can be used in the <span
1790 class=property>‘<a href="#propdef-font"><code
1791 class=property>font</code></a>’</span> shorthand:
1793 <pre
1794 class=prod><dfn id=ltfont-variant-css21gt><var><font-variant-css21></var></dfn> = [normal | small-caps]</pre>
1796 <p>The syntax of this property is based on a traditional typographical
1797 shorthand notation to set multiple properties related to fonts.
1799 <p>All subproperties of the ‘<a href="#propdef-font"><code
1800 class=property>font</code></a>’ property are first reset to their
1801 initial values, including those listed above plus <span
1802 class=property>‘<a href="#propdef-font-size-adjust"><code
1803 class=property>font-size-adjust</code></a>’</span>, <span
1804 class=property>‘<a href="#propdef-font-kerning"><code
1805 class=property>font-kerning</code></a>’</span>, subproperties of <span
1806 class=property>‘<a href="#propdef-font-variant"><code
1807 class=property>font-variant</code></a>’</span> and and <span
1808 class=property>‘<a href="#propdef-font-language-override"><code
1809 class=property>font-language-override</code></a>’</span>. Then, those
1810 properties that are given explicit values in the <span
1811 class=property>‘<a href="#propdef-font"><code
1812 class=property>font</code></a>’</span> shorthand are set to those
1813 values. For a definition of allowed and initial values, see the previously
1814 defined properties. For reasons of backwards compatibility, it is not
1815 possible to set <span class=property>‘<a
1816 href="#propdef-font-size-adjust"><code
1817 class=property>font-size-adjust</code></a>’</span> to anything other
1818 than its initial value using the <span class=property>‘<a
1819 href="#propdef-font"><code class=property>font</code></a>’</span>
1820 shorthand property; instead, use the individual property.
1822 <div class=example>
1823 <p style="display:none">Example(s):
1825 <p>
1827 <pre>p { font: 12pt/14pt sans-serif }
1828 p { font: 80% sans-serif }
1829 p { font: x-large/110% "new century schoolbook", serif }
1830 p { font: bold italic large Palatino, serif }
1831 p { font: normal small-caps 120%/120% fantasy }
1832 p { font: condensed oblique 12pt "Helvetica Neue", serif; }
1833 </pre>
1835 <p> In the second rule, the font size percentage value (‘<code
1836 class=css>80%</code>’) refers to the computed ‘<a
1837 href="#propdef-font-size"><code class=property>font-size</code></a>’ of
1838 the parent element. In the third rule, the line height percentage
1839 (‘<code class=css>110%</code>’) refers to the font size of the
1840 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 fetched and activated when needed. This allows authors to
2070 select a font that closely matches the design goals for a given page
2071 rather than limiting the font choice to a set of fonts available on all
2072 platforms. A set of font descriptors define the location of a font
2073 resource, either locally or externally, along with the style
2074 characteristics of an individual face. Multiple <code>@font-face</code>
2075 rules can be used to construct font families with a variety of faces.
2076 Using CSS font matching rules, a user agent can selectively download only
2077 those faces that are needed for a given piece of text.
2079 <p>The @font-face rule consists of the @font-face at-keyword followed by a
2080 block of descriptor declarations. In terms of the grammar, this
2081 specification defines the following productions:
2083 <pre><dfn id=fontfacerule>font_face_rule</dfn>
2084 : FONT_FACE_SYM S* '{' S* descriptor_declaration? [ ';' S* descriptor_declaration? ]* '}' S*
2085 ;
2087 <dfn id=descriptordeclaration>descriptor_declaration</dfn>
2088 : property ':' S* expr
2089 ;</pre>
2091 <p>The following new definitions are introduced:
2093 <pre>- -|\\0{0,4}2d(\r\n|[ \t\r\n\f])?
2094 F f|\\0{0,4}(46|66)(\r\n|[ \t\r\n\f])?</pre>
2096 <p>The following new token is introduced:
2098 <pre>@{F}{O}{N}{T}{-}{F}{A}{C}{E} {return FONT_FACE_SYM;}</pre>
2100 <p>Each <span class=index-inst id=font-face
2101 title="@font-face"><code>@font-face</code></span> rule specifies a value
2102 for every font descriptor, either implicitly or explicitly. Those not
2103 given explicit values in the rule take the initial value listed with each
2104 descriptor in this specification. These descriptors apply solely within
2105 the context of the <code>@font-face</code> rule in which they are defined,
2106 and do not apply to document language elements. There is no notion of
2107 which elements the descriptors apply to or whether the values are
2108 inherited by child elements. When a given descriptor occurs multiple times
2109 in a given <code>@font-face</code> rule, only the last descriptor
2110 declaration is used and all prior declarations for that descriptor are
2111 ignored.
2113 <div class=example>
2114 <p>To use a downloadable font called Gentium:</p>
2116 <pre>
2117 @font-face {
2118 font-family: Gentium;
2119 src: url(http://example.com/fonts/Gentium.ttf);
2120 }
2122 p { font-family: Gentium, serif; }
2123 </pre>
2125 <p>The user agent will download Gentium and use it when rendering text
2126 within paragraph elements. If for some reason the site serving the font
2127 is unavailable, the default serif font will be used.</p>
2128 </div>
2130 <p>A given set of <code>@font-face</code> rules define a set of fonts
2131 available for use within the documents that contain these rules. When font
2132 matching is done, fonts defined using these rules are considered before
2133 other available fonts on a system.
2135 <p>Downloaded fonts are only available to documents that reference them.
2136 The process of activating these fonts must not make them available to
2137 other applications or to documents that don't directly link to the same
2138 font. User agent implementers might consider it convenient to use
2139 downloaded fonts when rendering characters in other documents for which no
2140 other available font exists as part of the system font fallback procedure.
2141 However, this would cause a security leak since the contents of one page
2142 would be able to affect other pages, something an attacker could use as an
2143 attack vector. These restrictions do not affect caching behavior, fonts
2144 are cached the same way other web resources are cached.
2146 <p>This at-rule follows the forward-compatible parsing rules of CSS. Like
2147 properties in a declaration block, declarations of any descriptors that
2148 are not supported by the user agent must be ignored.
2149 <code>@font-face</code> rules require a font-family and src descriptor; if
2150 either of these are missing, the <code>@font-face</code> rule is invalid
2151 and must be ignored entirely.
2153 <p>In cases where user agents have limited platform resources or implement
2154 the ability to disable downloadable font resources,
2155 <code>@font-face</code> rules must simply be ignored; the behavior of
2156 individual descriptors as defined in this specification should not be
2157 altered.
2159 <h3 id=font-family-desc><span class=secno>4.2 </span>Font family: the <a
2160 href="#descdef-font-family">font-family</a> descriptor</h3>
2162 <table class=descdef>
2163 <tbody>
2164 <tr>
2165 <td>Name:
2167 <td><dfn id=descdef-font-family>font-family</dfn>
2169 <tr>
2170 <td>Value:
2172 <td><family-name>
2174 <tr>
2175 <td><em>Initial:</em>
2177 <td>N/A
2178 </table>
2180 <p>This descriptor defines the font family name that will be used in all
2181 CSS font family name matching. It is required for the @font-face rule to
2182 be valid. It overrides the font family names contained in the underlying
2183 font data. If the font family name is the same as a font family available
2184 in a given user's environment, it effectively hides the underlying font
2185 for documents that use the stylesheet. This permits a web author to freely
2186 choose font-family names without worrying about conflicts with font family
2187 names present in a given user's environment. Likewise, platform
2188 substitutions for a given font family name must not be used.
2190 <h3 id=src-desc><span class=secno>4.3 </span>Font reference: the <a
2191 href="#descdef-src">src</a> descriptor</h3>
2193 <table class=descdef>
2194 <tbody>
2195 <tr>
2196 <td>Name:
2198 <td><dfn id=descdef-src>src</dfn>
2200 <tr>
2201 <td>Value:
2203 <td>[ <url> [format(<string>#)]? | <font-face-name> ]#
2205 <tr>
2206 <td><em>Initial:</em>
2208 <td>N/A
2209 </table>
2211 <p>This descriptor specifies the resource containing font data. It is
2212 required for the <code>@font-face</code> rule to be valid. Its value is a
2213 prioritized, comma-separated list of external references or locally
2214 installed font face names. When a font is needed the user agent iterates
2215 over the set of references listed, using the first one it can successfully
2216 activate. Fonts containing invalid data or local font faces that are not
2217 found are ignored and the user agent loads the next font in the list.
2219 <p>As with other URLs in CSS, the URL may be partial, in which case it is
2220 resolved relative to the location of the style sheet containing the <span
2221 class=index-inst id=font-face0
2222 title="@font-face"><code>@font-face</code></span> rule. In the case of SVG
2223 fonts, the URL points to an element within a document containing SVG font
2224 definitions. If the element reference is omitted, a reference to the first
2225 defined font is implied. Similarly, font container formats that can
2226 contain more than one font must load one and only one of the fonts for a
2227 given <code>@font-face</code> rule. Fragment identifiers are used to
2228 indicate which font to load. If a container format lacks a defined
2229 fragment identifier scheme, implementations should use a simple 1-based
2230 indexing scheme (e.g. "font-collection#1" for the first font,
2231 "font-collection#2" for the second font).
2233 <pre>
2234 src: url(fonts/simple.ttf); /* load simple.ttf relative to stylesheet location */
2235 src: url(/fonts/simple.ttf); /* load simple.ttf from absolute location */
2236 src: url(fonts.svg#simple); /* load SVG font with id 'simple' */
2237 </pre>
2239 <p>External references consist of a URL, followed by an optional hint
2240 describing the format of the font resource referenced by that URL. The
2241 format hint contains a comma-separated list of format strings that denote
2242 well-known font formats. Conformant user agents must skip downloading a
2243 font resource if the format hints indicate only unsupported or unknown
2244 font formats. If no format hints are supplied, the user agent should
2245 download the font resource.
2247 <pre>
2248 /* load WOFF font if possible, otherwise use OpenType font */
2249 @font-face {
2250 font-family: bodytext;
2251 src: url(ideal-sans-serif.woff) format("woff"),
2252 url(basic-sans-serif.ttf) format("opentype");
2253 }
2254 </pre>
2256 <p>Format strings defined by this specification:
2258 <table class=data id=fontformats>
2259 <thead>
2260 <tr>
2261 <th>String
2263 <th>Font Format
2265 <th>Common extensions
2267 <tbody>
2268 <tr>
2269 <th>"woff"
2271 <td><a href="http://www.w3.org/TR/WOFF/">WOFF (Web Open Font Format)</a>
2273 <td>.woff
2275 <tr>
2276 <th>"truetype"
2278 <td><a
2279 href="http://www.microsoft.com/typography/otspec/default.htm">TrueType</a>
2281 <td>.ttf
2283 <tr>
2284 <th>"opentype"
2286 <td><a
2287 href="http://www.microsoft.com/typography/otspec/default.htm">OpenType</a>
2289 <td>.ttf, .otf
2291 <tr>
2292 <th>"embedded-opentype"
2294 <td><a
2295 href="http://www.w3.org/Submission/2008/SUBM-EOT-20080305/">Embedded
2296 OpenType</a>
2298 <td>.eot
2300 <tr>
2301 <th>"svg"
2303 <td><a href="http://www.w3.org/TR/SVG/fonts.html">SVG Font</a>
2305 <td>.svg, .svgz
2306 </table>
2308 <p>Given the overlap in common usage between TrueType and OpenType, the
2309 format hints "truetype" and "opentype" must be considered as synonymous; a
2310 format hint of "opentype" does not imply that the font contains Postscript
2311 CFF style glyph data or that it contains OpenType layout information (see
2312 <a href="#platform-props-to-css">Appendix A</a> for more background on
2313 this).
2315 <p>When authors would prefer to use a locally available copy of a given
2316 font and download it if it's not, <code>local()</code> can be used. The
2317 locally-installed <span class=index-def id=ltfont-face-namegt
2318 title="<font-face-name>"><a
2319 name=value-def-font-face-name><font-face-name></a></span> argument
2320 is a format-specific string that uniquely identifies a single font face
2321 within a larger family. The syntax for a <font-face-name> is a
2322 unique font face name enclosed by "local(" and ")".
2324 <pre>
2325 /* regular face of Gentium */
2326 @font-face {
2327 font-family: MyGentium;
2328 src: local(Gentium), /* use locally available Gentium */
2329 url(Gentium.ttf); /* otherwise, download it */
2330 }
2331 </pre>
2333 <p>The name can optionally be enclosed in quotes. For OpenType and TrueType
2334 fonts, this string is used to match only the Postscript name or the full
2335 font name in the name table of locally available fonts. Which is used
2336 varies by platform and font, so authors should include both of these names
2337 to assure proper matching across platforms. Platform substitutions for a
2338 given font name must not be used.
2340 <pre>
2341 /* bold face of Gentium */
2342 @font-face {
2343 font-family: MyGentium;
2344 src: local(Gentium Bold), /* full font name */
2345 local(Gentium-Bold), /* Postscript name */
2346 url(GentiumBold.ttf); /* otherwise, download it */
2347 font-weight: bold;
2348 }
2349 </pre>
2351 <p>Just as a <code>@font-face</code> rule specifies the characteristics of
2352 a single font within a family, the unique name used with
2353 <code>local()</code> specifies a single font, not an entire font family.
2354 Defined in terms of OpenType font data, the Postscript name is found in
2355 the font's <a
2356 href="http://www.microsoft.com/typography/otspec/name.htm">name table</a>,
2357 in the name record with nameID = 6 (see <a href="#OPENTYPE"
2358 rel=biblioentry>[OPENTYPE]<!--{{!OPENTYPE}}--></a> for more details). The
2359 Postscript name is the commonly used key for all fonts on OSX and for
2360 Postscript CFF fonts under Windows. The full font name (nameID = 4) is
2361 used as a unique key for fonts with TrueType glyphs on Windows.
2363 <p>For OpenType fonts with multiple localizations of the full font name,
2364 the US English version is used (language ID = 0x409 for Windows and
2365 language ID = 0 for Macintosh) or the first localization when a US English
2366 full font name is not available (the OpenType specification recommends
2367 that <a href="http://www.microsoft.com/typography/otspec/recom.htm">all
2368 fonts minimally include US English names</a>). User agents that also match
2369 other full font names, e.g. matching the Dutch name when the current
2370 system locale is set to Dutch, are considered non-conformant. This is done
2371 not to prefer English but to avoid matching inconsistencies across font
2372 versions and OS localizations, since font style names (e.g. "Bold") are
2373 frequently localized into many languages and the set of localizations
2374 available varies widely across platform and font version. User agents that
2375 match a concatenation of family name (nameID = 1) with style name (nameID
2376 = 2) are considered non-conformant.
2378 <p>This also allows for referencing faces that belong to larger families
2379 that cannot otherwise be referenced.
2381 <div class=example>
2382 <p>Use a local font or reference an SVG font in another document:</p>
2384 <pre>
2385 @font-face {
2386 font-family: Headline;
2387 src: local(Futura-Medium),
2388 url(fonts.svg#MyGeometricModern) format("svg");
2389 }
2390 </pre>
2392 <p>Create an alias for local Japanese fonts on different platforms:</p>
2394 <pre>
2395 @font-face {
2396 font-family: jpgothic;
2397 src: local(HiraKakuPro-W3), local(Meiryo), local(IPAPGothic);
2398 }
2399 </pre>
2401 <p>Reference a font face that cannot be matched within a larger family:</p>
2403 <pre>
2404 @font-face {
2405 font-family: Hoefler Text Ornaments;
2406 /* has the same font properties as Hoefler Text Regular */
2407 src: local(HoeflerText-Ornaments);
2408 }
2409 </pre>
2411 <p>Since localized fullnames never match, a document with the header style
2412 rules below would always render using the default serif font, regardless
2413 whether a particular system locale parameter is set to Finnish or not:</p>
2415 <pre>
2416 @font-face {
2417 font-family: SectionHeader;
2418 src: local("Arial Lihavoitu"); /* Finnish fullname for Arial Bold, should fail */
2419 font-weight: bold;
2420 }
2422 h2 { font-family: SectionHeader, serif; }
2423 </pre>
2425 <p>A conformant user agent would never load the font ‘<code
2426 class=css>gentium.eot</code>’ in the example below, since it is
2427 included in the first definition of the ‘<a href="#descdef-src"><code
2428 class=property>src</code></a>’ descriptor which is overridden by the
2429 second definition in the same <code>@font-face</code> rule:</p>
2431 <pre>
2432 @font-face {
2433 font-family: MainText;
2434 src: url(gentium.eot); /* for use with older non-conformant user agents */
2435 src: local("Gentium"), url(gentium.ttf); /* Overrides src definition */
2436 }
2437 </pre>
2438 </div>
2440 <h3 id=font-prop-desc><span class=secno>4.4 </span>Font property
2441 descriptors: the <a href="#descdef-font-style">font-style</a>, <a
2442 href="#descdef-font-weight">font-weight</a>, <a
2443 href="#descdef-font-stretch">font-stretch</a> descriptors</h3>
2445 <table class=descdef>
2446 <tbody>
2447 <tr>
2448 <td>Name:
2450 <td><dfn id=descdef-font-style title="font-style
2451 (descriptor)">font-style</dfn>
2453 <tr>
2454 <td>Value:
2456 <td>normal | italic | oblique
2458 <tr>
2459 <td><em>Initial:</em>
2461 <td>normal
2462 </table>
2464 <table class=descdef>
2465 <tbody>
2466 <tr>
2467 <td>Name:
2469 <td><dfn id=descdef-font-weight title="font-weight
2470 (descriptor)">font-weight</dfn>
2472 <tr>
2473 <td>Value:
2475 <td>normal | bold | 100 | 200 | 300 | 400 | 500 | 600 | 700 | 800 | 900
2477 <tr>
2478 <td><em>Initial:</em>
2480 <td>normal
2481 </table>
2483 <table class=descdef>
2484 <tbody>
2485 <tr>
2486 <td>Name:
2488 <td><dfn id=descdef-font-stretch title="font-stretch
2489 (descriptor)">font-stretch</dfn>
2491 <tr>
2492 <td>Value:
2494 <td>normal | ultra-condensed | extra-condensed | condensed |
2495 semi-condensed | semi-expanded | expanded | extra-expanded |
2496 ultra-expanded
2498 <tr>
2499 <td><em>Initial:</em>
2501 <td>normal
2502 </table>
2504 <p>These descriptors define the characteristics of a font face and are used
2505 in the process of matching styles to specific faces. For a font family
2506 defined with several <code>@font-face</code> rules, user agents can either
2507 download all faces in the family or use these descriptors to selectively
2508 download font faces that match actual styles used in document. The values
2509 for these descriptors are the same as those for the corresponding font
2510 properties except that relative keywords are not allowed, ‘<code
2511 class=property>bolder</code>’ and ‘<code
2512 class=property>lighter</code>’. If these descriptors are omitted,
2513 default values are assumed.
2515 <p>The value for these font face style attributes is used in place of the
2516 style implied by the underlying font data. This allows authors to combine
2517 faces in flexible combinations, even in situations where the original font
2518 data was arranged differently. User agents that implement synthetic
2519 bolding and obliqueing must only apply synthetic styling in cases where
2520 the font descriptors imply this is needed, rather than based on the style
2521 attributes implied by the font data.
2523 <h3 id=unicode-range-desc><span class=secno>4.5 </span>Character range: the
2524 <a href="#descdef-unicode-range">unicode-range</a> descriptor</h3>
2526 <table class=descdef>
2527 <tbody>
2528 <tr>
2529 <td>Name:
2531 <td><dfn id=descdef-unicode-range>unicode-range</dfn>
2533 <tr>
2534 <td>Value:
2536 <td><urange>#
2538 <tr>
2539 <td><em>Initial:</em>
2541 <td>U+0-10FFFF
2542 </table>
2544 <p>This descriptor defines the range of Unicode characters supported by a
2545 given font. The values of <span class=index-def id=lturangegt
2546 title="<urange>"><a name=value-def-urange><urange></a></span>
2547 are expressed using hexadecimal numbers prefixed by "U+" or "u+",
2548 corresponding to <a href="http://www.unicode.org/charts/">Unicode
2549 character code points</a>. The unicode-range descriptor serves as a hint
2550 for user agents when deciding whether or not to download a font resource.
2552 <p>Unicode range values are written using hexadecimal values and are ASCII
2553 case-insensitive. Each is prefixed by "U+" or "u+" and multiple,
2554 discontinuous ranges are separated by commas. Whitespace before or after
2555 commas is ignored. Valid character code values vary between 0 and 10FFFF
2556 inclusive. A single range has three basic forms:
2558 <ul>
2559 <li>a single code point (e.g. U+416)
2561 <li>an interval value range (e.g. U+400-4ff)
2563 <li>a range where trailing ‘<code class=css>?</code>’ characters imply
2564 ‘<code class=css>any digit value</code>’ (e.g. U+4??)
2565 </ul>
2567 <p>Ranges that do not fit any of the above three forms are considered to be
2568 parse errors and the descriptor is omitted. Interval ranges consisting of
2569 a single code point are valid. Ranges specified with ‘?’ that lack an
2570 initial digit (e.g. "U+???") are also valid, and are treated as if there
2571 was a single 0 before the question marks (thus, "U+???" = "U+0???" =
2572 "U+0000-0FFF"). "U+??????" is not a syntax error, even though "U+0??????"
2573 would be. Ranges can overlap but interval ranges that descend (e.g.
2574 U+400-32f) are invalid and omitted rather than treated as parse errors;
2575 they have no effect on other ranges in a list of ranges. Ranges are
2576 clipped to the domain of Unicode code points (currently 0 – 10FFFF
2577 inclusive); a range entirely outside the domain is omitted. Without any
2578 valid ranges, the descriptor is omitted. User agents may normalize the
2579 list of ranges into a list that is different but represents the same set
2580 of character code points.
2582 <p>The character range can be a subset of the full <a
2583 href="#character-map"><em>character map</em></a> of the underlying font.
2584 The effective unicode-range used when mapping characters to fonts is the
2585 intersection of the unicode range specified and the underlying <a
2586 href="#character-map"><em>character map</em></a> of the font. This means
2587 that authors do not need to define the unicode-range of a font precisely,
2588 broad ranges for which a sparse set of code points are defined in the font
2589 can be used. Code points outside of the defined unicode-range are ignored,
2590 regardless of whether the font contains a glyph for that code point or
2591 not. User agents that download fonts for characters outside the defined
2592 unicode-range are considered non-conformant. Likewise, user agents that
2593 render a character using a font resource for which the defined
2594 unicode-range does not include that character are also considered
2595 non-conformant.
2597 <p>Example ranges for specific languages or characters:
2599 <dl>
2600 <dt>unicode-range: U+A5;
2602 <dd>a single code point, the yen/yuan symbol
2604 <dt>unicode-range: U+0-7F;
2606 <dd>code range for basic ASCII characters
2608 <dt>unicode-range: U+590-5ff;
2610 <dd>code range for Hebrew characters
2612 <dt>unicode-range: U+A5, U+4E00-9FFF, U+30??, U+FF00-FF9F;
2614 <dd>code range for Japanese kanji, hiragana and katakana characters plus
2615 yen/yuan symbol
2616 </dl>
2618 <div class=example>
2619 <p>The BBC provides news services in a wide variety of languages, many
2620 that are not well supported across all platforms. Using an
2621 <code>@font-face</code> rule, the BBC could provide a font for any of
2622 these languages, as it already does via a manual font download.</p>
2624 <pre>
2625 @font-face {
2626 font-family: BBCBengali;
2627 src: url(fonts/BBCBengali.ttf) format("opentype");
2628 unicode-range: U+00-FF, U+980-9FF;
2629 }
2630 </pre>
2631 </div>
2633 <div class=example>
2634 <p>Technical documents often require a wide range of symbols. The STIX
2635 Fonts project is one project aimed at providing fonts to support a wide
2636 range of technical typesetting in a standardized way. The example below
2637 shows the use of a font that provides glyphs for many of the mathematical
2638 and technical symbol ranges within Unicode:</p>
2640 <pre>
2641 @font-face {
2642 font-family: STIXGeneral;
2643 src: local(STIXGeneral), url(/stixfonts/STIXGeneral.otf);
2644 unicode-range: U+000-49F, U+2000-27FF, U+2900-2BFF, U+1D400-1D7FF;
2645 }
2646 </pre>
2647 </div>
2649 <p>Multiple <code>@font-face</code> rules with different unicode ranges for
2650 the same family and style descriptor values can be used to create
2651 composite fonts that mix the glyphs from different fonts for different
2652 scripts. This can be used to combine fonts that only contain glyphs for a
2653 single script (e.g. Latin, Greek, Cyrillic) or it can be used by authors
2654 as a way of segmenting a font into fonts for commonly used characters and
2655 less frequently used characters. Since the user agent will only pull down
2656 the fonts it needs this helps reduce page bandwidth.
2658 <p>If the unicode ranges overlap for a set of <code>@font-face</code> rules
2659 with the same family and style descriptor values, the rules are ordered in
2660 the reverse order they were defined; the last rule defined is the first to
2661 be checked for a given character.
2663 <div class=example>
2664 <p>This example shows how an author can override the glyphs used for Latin
2665 characters in a Japanese font with glyphs from a different font. The
2666 first rule specifies no range so it defaults to the entire range. The
2667 range specified in the second rule overlaps but takes precedence because
2668 it is defined later.</p>
2670 <pre>
2671 @font-face {
2672 font-family: JapaneseWithGentium;
2673 src: local(MSMincho);
2674 /* no range specified, defaults to entire range */
2675 }
2677 @font-face {
2678 font-family: JapaneseWithGentium;
2679 src: url(../fonts/Gentium.ttf);
2680 unicode-range: U+0-2FF;
2681 }
2682 </pre>
2683 </div>
2685 <div class=example>
2686 <p>Consider a family constructed to optimize bandwidth by separating out
2687 Latin, Japanese and other characters into different font files:</p>
2689 <pre>
2690 /* fallback font - size: 4.5MB */
2691 @font-face {
2692 font-family: DroidSans;
2693 src: url(DroidSansFallback.ttf);
2694 /* no range specified, defaults to entire range */
2695 }
2697 /* Japanese glyphs - size: 1.2MB */
2698 @font-face {
2699 font-family: DroidSans;
2700 src: url(DroidSansJapanese.ttf);
2701 unicode-range: U+3000-9FFF, U+ff??;
2702 }
2704 /* Latin, Greek, Cyrillic along with some
2705 punctuation and symbols - size: 190KB */
2706 @font-face {
2707 font-family: DroidSans;
2708 src: url(DroidSans.ttf);
2709 unicode-range: U+000-5FF, U+1e00-1fff, U+2000-2300;
2710 }
2711 </pre>
2713 <p>For simple Latin text, only the font for Latin characters is
2714 downloaded:</p>
2716 <pre>
2717 body { font-family: DroidSans; }
2719 <p>This is that</p>
2720 </pre>
2722 <p>In this case the user agent first checks the unicode-range for the font
2723 containing Latin characters (DroidSans.ttf). Since all the characters
2724 above are in the range U+0-5FF, the user agent downloads the font and
2725 renders the text with that font.</p>
2727 <p>Next, consider text that makes use of an arrow character (⇨):</p>
2729 <pre>
2730 <p>This &#x21e8; that<p>
2731 </pre>
2733 <p>The user agent again first checks the unicode-range of the font
2734 containing Latin characters. Since U+2000-2300 includes the arrow code
2735 point (U+21E8), the user agent downloads the font. For this character
2736 however the Latin font does not have a matching glyph, so the effective
2737 unicode-range used for font matching excludes this code point. Next, the
2738 user agent evaluates the Japanese font. The unicode-range for the
2739 Japanese font, U+3000-9FFF and U+ff??, does not include U+21E8, so the
2740 user agent does not download the Japanese font. Next the fallback font is
2741 considered. The <code>@font-face</code> rule for the fallback font does
2742 not define unicode-range so its value defaults to the range of all
2743 Unicode code points. The fallback font is downloaded and used to render
2744 the arrow character.</p>
2745 </div>
2747 <h3 id=font-rend-desc><span class=secno>4.6 </span>Font features: the <a
2748 href="#descdef-font-variant">font-variant</a> and <a
2749 href="#descdef-font-feature-settings">font-feature-settings</a>
2750 descriptors</h3>
2752 <table class=descdef>
2753 <tbody>
2754 <tr>
2755 <td>Name:
2757 <td><dfn id=descdef-font-variant title="font-variant
2758 (descriptor)">font-variant</dfn>
2760 <tr>
2761 <td>Value:
2763 <td>normal | [ <common-lig-values> ||
2764 <discretionary-lig-values> || <historical-lig-values> ||
2765 <contextual-alt-values> || stylistic(<feature-value-name>)
2766 || historical-forms || styleset(<feature-value-name>#) ||
2767 character-variant(<feature-value-name>#) ||
2768 swash(<feature-value-name>) ||
2769 ornaments(<feature-value-name>) ||
2770 annotation(<feature-value-name>) || [ small-caps | all-small-caps
2771 | petite-caps | all-petite-caps | unicase | titling-caps ] ||
2772 <numeric-figure-values> || <numeric-spacing-values> ||
2773 <numeric-fraction-values> || ordinal || slashed-zero ||
2774 <east-asian-variant-values> || <east-asian-width-values> ||
2775 ruby ]
2777 <tr>
2778 <td><em>Initial:</em>
2780 <td>normal
2781 </table>
2783 <table class=descdef>
2784 <tbody>
2785 <tr>
2786 <td>Name:
2788 <td><dfn id=descdef-font-feature-settings title="font-feature-settings
2789 (descriptor)">font-feature-settings</dfn>
2791 <tr>
2792 <td>Value:
2794 <td>normal | <feature-tag-value>#
2796 <tr>
2797 <td><em>Initial:</em>
2799 <td>normal
2800 </table>
2802 <p>These descriptors define default settings that apply when the font
2803 defined by an <code>@font-face</code> rule is rendered. They do not affect
2804 font selection. Values are identical to those defined for the
2805 corresponding ‘<a href="#propdef-font-variant"><code
2806 class=property>font-variant</code></a>’ and ‘<a
2807 href="#propdef-font-feature-settings"><code
2808 class=property>font-feature-settings</code></a>’ properties defined
2809 below except that the value ‘<code class=property>inherit</code>’ is
2810 omitted. When multiple font feature descriptors or properties are used,
2811 the cumulative effect on text rendering is detailed in the section <a
2812 href="#font-feature-resolution">Font Feature Resolution</a> below. In
2813 cases where specific values define synthesized fallback for certain ‘<a
2814 href="#propdef-font-variant"><code
2815 class=property>font-variant</code></a>’ subproperties, the same
2816 synthesized fallback applies when used within those values are used with
2817 the <a href="#descdef-font-variant">‘<code
2818 class=property>font-variant</code>’</a> descriptor.
2820 <h3 id=font-face-loading><span class=secno>4.7 </span>Font loading
2821 guidelines</h3>
2823 <p>The <code>@font-face</code> rule is designed to allow lazy loading of
2824 fonts, fonts are only downloaded when needed for use within a document. A
2825 stylesheet can include <code>@font-face</code> rules for a library of
2826 fonts of which only a select set are used; user agents must only download
2827 those fonts that are referred to within the style rules applicable to a
2828 given page. User agents that download all fonts defined in
2829 <code>@font-face</code> rules without considering whether those fonts are
2830 in fact used within a page are considered non-conformant. In cases where a
2831 font might be downloaded in character fallback cases, user agents may
2832 download a font if it's listed in a font list but is not actually used for
2833 a given text run.
2835 <pre>
2836 @font-face {
2837 font-family: GeometricModern;
2838 src: url(font.ttf);
2839 }
2841 p {
2842 /* font will be downloaded for pages with p elements */
2843 font-family: GeometricModern, sans-serif;
2844 }
2846 h2 {
2847 /* font may be downloaded for pages with h2 elements, even if Futura is available locally */
2848 font-family: Futura, GeometricModern, sans-serif;
2849 }
2850 </pre>
2852 <p>In cases where textual content is loaded before downloadable fonts are
2853 available, user agents may render text as it would be rendered if
2854 downloadable font resources are not available or they may render text
2855 transparently with fallback fonts to avoid a flash of text using a
2856 fallback font. In cases where the font download fails user agents must
2857 display text, simply leaving transparent text is considered non-conformant
2858 behavior. Authors are advised to use fallback fonts in their font lists
2859 that closely match the vertical metrics of the downloadable fonts to avoid
2860 large page reflows where possible.
2862 <h3 id=same-origin-restriction><span class=secno>4.8 </span>Same-origin
2863 restriction for fonts</h3>
2865 <h4 id=default-same-origin-restriction><span class=secno>4.8.1
2866 </span>Default same-origin restriction</h4>
2867 <!-- TPAC 2011 Resolution to require same-origin restriction for loading fonts:
2868 http://lists.w3.org/Archives/Public/www-style/2011Nov/0711.html
2869 http://www.w3.org/2011/10/31-webapps-minutes.html#item02
2870 -->
2872 <p>User agents must implement a same-origin restriction when loading fonts
2873 via the <code>@font-face</code> mechanism. This restriction limits the
2874 loading of fonts for a given document to fonts loaded from the same
2875 origin. Fonts can only be loaded via the same host, port, and method
2876 combination as the containing document, using the <a
2877 href="http://www.w3.org/TR/html5/browsers.html#origin">origin matching
2878 algorithm</a> described in the <a href="#HTML5"
2879 rel=biblioentry>[HTML5]<!--{{!HTML5}}--></a> specification. The origin of
2880 the stylesheet containing <code>@font-face</code> rules is not used when
2881 deciding whether a font is same origin or not, only the origin of the
2882 containing document is used. The restriction applies to all font types.
2884 <p>Given a document located at http://example.com/page.html, fonts defined
2885 with ‘<a href="#descdef-src"><code class=property>src</code></a>’
2886 definitions considered cross origin must not be loaded:
2888 <pre>
2889 /* same origin (i.e. domain, protocol, port match document) */
2890 src: url(fonts/simple.ttf);
2891 src: url(//fonts/simple.ttf);
2893 /* cross origin, different protocol */
2894 src: url(https://example.com/fonts/simple.ttf);
2896 /* cross origin, different domain */
2897 src: url(http://another.example.com/fonts/simple.ttf);
2898 </pre>
2900 <h4 id=allowing-cross-origin-font-loading><span class=secno>4.8.2
2901 </span>Allowing cross-origin font loading</h4>
2903 <p>User agents must also implement the ability to relax this restriction
2904 using cross-site origin controls <a href="#CORS"
2905 rel=biblioentry>[CORS]<!--{{!CORS}}--></a> for fonts loaded via HTTP.
2906 Sites can explicitly allow cross-site downloading of font data using the
2907 <code>Access-Control-Allow-Origin</code> HTTP header. For other protocols,
2908 no explicit relaxation mechanism is defined or required.
2910 <p>For font loads over HTTP, cross-origin requests must be made with the
2911 following parameter settings which are used in conjunction with the <a
2912 href="http://www.w3.org/TR/cors/#cross-origin-request-0"> <em>cross-origin
2913 request algorithm</em></a> <a href="#CORS"
2914 rel=biblioentry>[CORS]<!--{{!CORS}}--></a>:
2916 <ul>
2917 <li><em>request URL</em> — the URL of the font resource in the <a
2918 href="#descdef-src"><code>src</code></a> descriptor
2920 <li><em>request method</em> — GET
2922 <li><em>author request headers</em> — none
2924 <li><em>request entity body</em> — empty
2926 <li><em>source origin</em> — the origin of the page which linked to the
2927 stylesheet
2929 <li><em>manual redirect flag</em> — false
2931 <li><em>omit credentials flag</em> — true
2933 <li><em>force preflight flag</em> — false
2934 </ul>
2936 <h2 id=font-matching-algorithm><span class=secno>5 </span>Font Matching
2937 Algorithm</h2>
2939 <p>The algorithm below describes how fonts are associated with individual
2940 runs of text. For each character in the run a font family is chosen and a
2941 particular font face is selected containing a glyph for that character.
2943 <h3 id=font-family-casing><span class=secno>5.1 </span>Case sensitivity of
2944 font family names</h3>
2946 <p>As part of the font matching algorithm outlined below, user agents must
2947 match font family names used in style rules with actual font family names
2948 contained in fonts available in a given environment or defined via
2949 <code>@font-face</code> rules. User agents must match these names case
2950 insensitively, using the "Default Caseless Matching" algorithm outlined in
2951 the Unicode specification <a href="#UNICODE6"
2952 rel=biblioentry>[UNICODE6]<!--{{!UNICODE6}}--></a>. This algorithm is
2953 detailed in section 3.13 entitled "Default Case Algorithms". Specifically,
2954 the algorithm must be applied without normalizing the strings involved and
2955 without applying any language-specific tailorings. The case folding method
2956 specified by this algorithm uses the case mappings with status field
2957 ‘<code class=property>C</code>’ or ‘<code class=property>F</code>’
2958 in the CaseFolding.txt file of the Unicode Character Database.
2960 <p class=note> Implementors should take care to verify that a given
2961 caseless string comparison implementation uses this precise algorithm and
2962 not assume that a given platform string matching routine follows it, as
2963 many of these have locale-specific behavior or use some level of string
2964 normalization.
2966 <p class=note> For authors this means that font family names are matched
2967 case insensitively, whether or not those names exist in a platform font or
2968 in the <code>@font-face</code> rules contained in a stylesheet. Authors
2969 should take care to ensure that names use a character sequence consistent
2970 with the actual font family name, particularly when using combining
2971 characters such as diacritical marks. For example, a family name that
2972 contains an uppercase A (U+0041) followed by a combining ring (U+030A)
2973 will <strong>not</strong> match a name that looks identical but which uses
2974 the precomposed lowercase a-ring character (U+00E5) instead of the
2975 combining sequence.
2977 <h3 id=font-style-matching><span class=secno>5.2 </span>Matching font
2978 styles</h3>
2980 <p>The procedure for choosing fonts consists of iterating over the font
2981 families determined by the font-family property, selecting a font face
2982 with the appropriate style based on other font properties and then
2983 determining whether a glyph exists for a given character. This is done
2984 using the <dfn id=character-map>character map</dfn> of the font, data
2985 which maps characters to the default glyph for that character. Codepoint
2986 sequences consisting of a base character followed by a sequence of
2987 combining characters are treated slightly differently, see the section on
2988 <a href="#cluster-matching">cluster matching</a> below.
2990 <p>For this procedure, the <dfn id=default-face>default face</dfn> for a
2991 given font family is defined to be the face that would be selected if all
2992 font style properties were set to their initial value.
2994 <ol id=fontmatchingalg>
2995 <li>Using the computed font property values for a given element, the user
2996 agent starts with the first family name in the fontlist specified by the
2997 <span class=property>‘<a href="#descdef-font-family"><code
2998 class=property>font-family</code></a>’</span> property.
3000 <li>If the family name is unquoted and is a generic family name, the user
3001 agent looks up the appropriate font family name to be used. User agents
3002 may choose the generic font family to use based on the language of the
3003 containing element or the Unicode range of the character.
3005 <li>For other family names, the user agent attempts to find the family
3006 name among fonts defined via <code>@font-face</code> rules and then among
3007 available system fonts, matching names with a case-insensitive comparison
3008 as outlined <a href="#font-family-casing">in the section above</a>. On
3009 systems containing fonts with multiple localized font family names, user
3010 agents must match any of these names independent of the underlying system
3011 locale or platform API used. If the font resources defined for a given
3012 face in an @font-face rule are either not available or contain invalid
3013 font data, then the face should be treated as not present in the family.
3014 If no faces are present for a family defined via @font-face rules, the
3015 family should be treated as missing; matching a platform font with the
3016 same name must not occur in this case.
3018 <li>If a font family match occurs, the user agent assembles the set of
3019 font faces in that family and then narrows the set to a single face using
3020 other font properties in the order given below:
3021 <ol id=fontstylematchingalg>
3022 <li><span class=property>‘<a href="#propdef-font-stretch"><code
3023 class=property>font-stretch</code></a>’</span> is tried first. If the
3024 matching set contains faces with width values matching the ‘<a
3025 href="#propdef-font-stretch"><code
3026 class=property>font-stretch</code></a>’ value, faces with other width
3027 values are removed from the matching set. If there is no face that
3028 exactly matches the width value the nearest width is used instead. If
3029 the value of ‘<a href="#propdef-font-stretch"><code
3030 class=property>font-stretch</code></a>’ is ‘<a
3031 href="#normal2"><code class=property>normal</code></a>’ or one of the
3032 condensed values, narrower width values are checked first, then wider
3033 values. If the value of ‘<a href="#propdef-font-stretch"><code
3034 class=property>font-stretch</code></a>’ is one of the expanded
3035 values, wider values are checked first, followed by narrower values.
3036 Once the closest matching width has been determined by this process,
3037 faces with other widths are removed from the matching set.
3039 <li><span class=property>‘<a href="#propdef-font-style"><code
3040 class=property>font-style</code></a>’</span> is tried next. If the
3041 value of ‘<a href="#propdef-font-style"><code
3042 class=property>font-style</code></a>’ is ‘<code
3043 class=property>italic</code>’, italic faces are checked first, then
3044 oblique, then normal faces. If the value is ‘<code
3045 class=property>oblique</code>’, oblique faces are checked first, then
3046 italic faces and then normal faces. If the value is ‘<a
3047 href="#normal2"><code class=property>normal</code></a>’, normal faces
3048 are checked first, then oblique faces, then italic faces. Faces with
3049 other style values are excluded from the matching set. User agents are
3050 permitted to distinguish between italic and oblique faces within
3051 platform font families but this is not required, they may treat all
3052 italic or oblique faces as italic faces. However, within font families
3053 defined via <code>@font-face</code> rules, italic and oblique faces
3054 must be distinguished using the value of the ‘<a
3055 href="#propdef-font-style"><code
3056 class=property>font-style</code></a>’ descriptor.
3058 <li><span class=property>‘<a href="#propdef-font-weight"><code
3059 class=property>font-weight</code></a>’</span> is matched next, it
3060 will always reduce the matching set to a single font face. If
3061 bolder/lighter relative weights are used, the effective weight is
3062 calculated based on the inherited weight value, as described in the
3063 definition of the ‘<a href="#propdef-font-weight"><code
3064 class=property>font-weight</code></a>’ property. Given the desired
3065 weight and the weights of faces in the matching set after the steps
3066 above, if the desired weight is available that face matches. Otherwise,
3067 a weight is chosen using the rules below:
3068 <ul>
3069 <li>If the desired weight is less than 400, weights below the desired
3070 weight are checked in descending order followed by weights above the
3071 desired weight in ascending order until a match is found.
3073 <li>If the desired weight is greater than 500, weights above the
3074 desired weight are checked in ascending order followed by weights
3075 below the desired weight in descending order until a match is found.
3077 <li>If the desired weight is 400, 500 is checked first and then the
3078 rule for desired weights less than 400 is used.
3080 <li>If the desired weight is 500, 400 is checked first and then the
3081 rule for desired weights less than 400 is used.
3082 </ul>
3084 <li><span class=property>‘<a href="#propdef-font-size"><code
3085 class=property>font-size</code></a>’</span> must be matched within a
3086 UA-dependent margin of tolerance. (Typically, sizes for scalable fonts
3087 are rounded to the nearest whole pixel, while the tolerance for
3088 bitmapped fonts could be as large as 20%.) Further computations, e.g.,
3089 by ‘<code class=property>em</code>’ values in other properties, are
3090 based on the <span class=property>‘<a href="#propdef-font-size"><code
3091 class=property>font-size</code></a>’</span> value that is used, not
3092 the one that is specified.
3093 </ol>
3095 <li>
3096 <p>If no matching face exists or the matched face does not contain a
3097 glyph for the character to be rendered, the next family name is selected
3098 and the previous two steps repeated. Glyphs from other faces in the
3099 family are not considered. The only exception is that user agents may
3100 optionally substitute a synthetic version of the <a
3101 href="#default-face"><em>default face</em></a> if that face supports a
3102 given glyph (e.g. a synthetic italic version of the regular face may be
3103 used if the italic face doesn't support glyphs for Arabic).</p>
3104 <!-- resolution on the above: http://lists.w3.org/Archives/Public/www-style/2012Nov/0292.html -->
3106 <p>If the matched font is defined via an <code>@font-face</code> rule and
3107 needs to be downloaded, the font resource is downloaded. While the
3108 download occurs, the user agent can either wait until the font is
3109 downloaded or render once with substituted font metrics and render again
3110 once the font is downloaded.</p>
3112 <li>If there are no more font families to be evaluated and no matching
3113 face has been found, then the user agent performs a <em>system font
3114 fallback</em> procedure to find the best match for the character to be
3115 rendered. The result of this procedure may vary across user agents.
3117 <li>If a particular character cannot be displayed using any font, the user
3118 agent should indicate by some means that a character is not being
3119 displayed, displaying either a symbolic representation of the missing
3120 glyph (e.g. using a <a
3121 href="http://en.wikipedia.org/wiki/Last_resort_font">Last Resort
3122 Font</a>) or using the missing character glyph from a default font.
3123 </ol>
3125 <h3 id=cluster-matching><span class=secno>5.3 </span>Cluster matching</h3>
3127 <p>When text contains characters such as combining diacritics, ideally the
3128 base character should be rendered using the same font as the diacritic,
3129 this assures proper placement of the diacritic. For this reason, the font
3130 matching algorithm for clusters is more specialized than the general case
3131 of matching a single character by itself. For sequences containing
3132 variation selectors, which indicate the precise glyph to be used for a
3133 given character, user agents always attempt system font fallback to find
3134 the appropriate glyph before using the default glyph of the base
3135 character.
3137 <p>A font is considered to <em>support</em> a given character if (1) the
3138 character is contained in the font's <a
3139 href="#character-map"><em>character map</em></a> and (2) if required by
3140 the containing script, shaping information is available for that
3141 character. Some legacy fonts may include a given character in the <a
3142 href="#character-map"><em>character map</em></a> but lack the shaping
3143 information (e.g. <a
3144 href="http://www.microsoft.com/typography/otspec/ttochap1.htm">OpenType
3145 layout tables</a> or <a
3146 href="http://scripts.sil.org/cms/scripts/page.php?site_id=projects&item_id=graphite_techAbout">Graphite
3147 tables</a>) necessary for correctly rendering text runs containing that
3148 character.
3150 <p>A sequence of codepoints containing combining diacritics or other
3151 modifiers is termed a grapheme cluster (see <a href="#CSS3TEXT"
3152 rel=biblioentry>[CSS3TEXT]<!--{{CSS3TEXT}}--></a> for a more complete
3153 description). For a given cluster containing a base character, <em>b</em>
3154 and a sequence of combining characters <em>c1, c2…</em>, the entire
3155 cluster is matched using these steps:
3157 <ol>
3158 <li>For each family in the font list, a face is chosen using the style
3159 selection rules defined in the previous section.
3160 <ol>
3161 <li>If all characters in the sequence <em>b + c1 + c2 …</em> are
3162 completely supported by the font, select this font for the sequence.
3164 <li>If a sequence of multiple codepoints is canonically equivalent to a
3165 single character and the font supports that character, select this font
3166 for the sequence.
3167 </ol>
3169 <li>If no font was found in the font list in step 1:
3170 <ol>
3171 <li>If <em>c1</em> is a variation selector, system fallback must be used
3172 to find a font that supports the full sequence of <em>b + c1</em>. If
3173 no font on the system supports the full sequence, match the single
3174 character <em>b</em> using the normal procedure for matching single
3175 characters and ignore the variation selector. Note: a sequence with
3176 more than one variation selector is treated as an encoding error and
3177 the trailing selectors are ignored.
3179 <li>Otherwise, the user agent may optionally use system font fallback to
3180 match a font that supports the entire cluster.
3181 </ol>
3183 <li>If no font is found in step 2, use the matching sequence from step 1
3184 to determine the longest sequence that is completely matched by a font in
3185 the font list and attempt to match the remaining combining characters
3186 separately using the rules for single characters.
3187 </ol>
3189 <h3 id=char-handling-issues><span class=secno>5.4 </span>Character handling
3190 issues</h3>
3192 <p>The procedure above is always performed on text runs containing Unicode
3193 characters, documents using legacy encodings are assumed to have been
3194 transcoded before matching fonts. For fonts containing <a
3195 href="#character-map"><em title="character map">character maps</em></a>
3196 for both legacy encodings and Unicode, the contents of the legacy encoding
3197 <a href="#character-map"><em>character map</em></a> must have no effect on
3198 the results of the font matching process.
3200 <p>The font matching process does not assume that text runs are in either
3201 normalized or denormalized form (see <a href="#CHARMOD-NORM"
3202 rel=biblioentry>[CHARMOD-NORM]<!--{{CHARMOD-NORM}}--></a> for more
3203 details). Layout engines often convert base character plus combining
3204 character sequences into precomposed characters if they exist. The font
3205 matching algorithm outlined here supports both ways and fonts can
3206 generally support either but variations can occur. Authors should always
3207 tailor their choice of fonts to their content, including whether that
3208 content contains normalized or denormalized character streams.
3210 <p>If a given character is a Private-Use Area Unicode codepoint and none of
3211 the fonts in the fontlist contain a glyph for that codepoint, user agents
3212 must display some form of missing glyph symbol for that character rather
3213 than attempting system font fallback for that codepoint. When matching the
3214 replacement character U+FFFD, user agents may skip the font matching
3215 process and immediately display some form of missing glyph symbol, they
3216 are not required to display the glyph from the font that would be selected
3217 by the font matching process.
3219 <p>In general, the fonts for a given family will all have the same or
3220 similar <a href="#character-map"><em title="character map">character
3221 maps</em></a>. The process outlined here is designed to handle even font
3222 families containing faces with widely variant <a href="#character-map"><em
3223 title="character map">character maps</em></a>. However, authors are
3224 cautioned that the use of such families can lead to unexpected results.
3226 <p>Optimizations of this process are allowed provided that an
3227 implementation behaves as if the algorithm had been followed exactly.
3228 Matching occurs in a well-defined order to insure that the results are as
3229 consistent as possible across user agents, given an identical set of
3230 available fonts and rendering technology.
3232 <h3 id=font-matching-changes><span class=secno>5.5 </span>Font matching
3233 changes since CSS 2.1</h3>
3235 <p>The algorithm above is different from CSS 2.1 in a number of key places.
3236 These changes were made to better reflect actual font matching behavior
3237 across user agent implementations.
3239 <p>Differences compared to the font matching algorithm in CSS 2.1:
3241 <ul>
3242 <li>The algorithm includes font-stretch matching.
3244 <li>All possible font-style matching scenarios are delineated.
3246 <li>Small-caps fonts are not matched as part of the font matching process,
3247 they are now handled via font features.
3249 <li>Unicode variation selector matching is required.
3251 <li>Cluster sequences are matched as a unit.
3252 </ul>
3254 <h3 id=font-matching-examples><span class=secno>5.6 </span>Font matching
3255 examples</h3>
3257 <div class=example>
3258 <p>It's useful to note that the CSS selector syntax may be used to create
3259 language-sensitive typography. For example, some Chinese and Japanese
3260 characters are unified to have the same Unicode code point, although the
3261 abstract glyphs are not the same in the two languages.
3263 <pre>*:lang(ja-jp) { font: 900 14pt/16pt "Heisei Mincho W9", serif; }
3264 *:lang(zh-tw) { font: 800 14pt/16.5pt "Li Sung", serif; }
3265 </pre>
3267 <p>This selects any element that has the given language - Japanese or
3268 Traditional Chinese - and uses the appropriate font.
3269 </div>
3271 <h2 id=font-rend-props><span class=secno>6 </span>Font Feature Properties</h2>
3273 <p>Modern font technologies support a variety of advanced typographic and
3274 language-specific font features. Using these features, a single font can
3275 provide glyphs for a wide range of ligatures, contextual and stylistic
3276 alternates, tabular and old-style figures, small capitals, automatic
3277 fractions, swashes, and alternates specific to a given language. To allow
3278 authors control over these font capabilities, the font-variant property
3279 has been expanded for CSS3, it now functions as a shorthand for a set of
3280 properties that provide control over stylistic font features.
3282 <h3 id=glyph-selection-positioning><span class=secno>6.1 </span>Glyph
3283 selection and positioning</h3>
3285 <p>Simple fonts used for displaying Latin text use a very basic processing
3286 model, fonts contain a <a href="#character-map"><em>character map</em></a>
3287 which maps a given character to a glyph for that character. Glyphs for
3288 subsequent characters are simply placed next in line along a run of text.
3289 Font formats such as OpenType and AAT (Apple Advanced Typography) use a
3290 richer processing model, the glyph for a given character can be chosen and
3291 positioned not just based on a single character, but also based on
3292 surrounding characters along with the language, script, and features
3293 enabled for the text. Font features may be required for specific scripts,
3294 or recommended as enabled by default or they may be stylistic features
3295 meant to be used under author control.
3297 <p>For a good visual overview of these features, see the <a
3298 href="#OPENTYPE-FONT-GUIDE"
3299 rel=biblioentry>[OPENTYPE-FONT-GUIDE]<!--{{OPENTYPE-FONT-GUIDE}}--></a>.
3300 For a detailed description of glyph processing for OpenType fonts, see <a
3301 href="#WINDOWS-GLYPH-PROC"
3302 rel=biblioentry>[WINDOWS-GLYPH-PROC]<!--{{WINDOWS-GLYPH-PROC}}--></a>.
3304 <p>Stylistic font features can be classified into two broad categories,
3305 ones that affect the harmonization of glyph shapes with the surrounding
3306 context, such as kerning and ligature features, and those such as the
3307 small-caps, subscript/superscript and alternate features that affect shape
3308 selection.
3310 <p>The subproperties of font-variant listed below are used to control these
3311 stylistic font features; they do not control features that are required
3312 for displaying certain scripts, such as the OpenType features used when
3313 displaying Arabic or Indic language text. They affect glyph selection and
3314 positioning, they do not affect font selection as described in the font
3315 matching section (except in cases required for compatibility with CSS
3316 2.1).
3318 <p>To assure consistent behavior across user agents, the equivalent
3319 OpenType property settings are listed for individual properties and must
3320 be considered normative. When using other font formats these should be
3321 used as a guideline to map CSS font feature property values to specific
3322 font features.
3324 <h3 id=language-specific-support><span class=secno>6.2
3325 </span>Language-specific display</h3>
3327 <p>OpenType also supports language-specific glyph selection and
3328 positioning, so that text can be displayed correctly in cases where the
3329 language dictates a specific display behavior. Languages often share a
3330 common script but the shape of certain letters may vary across those
3331 languages, such as the variations in certain Cyrillic letters used in
3332 Russian and Bulgarian text. In Latin text, it's common to render "fi" with
3333 an explicit fi-ligature that lacks a dot on the "i". However, in languages
3334 such as Turkish which uses both a dotted-i and a dotless-i, it's important
3335 to not use this ligature or use a specialized version that contains a dot
3336 over the "i". The example below shows language-specific variations based
3337 on stylistic traditions found in Spanish, Italian and French orthography:
3339 <div class=featex><img alt="language specific forms, spanish"
3340 src=locl-1.png></div>
3342 <div class=featex><img alt="language specific forms, italian"
3343 src=locl-2.png></div>
3345 <div class=featex><img alt="language specific forms, french"
3346 src=locl-3.png></div>
3348 <p>If the content language of the element is known, according to the rules
3349 of the <a
3350 href="http://www.w3.org/TR/CSS21/conform.html#doclanguage">document
3351 language</a>, user agents are required to infer the OpenType language
3352 system from the content language and use that when selecting and
3353 positioning glyphs using an OpenType font.
3355 <p>For OpenType fonts, in some cases it may be necessary to explicitly
3356 declare the OpenType language to be used, for example when displaying text
3357 in a given language that uses the typographic conventions of another
3358 language or when the font does not explicitly support a given language but
3359 supports a language that shares common typographic conventions. The ‘<a
3360 href="#propdef-font-language-override"><code
3361 class=property>font-language-override</code></a>’ property is used for
3362 this purpose.
3364 <p class=issue>Should user agents be allowed to infer the OpenType language
3365 or simply use only the default language system? Do we also need a
3366 normative definition of how the script system is inferred?</p>
3367 <!-- prop: font-kerning -->
3369 <h3 id=font-kerning-prop><span class=secno>6.3 </span>Kerning: the <a
3370 href="#propdef-font-kerning">font-kerning</a> property</h3>
3372 <table class=propdef id=namefont-kerningvalueauto-normal-noneini>
3373 <tbody>
3374 <tr>
3375 <td>Name:
3377 <td><dfn id=propdef-font-kerning>font-kerning</dfn>
3379 <tr>
3380 <td>Value:
3382 <td>auto | normal | none
3384 <tr>
3385 <td>Initial:
3387 <td>auto
3389 <tr>
3390 <td>Applies to:
3392 <td>all elements
3394 <tr>
3395 <td>Inherited:
3397 <td>yes
3399 <tr>
3400 <td>Percentages:
3402 <td>N/A
3404 <tr>
3405 <td>Media:
3407 <td>visual
3409 <tr>
3410 <td>Computed value:
3412 <td>as specified
3414 <tr>
3415 <td>Animatable:
3417 <td>no
3418 </table>
3420 <p>Kerning is the contextual adjustment of inter-glyph spacing. This
3421 property controls metric kerning, kerning that utilizes adjustment data
3422 contained in the font. The value ‘<a href="#normal2"><code
3423 class=property>normal</code></a>’ implies that kerning is applied while
3424 the value ‘<code class=property>none</code>’ implies that kerning is
3425 not applied when rendering text. If the value is ‘<code
3426 class=property>auto</code>’, a user agent is free to choose whether
3427 kerning is enabled or not by default and to vary that default based on the
3428 underlying text script.
3430 <p>For fonts that do not include kerning data this property will have no
3431 visible effect. When rendering with OpenType fonts, the <a
3432 href="#OPENTYPE" rel=biblioentry>[OPENTYPE]<!--{{!OPENTYPE}}--></a>
3433 specification suggests that kerning be enabled by default. When kerning is
3434 enabled, the OpenType <span class=tag>kern</span> feature is enabled (for
3435 vertical text runs the <span class=tag>vkrn</span> feature is enabled).
3436 User agents must also support fonts that only support kerning via data
3437 contained in a ‘<code class=property>kern</code>’ font table, as
3438 detailed in the OpenType specification. Authors may prefer to disable
3439 kerning in situations where performance is more important that precise
3440 appearance. If the ‘<code class=property>letter-spacing</code>’
3441 property is defined, kerning adjustments are considered part of the
3442 default spacing, letter spacing adjustments are made after kerning has
3443 been applied.</p>
3444 <!-- prop: font-variant-ligatures -->
3446 <h3 id=font-variant-ligatures-prop><span class=secno>6.4 </span>Ligatures:
3447 the <a href="#propdef-font-variant-ligatures">font-variant-ligatures</a>
3448 property</h3>
3450 <table class=propdef id=namefont-variant-ligaturesvaluenormal-no>
3451 <tbody>
3452 <tr>
3453 <td>Name:
3455 <td><dfn id=propdef-font-variant-ligatures>font-variant-ligatures</dfn>
3457 <tr>
3458 <td>Value:
3460 <td>normal | none | [ <common-lig-values> ||
3461 <discretionary-lig-values> || <historical-lig-values> ||
3462 <contextual-alt-values> ]
3464 <tr>
3465 <td>Initial:
3467 <td>normal
3469 <tr>
3470 <td>Applies to:
3472 <td>all elements
3474 <tr>
3475 <td>Inherited:
3477 <td>yes
3479 <tr>
3480 <td>Percentages:
3482 <td>N/A
3484 <tr>
3485 <td>Media:
3487 <td>visual
3489 <tr>
3490 <td>Computed value:
3492 <td>as specified
3494 <tr>
3495 <td>Animatable:
3497 <td>no
3498 </table>
3500 <p>Ligatures and contextual forms are ways of combining glyphs to produce
3501 more harmonized forms. A value of ‘<a href="#normal2"><code
3502 class=property>normal</code></a>’ implies that common default features
3503 are enabled, <a href="#font-feature-resolution">as described in detail in
3504 the next section</a>. For OpenType fonts, common ligatures and contextual
3505 forms are on by default, discretionary and historical ligatures are not. A
3506 value of ‘<code class=property>none</code>’ implies that all types of
3507 ligatures and contextual forms covered by this property are explicitly
3508 disabled. In situations where ligatures are not considered necessary, this
3509 may improve the speed of text rendering.
3511 <pre
3512 class=prod><dfn id=ltcommon-lig-values><var><common-lig-values></var></dfn> = [ common-ligatures | no-common-ligatures ]</pre>
3514 <pre
3515 class=prod><dfn id=ltdiscretionary-lig-values><var><discretionary-lig-values></var></dfn> = [ discretionary-ligatures | no-discretionary-ligatures ]</pre>
3517 <pre
3518 class=prod><dfn id=lthistorical-lig-values><var><historical-lig-values></var></dfn> = [ historical-ligatures | no-historical-ligatures ]</pre>
3520 <pre
3521 class=prod><dfn id=ltcontextual-alt-valuesgt><var><contextual-alt-values></var></dfn> = [ contextual | no-contextual ]</pre>
3523 <p>Individual values have the following meanings:
3525 <dl>
3526 <dt><dfn id=common-ligatures>common-ligatures</dfn>
3528 <dd>Enables display of common ligatures (OpenType features: <span
3529 class=tag>liga, clig</span>). For OpenType fonts, common ligatures are
3530 enabled by default.
3531 </dl>
3533 <div class=featex><img alt="common ligature example" src=liga.png></div>
3535 <dl>
3536 <dt><dfn id=no-common-ligatures>no-common-ligatures</dfn>
3538 <dd>Disables display of common ligatures (OpenType features: <span
3539 class=tag>liga, clig</span>).
3541 <dt><dfn id=discretionary-ligatures>discretionary-ligatures</dfn>
3543 <dd>Enables display of discretionary ligatures (OpenType feature: <span
3544 class=tag>dlig</span>). Which ligatures are discretionary, or optional,
3545 is decided by the type designer so authors will need to refer to the
3546 documentation of a given font to understand which ligatures are
3547 considered discretionary.
3548 </dl>
3550 <div class=featex><img alt="discretionary ligature example" src=dlig.png></div>
3552 <dl>
3553 <dt><dfn id=no-discretionary-ligatures>no-discretionary-ligatures</dfn>
3555 <dd>Disables display of discretionary ligatures (OpenType feature: <span
3556 class=tag>dlig</span>).
3558 <dt><dfn id=historical-ligatures>historical-ligatures</dfn>
3560 <dd>Enables display of historical ligatures (OpenType feature: <span
3561 class=tag>hlig</span>).
3562 </dl>
3564 <div class=featex><img alt="historical ligature example" src=hlig.png></div>
3566 <dl>
3567 <dt><dfn id=no-historical-ligatures>no-historical-ligatures</dfn>
3569 <dd>Disables display of historical ligatures (OpenType feature: <span
3570 class=tag>hlig</span>).
3572 <dt><dfn id=contextual>contextual</dfn>
3574 <dd>Enables display of contextual alternates (OpenType feature: <span
3575 class=tag>calt</span>). Although not strictly a ligature feature, like
3576 ligatures this feature is commonly used to harmonize the shapes of glyphs
3577 with the surrounding context. For OpenType fonts, this feature is on by
3578 default.
3579 </dl>
3581 <div class=featex><img alt="contextual alternate example" src=calt.png></div>
3583 <dl>
3584 <dt><dfn id=no-contextual>no-contextual</dfn>
3586 <dd>Disables display of contextual alternates (OpenType feature: <span
3587 class=tag>calt</span>).
3588 </dl>
3590 <p>Required ligatures, needed for correctly rendering complex scripts, are
3591 not affected by the settings above, including ‘<code
3592 class=property>none</code>’ (OpenType feature: <span
3593 class=tag>rlig</span>).</p>
3594 <!-- prop: font-variant-position -->
3596 <h3 id=font-variant-position-prop><span class=secno>6.5 </span>Subscript
3597 and superscript forms: the <a
3598 href="#propdef-font-variant-position">font-variant-position</a> property</h3>
3600 <table class=propdef id=namefont-variant-positionvaluenormal-sub>
3601 <tbody>
3602 <tr>
3603 <td>Name:
3605 <td><dfn id=propdef-font-variant-position>font-variant-position</dfn>
3607 <tr>
3608 <td>Value:
3610 <td>normal | sub | super
3612 <tr>
3613 <td>Initial:
3615 <td>normal
3617 <tr>
3618 <td>Applies to:
3620 <td>all elements
3622 <tr>
3623 <td>Inherited:
3625 <td>yes
3627 <tr>
3628 <td>Percentages:
3630 <td>N/A
3632 <tr>
3633 <td>Media:
3635 <td>visual
3637 <tr>
3638 <td>Computed value:
3640 <td>as specified
3642 <tr>
3643 <td>Animatable:
3645 <td>no
3646 </table>
3648 <p>This property is used to enable typographic subscript and superscript
3649 glyphs. These are alternate glyphs designed within the same em-box as
3650 default glyphs and are intended to be laid out on the same baseline as the
3651 default glyphs, with no resizing or repositioning of the baseline. They
3652 are explicitly designed to match the surrounding text and to be more
3653 readable without affecting the line height.
3655 <div class=figure><img alt="comparison between real subscript glyphs and
3656 synthesized ones" src=realsubscripts.png>
3657 <p class=caption>Subscript glyphs (top) vs. typical synthesized subscripts
3658 (bottom)
3659 </div>
3661 <p>The values ‘<code class=property>sub</code>’ and ‘<code
3662 class=property>super</code>’ imply the appropriate variant glyph is
3663 displayed when available in the font (OpenType features: <span
3664 class=tag>subs, sups</span>). A value of ‘<a href="#normal2"><code
3665 class=property>normal</code></a>’ implies neither of these alternate
3666 glyphs are substituted.
3668 <p>Because of the semantic nature of subscripts and superscripts, when the
3669 value is either ‘<code class=property>sub</code>’ or ‘<code
3670 class=property>super</code>’ for a given contiguous run of text, if a
3671 variant glyph is not available for all the characters in the run,
3672 simulated glyphs must be synthesized for all characters using reduced
3673 forms of the glyphs that would be used without this feature applied. This
3674 is done to avoid a mixture of variant glyphs and synthesized ones that
3675 would not align correctly.
3677 <p>In the case of OpenType fonts that lack subscript or superscript glyphs
3678 for a given character, user agents must use the appropriate subscript and
3679 superscript metrics specified in the selected font's <a
3680 href="http://www.microsoft.com/typography/otspec/os2.htm#subxs">OS/2
3681 table</a> <a href="#OPENTYPE"
3682 rel=biblioentry>[OPENTYPE]<!--{{!OPENTYPE}}--></a> to calculate the size
3683 and offset of the synthesized substitutes.
3685 <p>In the past, user agents have used font-size and vertical-align to
3686 simulate subscripts and superscripts for the <span class=tag>sub</span>
3687 and <span class=tag>sup</span> elements. To allow a backwards compatible
3688 way of defining subscripts and superscripts, it is recommended that
3689 authors use conditional rules <a href="#CSS3-CONDITIONAL"
3690 rel=biblioentry>[CSS3-CONDITIONAL]<!--{{CSS3-CONDITIONAL}}--></a> so that
3691 older user agents will still render subscripts and superscripts via the
3692 older mechanism.
3694 <p>Authors should note that fonts typically only provide subscript and
3695 superscript glyphs for a subset of all characters supported by the font.
3696 While subscript and superscript glyphs are often available for Latin
3697 numbers, glyphs for punctuation and letter characters are less frequently
3698 provided. The synthetic fallback rules defined for this property assure
3699 that subscripts and superscripts will always appear but the appearance may
3700 not match author expectations if the font used does not provide the
3701 appropriate alternate glyph for all characters contained in a subscript or
3702 superscript.
3704 <div class=figure><img alt="alternate superscripts vs. glyphs synthesized
3705 using superscript metrics" src=superscript-alt-synth.png>
3706 <p class=caption>Superscript alternate glyph (left), synthesized
3707 superscript glyphs (middle), and incorrect mixture of the two (right)
3708 </div>
3710 <p>This property is not cumulative, applying it to subelements within a
3711 subscript or superscript won't nest the placement of a subscript or
3712 superscript glyph. Images contained within text runs where the value of
3713 this property is ‘<code class=property>sub</code>’ or ‘<code
3714 class=property>super</code>’ will be drawn just as they would if the
3715 value was ‘<a href="#normal2"><code class=property>normal</code></a>’.
3716 Likewise, text decorations such as underlines or emphasis marks will
3717 render in the same position as they would for the default glyphs, since
3718 this property does not affect the baseline position.
3720 <p>Because of these limitations, font-variant-position is not recommended
3721 for use in user agent stylesheets. Authors should use it in cases where
3722 subscripts or superscripts will only contain the narrow range of
3723 characters supported by the fonts specified.
3725 <div class=example>
3726 <p>A typical user agent default style for the <span class=tag>sub</span>
3727 element:</p>
3729 <pre>sub {
3730 vertical-align: sub;
3731 font-size: smaller;
3732 line-height: normal;
3733 }
3734 </pre>
3736 <p>Using font-variant-position to specify typographic subscripts in a way
3737 that will still show subscripts in older user agents:</p>
3739 <pre>@supports ( font-variant-position: sub ) {
3741 sub {
3742 vertical-align: inherit;
3743 font-size: 100%;
3744 line-height: inherit;
3745 font-variant-position: sub;
3746 }
3748 }
3749 </pre>
3751 <p>User agents that support the ‘<a
3752 href="#propdef-font-variant-position"><code
3753 class=property>font-variant-position</code></a>’ property will select a
3754 subscript variant glyph and render this without adjusting the baseline or
3755 font-size. Older user agents will ignore the ‘<a
3756 href="#propdef-font-variant-position"><code
3757 class=property>font-variant-position</code></a>’ property definition
3758 and use the standard defaults for subscripts.</p>
3759 </div>
3760 <!-- prop: font-variant-caps -->
3762 <h3 id=font-variant-caps-prop><span class=secno>6.6 </span>Capitalization:
3763 the <a href="#propdef-font-variant-caps">font-variant-caps</a> property</h3>
3765 <table class=propdef id=namefont-variant-capsvaluenormal-small-c>
3766 <tbody>
3767 <tr>
3768 <td>Name:
3770 <td><dfn id=propdef-font-variant-caps>font-variant-caps</dfn>
3772 <tr>
3773 <td>Value:
3775 <td>normal | small-caps | all-small-caps | petite-caps | all-petite-caps
3776 | unicase | titling-caps
3778 <tr>
3779 <td>Initial:
3781 <td>normal
3783 <tr>
3784 <td>Applies to:
3786 <td>all elements
3788 <tr>
3789 <td>Inherited:
3791 <td>yes
3793 <tr>
3794 <td>Percentages:
3796 <td>N/A
3798 <tr>
3799 <td>Media:
3801 <td>visual
3803 <tr>
3804 <td>Computed value:
3806 <td>as specified
3808 <tr>
3809 <td>Animatable:
3811 <td>no
3812 </table>
3814 <p>Specifies control over capitalized forms.
3816 <p>Individual values have the following meanings:
3818 <dl>
3819 <dt><dfn id=normal>normal</dfn>
3821 <dd>None of the features listed below are enabled.
3823 <dt><dfn id=small-caps>small-caps</dfn>
3825 <dd>Enables display of small capitals (OpenType feature: <span
3826 class=tag>smcp</span>). Small-caps glyphs typically use the form of
3827 uppercase letters but are reduced to the size of lowercase letters.
3828 </dl>
3830 <div class=featex><img alt="small-caps example" src=smcp.png></div>
3832 <dl>
3833 <dt><dfn id=all-small-caps>all-small-caps</dfn>
3835 <dd>Enables display of small capitals for both upper and lowercase letters
3836 (OpenType features: <span class=tag>c2sc, smcp</span>).
3838 <dt><dfn id=petite-caps>petite-caps</dfn>
3840 <dd>Enables display of petite capitals (OpenType feature: <span
3841 class=tag>pcap</span>).
3843 <dt><dfn id=all-petite-caps>all-petite-caps</dfn>
3845 <dd>Enables display of petite capitals for both upper and lowercase
3846 letters (OpenType features: <span class=tag>c2pc, pcap</span>).
3848 <dt><dfn id=unicase>unicase</dfn>
3850 <dd>Enables display of mixture of small capitals for uppercase letters
3851 with normal lowercase letters (OpenType feature: <span
3852 class=tag>unic</span>).
3854 <dt><dfn id=titling-caps>titling-caps</dfn>
3856 <dd>Enables display of titling capitals (OpenType feature: <span
3857 class=tag>titl</span>). Uppercase letter glyphs are often designed for
3858 use with lowercase letters. When used in all uppercase titling sequences
3859 they can appear too strong. Titling capitals are designed specifically
3860 for this situation.
3861 </dl>
3863 <p>This property allows the selection of alternate glyphs used for small or
3864 petite capitals or for titling. These glyphs are specifically designed to
3865 blend well with the surrounding normal glyphs, to maintain the weight and
3866 readability which suffers when text is simply resized to fit this purpose.
3868 <p>The availability of these glyphs is based on whether a given feature is
3869 defined or not in the feature list of the font. User agents can optionally
3870 decide this on a per-script basis but should explicitly not decide this on
3871 a per-character basis.
3873 <p>Some fonts may only support a subset or none of the features described
3874 for this property. For backwards compatibility with CSS 2.1, if ‘<a
3875 href="#small-caps"><code class=property>small-caps</code></a>’ or ‘<a
3876 href="#all-small-caps"><code class=property>all-small-caps</code></a>’
3877 is specified but small-caps glyphs are not available for a given font,
3878 user agents should simulate a small-caps font, for example by taking a
3879 normal font and replacing the glyphs for lowercase letters with scaled
3880 versions of the glyphs for uppercase characters (replacing the glyphs for
3881 both upper and lowercase letters in the case of ‘<a
3882 href="#all-small-caps"><code class=property>all-small-caps</code></a>’).
3884 <div class=figure style="padding: 0; margin: auto;"><img alt="synthetic vs.
3885 real small-caps" class=hires src=synthetic-vs-real-small-caps.png
3886 width=512px>
3887 <p class=caption>Synthetic vs. real small-caps
3888 </div>
3890 <p>To match the surrounding text, a font may provide alternate glyphs for
3891 caseless characters when these features are enabled but when a user agent
3892 simulates small capitals, it must not attempt to simulate alternates for
3893 codepoints which are considered caseless.
3895 <div class=figure style="padding: 0; margin: auto;"><img alt="caseless
3896 characters with small-caps, all-small-caps enabled" class=hires
3897 src=small-capitals-variations.png width=418px>
3898 <p class=caption>Caseless characters with small-caps, all-small-caps
3899 enabled
3900 </div>
3902 <p>If either ‘<a href="#petite-caps"><code
3903 class=property>petite-caps</code></a>’ or ‘<a
3904 href="#all-petite-caps"><code class=property>all-petite-caps</code></a>’
3905 is specified for a font that doesn't support these features, the property
3906 behaves as if ‘<a href="#small-caps"><code
3907 class=property>small-caps</code></a>’ or ‘<a
3908 href="#all-small-caps"><code class=property>all-small-caps</code></a>’,
3909 respectively, had been specified. If ‘<a href="#unicase"><code
3910 class=property>unicase</code></a>’ is specified for a font that doesn't
3911 support that feature, the property behaves as if ‘<a
3912 href="#small-caps"><code class=property>small-caps</code></a>’ was
3913 applied only to lowercased uppercase letters. If ‘<a
3914 href="#titling-caps"><code class=property>titling-caps</code></a>’ is
3915 specified with a font that does not support this feature, this property
3916 has no visible effect. When simulated small capital glyphs are used, for
3917 scripts that lack uppercase and lowercase letters, ‘<a
3918 href="#small-caps"><code class=property>small-caps</code></a>’, ‘<a
3919 href="#all-small-caps"><code class=property>all-small-caps</code></a>’,
3920 ‘<a href="#petite-caps"><code class=property>petite-caps</code></a>’,
3921 ‘<a href="#all-petite-caps"><code
3922 class=property>all-petite-caps</code></a>’ and ‘<a
3923 href="#unicase"><code class=property>unicase</code></a>’ have no visible
3924 effect.
3926 <p>When casing transforms are used to simulate small capitals, the casing
3927 transformations should match those used for the <span
3928 class=property>‘<code class=property>text-transform</code>’</span>
3929 property.
3931 <p>As a last resort, unscaled uppercase letter glyphs in a normal font may
3932 replace glyphs in a small-caps font so that the text appears in all
3933 uppercase letters.
3935 <div class=figure style="padding: 0; margin: auto;"><img alt="using
3936 all-small-caps in acronym-laden text" class=hires
3937 src=acronym-laden-text.png width=596px>
3938 <p class=caption>Using small capitals to improve readability in
3939 acronym-laden text
3940 </div>
3942 <div class=example>
3943 <p>Quotes rendered italicised, with small-caps on the first line:</p>
3945 <pre>blockquote { font-style: italic; }
3946 blockquote:first-line { font-variant: small-caps; }
3948 <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>
3949 </pre>
3950 </div>
3951 <!-- prop: font-variant-numeric -->
3953 <h3 id=font-variant-numeric-prop><span class=secno>6.7 </span>Numerical
3954 formatting: the <a
3955 href="#propdef-font-variant-numeric">font-variant-numeric</a> property</h3>
3957 <table class=propdef id=namefont-variant-numericvaluenormal-ltnu>
3958 <tbody>
3959 <tr>
3960 <td>Name:
3962 <td><dfn id=propdef-font-variant-numeric>font-variant-numeric</dfn>
3964 <tr>
3965 <td>Value:
3967 <td>normal | [ <numeric-figure-values> ||
3968 <numeric-spacing-values> || <numeric-fraction-values> ||
3969 ordinal || slashed-zero ]
3971 <tr>
3972 <td>Initial:
3974 <td>normal
3976 <tr>
3977 <td>Applies to:
3979 <td>all elements
3981 <tr>
3982 <td>Inherited:
3984 <td>yes
3986 <tr>
3987 <td>Percentages:
3989 <td>N/A
3991 <tr>
3992 <td>Media:
3994 <td>visual
3996 <tr>
3997 <td>Computed value:
3999 <td>as specified
4001 <tr>
4002 <td>Animatable:
4004 <td>no
4005 </table>
4007 <p>Specifies control over numerical forms.
4009 <pre
4010 class=prod><dfn id=ltnumeric-figure-valuesgt><var><numeric-figure-values></var></dfn> = [ lining-nums | oldstyle-nums ]</pre>
4012 <pre
4013 class=prod><dfn id=ltnumeric-spacing-valuesgt><var><numeric-spacing-values></var></dfn> = [ proportional-nums | tabular-nums ]</pre>
4015 <pre
4016 class=prod><dfn id=ltnumeric-fraction-valuesgt><var><numeric-fraction-values></var></dfn> = [ diagonal-fractions | stacked-fractions ]</pre>
4018 <p>Individual values have the following meanings:
4020 <dl>
4021 <dt><dfn id=normal0>normal</dfn>
4023 <dd>None of the features listed below are enabled.
4025 <dt><dfn id=lining-nums>lining-nums</dfn>
4027 <dd>Enables display of lining numerals (OpenType feature: <span
4028 class=tag>lnum</span>).
4030 <dt><dfn id=oldstyle-nums>oldstyle-nums</dfn>
4032 <dd>Enables display of old-style numerals (OpenType feature: <span
4033 class=tag>onum</span>).
4035 <dt><dfn id=proportional-nums>proportional-nums</dfn>
4037 <dd>Enables display of proportional numerals (OpenType feature: <span
4038 class=tag>pnum</span>).
4040 <dt><dfn id=tabular-nums>tabular-nums</dfn>
4042 <dd>Enables display of tabular numerals (OpenType feature: <span
4043 class=tag>tnum</span>).
4044 </dl>
4046 <p>The example below shows how these different properties can be combined
4047 to influence the rendering of tabular data with fonts that support these
4048 features. Within normal paragraph text, proportional numbers are used
4049 while tabular numbers are used so that columns of numbers line up
4050 properly:
4052 <div class=figure style="padding: 0; margin: auto;"><img alt="combining
4053 number styles" src=numberstyles.png>
4054 <p class=caption>Using number styles
4055 </div>
4057 <dl>
4058 <dt><dfn id=diagonal-fractions>diagonal-fractions</dfn>
4060 <dd>Enables display of lining diagonal fractions (OpenType feature: <span
4061 class=tag>frac</span>).
4062 </dl>
4064 <div class=featex><img alt="diagonal fraction example" src=frac.png></div>
4066 <dl>
4067 <dt><dfn id=stacked-fractions>stacked-fractions</dfn>
4069 <dd>Enables display of lining stacked fractions (OpenType feature: <span
4070 class=tag>afrc</span>).
4071 </dl>
4073 <div class=featex><img alt="stacked fraction example" src=afrc.png></div>
4075 <dl>
4076 <dt><dfn id=ordinal>ordinal</dfn>
4078 <dd>Enables display of forms used with ordinal numbers (OpenType feature:
4079 <span class=tag>ordn</span>).
4081 <dt><dfn id=slashed-zero>slashed-zero</dfn>
4083 <dd>Enables display of slashed zeros (OpenType feature: <span
4084 class=tag>zero</span>).
4085 </dl>
4087 <div class=featex><img alt="slashed zero example" src=zero.png></div>
4089 <div class=example id=steak-marinade>
4090 <p>A simple flank steak marinade recipe, rendered with automatic fractions
4091 and old-style numerals:</p>
4093 <pre>.amount { font-variant-numeric: oldstyle-nums diagonal-fractions; }
4095 <h4>Steak marinade:</h4>
4096 <ul>
4097 <li><span class="amount">2</span> tbsp olive oil</li>
4098 <li><span class="amount">1</span> tbsp lemon juice</li>
4099 <li><span class="amount">1</span> tbsp soy sauce</li>
4100 <li><span class="amount">1 1/2</span> tbsp dry minced onion</li>
4101 <li><span class="amount">2 1/2</span> tsp italian seasoning</li>
4102 <li>Salt &amp; pepper</li>
4103 </ul>
4105 <p>Mix the meat with the marinade and let it sit covered in the refrigerator
4106 for a few hours or overnight.</p>
4107 </pre>
4108 </div>
4109 <!-- prop: font-variant-alternates -->
4111 <h3 id=font-variant-alternates-prop><span class=secno>6.8 </span>Alternates
4112 and swashes: the <a
4113 href="#propdef-font-variant-alternates">font-variant-alternates</a>
4114 property</h3>
4116 <table class=propdef id=namefont-variant-alternatesvaluenormal-s>
4117 <tbody>
4118 <tr>
4119 <td>Name:
4121 <td><dfn
4122 id=propdef-font-variant-alternates>font-variant-alternates</dfn>
4124 <tr>
4125 <td>Value:
4127 <td>normal | [ stylistic(<feature-value-name>) || historical-forms
4128 || styleset(<feature-value-name>#) ||
4129 character-variant(<feature-value-name>#) ||
4130 swash(<feature-value-name>) ||
4131 ornaments(<feature-value-name>) ||
4132 annotation(<feature-value-name>) ]
4134 <tr>
4135 <td>Initial:
4137 <td>normal
4139 <tr>
4140 <td>Applies to:
4142 <td>all elements
4144 <tr>
4145 <td>Inherited:
4147 <td>yes
4149 <tr>
4150 <td>Percentages:
4152 <td>N/A
4154 <tr>
4155 <td>Media:
4157 <td>visual
4159 <tr>
4160 <td>Computed value:
4162 <td>as specified
4164 <tr>
4165 <td>Animatable:
4167 <td>no
4168 </table>
4170 <p>For any given character, fonts can provide a variety of alternate glyphs
4171 in addition to the default glyph for that character. This property
4172 provides control over the selection of these alternate glyphs.
4174 <p>In cases where multiple alternates are possible, authors define a
4175 <code><feature-value-name></code> using the
4176 <code>@font-feature-values</code> rule described below to indicate the
4177 specific alternate to be used. The nature of these alternates is font
4178 specific, so the rule defines values for a specific font family or set of
4179 families. When a particular value has not been defined for a given family,
4180 the named value is treated as if the feature had omitted from the style
4181 rule. If a given value is outside the range supported by a given font, the
4182 value is ignored. These values never apply to generic font families, nor
4183 to families selected as part of system font fallback. Values that behave
4184 this way are marked as <em>font specific</em>.
4186 <p>Individual values have the following meanings:
4188 <dl>
4189 <dt><dfn id=normal1>normal</dfn>
4191 <dd>None of the features listed below are enabled.
4193 <dt><dfn id=stylisticltfeature-value-namegt
4194 title=stylistic>stylistic(<feature-value-name>)</dfn>
4196 <dd>Enables display of stylistic alternates (<em>font specific</em>,
4197 OpenType feature: <span class=tag>salt
4198 <feature-value-name></span>).
4199 </dl>
4201 <div class=featex><img alt="stylistic alternate example" src=salt.png></div>
4203 <dl>
4204 <dt><dfn id=historical-forms>historical-forms</dfn>
4206 <dd>Enables display of historical forms (OpenType feature: <span
4207 class=tag>hist</span>).
4208 </dl>
4210 <div class=featex><img alt="historical form example" src=hist.png></div>
4212 <dl>
4213 <dt><dfn id=stylesetltfeature-value-namegt
4214 title=styleset>styleset(<feature-value-name>#)</dfn>
4216 <dd>Enables display with stylistic sets (<em>font specific</em>, OpenType
4217 feature: <span class=tag>ss<feature-index></span> OpenType
4218 currently defines <span class=tag>ss01</span> through <span
4219 class=tag>ss20</span>).
4220 </dl>
4222 <div class=featex><img alt="styleset example" src=ssnn.png></div>
4224 <dl>
4225 <dt><dfn id=character-variantltfeature-value-namegt
4226 title=character-variant>character-variant(<feature-value-name>#)</dfn>
4229 <dd>Enables display of specific character variants (<em>font
4230 specific</em>, OpenType feature: <span
4231 class=tag>cv<feature-index></span> OpenType currently defines <span
4232 class=tag>cv01</span> through <span class=tag>cv99</span>).
4234 <dt><dfn id=swashltfeature-value-namegt
4235 title=swash>swash(<feature-value-name>)</dfn>
4237 <dd>Enables display of swash glyphs (<em>font specific</em>, OpenType
4238 feature: <span class=tag>swsh <feature-index>, cswh
4239 <feature-index></span>).
4240 </dl>
4242 <div class=featex><img alt="swash example" src=swsh.png></div>
4244 <dl>
4245 <dt><dfn id=ornamentsltfeature-value-namegt
4246 title=ornaments>ornaments(<feature-value-name>)</dfn>
4248 <dd>Enables replacement of default glyphs with ornaments, if provided in
4249 the font (<em>font specific</em>, OpenType feature: <span class=tag>ornm
4250 <feature-index></span>). Some fonts may offer ornament glyphs as
4251 alternates for a wide collection of characters; however, displaying
4252 arbitrary characters (e.g., alphanumerics) as ornaments is poor practice
4253 as it distorts the semantics of the data. Font designers are encouraged
4254 to encode all ornaments (except those explicitly encoded in the Unicode
4255 Dingbats blocks, etc.) as alternates for the bullet character (U+2022) to
4256 allow authors to select the desired glyph using
4257 <feature-value-name>.
4258 </dl>
4260 <div class=featex><img alt="ornaments example" src=ornm.png></div>
4262 <dl>
4263 <dt><dfn id=annotationltfeature-value-namegt
4264 title=annotation>annotation(<feature-value-name>)</dfn>
4266 <dd>Enables display of alternate annotation forms (<em>font specific</em>,
4267 OpenType feature: <span class=tag>nalt <feature-index></span>).
4268 </dl>
4270 <div class=featex><img alt="alternate annotation form example"
4271 src=nalt.png></div>
4273 <h3 id=font-feature-values><span class=secno>6.9 </span>Defining font
4274 specific alternates: the <code>@font-feature-values</code> rule</h3>
4276 <p>Several of the possible values of ‘<a
4277 href="#propdef-font-variant-alternates"><code
4278 class=property>font-variant-alternates</code></a>’ listed above are
4279 labeled as "font specific". For these features fonts may define not just a
4280 single glyph but a set of alternate glyphs with an index to select a given
4281 alternate. Since these are font family specific, the
4282 <code>@font-feature-values</code> rule is used to define named-values for
4283 these indices for a given family.
4285 <p>In the case of the swash Q in the example shown above, the swash could
4286 be specified using these style rules:
4288 <pre>
4290 @font-feature-values Jupiter Sans {
4291 @swash {
4292 delicate: 1;
4293 flowing: 2;
4294 }
4295 }
4297 h2 { font-family: Jupiter Sans, sans-serif; }
4299 /* show the second swash variant in h2 headings */
4300 h2:first-letter { font-variant-alternates: swash(flowing); }
4302 <h2>Quick</h2></pre>
4304 <p>When Jupiter Sans is present, the second alternate swash alternate will
4305 be displayed. When not present, no swash character will be shown, since
4306 the specific named-value "flowing" is only defined for the Jupiter Sans
4307 family. The @-mark indicates the name of the property value for which a
4308 named-value can be used. The name "flowing" is chosen by the author, the
4309 values specified within a given font's data.
4311 <p>In terms of the grammar, this specification defines the following
4312 productions:
4314 <pre><dfn id=fontfeaturevaluesrule>font_feature_values_rule</dfn>
4315 : FONT_FEATURE_VALUES_SYM S* font_family_name_list S*
4316 '{' S* feature_value_block? [ S* feature_value_block? ]* '}' S*
4317 ;
4319 <dfn id=fontfamilynamelist>font_family_name_list</dfn>
4320 : font_family_name [ S* ',' S* font_family_name ]*
4321 ;
4323 <dfn id=fontfamilyname>font_family_name</dfn>
4324 : STRING | [ IDENT [ S* IDENT ]* ]
4325 ;
4327 <dfn id=featurevalueblock>feature_value_block</dfn>
4328 : feature_type S*
4329 '{' S* feature_value_definition? [ S* ';' S* feature_value_definition? ]* '}' S*
4330 ;
4332 <dfn id=featuretype>feature_type</dfn>:
4333 ATKEYWORD
4334 ;
4336 <dfn id=featurevaluedefinition>feature_value_definition</dfn>
4337 : IDENT S* ':' S* NUMBER [ S* NUMBER ]*
4338 ;
4339 </pre>
4341 <p>The following new token is introduced:
4343 <pre>@{F}{O}{N}{T}{-}{F}{E}{A}{T}{U}{R}{E}{-}{V}{A}{L}{U}{E}{S} {return FONT_FEATURE_VALUES_SYM;}
4344 </pre>
4346 <p>Feature value blocks are treated <a
4347 href="http://www.w3.org/TR/CSS2/syndata.html#at-rules">similar to
4348 at-rules</a>, they consist of everything up to the next block or
4349 semi-colon, whichever comes first.
4351 <p>Font feature values rules define a set of values for a specific font
4352 feature as used for a given set of families. Effectively, they define a
4353 mapping of ⟨family, feature, ident⟩ → ⟨values⟩ where
4354 ⟨values⟩ are the indices used for specific features defined for a
4355 given font.
4357 <p>The font family list uses the same syntax as that used for the ‘<a
4358 href="#descdef-font-family"><code class=property>font-family</code></a>’
4359 property. Within feature value blocks, the feature type is ‘<code
4360 class=css>@</code>’ followed by the name of the font-specific property
4361 value (e.g. <a
4362 href="#swashltfeature-value-namegt"><code>@swash</code></a>). The feature
4363 type must match, using an ASCII case-insensitive comparison, one of the
4364 <em>font specific</em> values of the <a
4365 href="#propdef-font-variant-alternates"><code>font-variant-alternates</code></a>
4366 property. The values associated with a given idenitifier are limited to
4367 integer values 0 or greater.
4369 <p>If syntax errors occur within the font family list, the entire rule must
4370 be ignored. When syntax errors occur within a feature value definition,
4371 such as invalid identifiers or values, the entire feature value definition
4372 must be omitted, similar to the way syntax errors in style declarations
4373 are handled. When the <code><feature-type></code> is invalid, the
4374 entire associated feature value block must be ignored.
4376 <pre>@font-feature-values Bongo {
4377 @swash { ornate: 1; }
4378 annotation { boxed: 4; } /* should be @annotation! */
4379 @swash { double-loops: 1; flowing: -1; } /* negative value */
4380 @ornaments ; /* incomplete definition */
4381 @styleset { double-W: 14; sharp-terminals: 16 1 } /* missing ; */
4382 <a href="http://www.angryalien.com/0504/shiningbunnies.html" style="text-decoration: none;">redrum</a> /* random editing mistake */
4383 }</pre>
4385 <p>The example above is equivalent to:
4387 <pre>@font-feature-values Bongo {
4388 @swash { ornate: 1; }
4389 @swash { double-loops: 1; }
4390 @styleset { double-W: 14; sharp-terminals: 16 1; }
4391 }</pre>
4393 <p>If multiple <code>@font-feature-values</code> rules are defined for a
4394 given family, the resulting values defined are the union of these rules.
4395 This allows a set of named-values to be defined for a given font family
4396 globally for a site and specific additions made per-page. If the same
4397 <feature-value-name> is defined mulitple times for a given
4398 font-variant value, the last defined value is used.
4400 <pre>
4401 site.css:
4403 @font-feature-values Mercury Serif {
4404 @styleset {
4405 stacked-g: 3; /* "two-storey" versions of g, a */
4406 stacked-a: 4;
4407 }
4408 }
4410 page.css:
4412 @font-feature-values Mercury Serif {
4413 @styleset {
4414 geometric-m: 7; /* alternate version of m */
4415 }
4416 }
4418 body {
4419 font-family: Mercury Serif, serif;
4421 /* enable both the use of stacked g and alternate m */
4422 font-variant-alternates: styleset(stacked-g, geometric-m);
4423 }</pre>
4425 <p>Only named font families are allowed for <font-family>, rules that
4426 include generic or system fonts in the list of font families are
4427 considered syntax errors and the contents of the rules are ignored.
4428 However, if a user agent defines a generic font to be a specific named
4429 font (e.g. Helvetica), the settings associated with that family name will
4430 be used.
4432 <p>For <font-variant-property-value>, only font specific property value
4433 names supported by the ‘<a href="#propdef-font-variant"><code
4434 class=property>font-variant</code></a>’ property are recognized,
4435 definitions for other value names cause a syntax error and are ignored.
4436 Each property value that is font specific is clearly marked as such.
4437 Feature value names follow the rules of CSS user identifiers and are
4438 case-sensitive. They are unique only for a given set of font families and
4439 font-variant property value; the same identifier used with a different
4440 font-variant property value is treated as a separate and distinct value.
4442 <p>Using a commonly named value allows authors to use a single style rule
4443 to cover a set of fonts for which the underlying selector is different for
4444 each font. If either font in the example below is found, a circled number
4445 glyph will be used:
4447 <pre>@font-feature-values Taisho Gothic {
4448 @annotation { boxed: 1; circled: 4; }
4449 }
4451 @font-feature-values Otaru Kisa {
4452 @annotation { circled: 1; black-boxed: 3; }
4453 }
4455 h3.title {
4456 /* circled form defined for both fonts */
4457 font-family: Taisho Gothic, Otaru Kisa;
4458 font-variant: annotation(circled);
4459 }</pre>
4461 <p>Most font specific font-variant property values take a single value
4462 (e.g. swash). The character-variant property value allows two values and
4463 styleset allows an unlimited number. If a larger number of values are
4464 assigned to a given name, a syntax error occurs and the entire
4465 <font-feature-values-declaration> is ignored.
4467 <p>For the styleset property value, multiple values indicate the style sets
4468 to be enabled. Values between 1 and 99 enable OpenType features <span
4469 class=tag>ss01</span> through <span class=tag>ss99</span>. However, the
4470 OpenType standard only officially defines <span class=tag>ss01</span>
4471 through <span class=tag>ss20</span>. Values greater than 99 or equal to 0
4472 are ignored but do not generate a syntax error when parsed.
4474 <pre>@font-feature-values Mars Serif {
4475 @styleset {
4476 alt-g: 1; /* implies ss01 = 1 */
4477 curly-quotes: 3; /* implies ss03 = 1 */
4478 code: 4 5; /* implies ss04 = 1, ss05 = 1 */
4479 }
4481 @styleset {
4482 dumb: 125; /* >99, ignored */
4483 }
4485 @swash {
4486 swishy: 3 5; /* more than 1 value for swash, syntax error */
4487 }
4488 }
4490 p.codeblock {
4491 /* implies ss03 = 1, ss04 = 1, ss05 = 1 */
4492 font-variant-alternates: styleset(curly-quotes, code);
4493 }</pre>
4495 <p>For character-variant, a single value between 1 and 99 indicates the
4496 enabling of OpenType feature <span class=tag>cv01</span> through <span
4497 class=tag>cv99</span>. For OpenType fonts, values greater than 99 or equal
4498 to 0 are ignored but do not generate a syntax error when parsed. When two
4499 values are listed, the first value indicates the feature used and the
4500 second the value passed for that feature. When two value names imply
4501 different settings for the same underlying feature the last setting is
4502 used.
4504 <pre>@font-feature-values MM Greek {
4505 @character-variant { alpha-2: 1 2; } /* implies cv01 = 2 */
4506 @character-variant { beta-3: 2 3; } /* implies cv02 = 3 */
4507 @character-variant { epsilon: 5 3 6; } /* more than 2 values, syntax error, ignored */
4508 @character-variant { gamma: 12; } /* implies cv12 = 1 */
4509 @character-variant { zeta: 20 3; } /* implies cv20 = 3 */
4510 @character-variant { zeta-2: 20 2; } /* implies cv20 = 2 */
4511 @character-variant { silly: 105; } /* >99, ignored */
4512 @character-variant { dumb: 323 3; } /* >99, ignored */
4513 }
4515 #title {
4516 /* use the third alternate beta, first alternate gamma */
4517 font-variant-alternates: character-variant(beta-3, gamma);
4518 }
4520 p {
4521 /* zeta-2 follows zeta, implies cv20 = 2 */
4522 font-variant-alternates: character-variant(zeta, zeta-2);
4523 }
4525 .special {
4526 /* zeta follows zeta-2, implies cv20 = 3 */
4527 font-variant-alternates: character-variant(zeta-2, zeta);
4528 }</pre>
4530 <p>See the <a href="#om-fontfeaturevalues">object model reference
4531 section</a> for a description of the interfaces used to modify these rules
4532 via the CSS Object Model.
4534 <div class=figure><img alt="Matching text on Byzantine seals using
4535 character variants" src=byzantineseal.png>
4536 <p class=caption>Byzantine seal text displayed with character variants
4537 </div>
4539 <div class=example>
4540 <p>In the figure above, the text in red is rendered using a font
4541 containing character variants that mimic the character forms found on a
4542 Byzantine seal from the 8th century A.D. Two lines below is the same text
4543 displayed in a font without variants. Note the two variants for U and N
4544 used on the seal.</p>
4546 <pre>@font-feature-values Athena Ruby {
4547 @character-variant {
4548 leo-B: 2 1;
4549 leo-M: 13 3;
4550 leo-alt-N: 14 1;
4551 leo-N: 14 2;
4552 leo-T: 20 1;
4553 leo-U: 21 2;
4554 leo-alt-U: 21 4;
4555 }
4556 }
4558 p {
4559 font-variant: discretionary-ligatures,
4560 character-variant(leo-B, leo-M, leo-N, leo-T, leo-U);
4561 }
4563 span.alt-N {
4564 font-variant-alternates: character-variant(leo-alt-N);
4565 }
4567 span.alt-U {
4568 font-variant-alternates: character-variant(leo-alt-U);
4569 }
4571 <p>ENO....UP͞RSTU<span class="alt-U">U</span>͞<span class="alt-U">U</span>ΚΑΙTỤẠG̣IUPNS</p>
4573 <p>LEON|ΚΑΙCONSTA|NTI<span class="alt-N">N</span>OS..|STOIBAṢ.|LIṢROM|AIO<span class="alt-N">N</span></p>
4574 </pre>
4575 </div>
4577 <h3 id=font-variant-east-asian-prop><span class=secno>6.10 </span>East
4578 Asian text rendering: the <a
4579 href="#propdef-font-variant-east-asian">font-variant-east-asian</a>
4580 property</h3>
4582 <table class=propdef id=namefont-variant-east-asianvaluenormal-l>
4583 <tbody>
4584 <tr>
4585 <td>Name:
4587 <td><dfn
4588 id=propdef-font-variant-east-asian>font-variant-east-asian</dfn>
4590 <tr>
4591 <td>Value:
4593 <td>normal | [ <east-asian-variant-values> ||
4594 <east-asian-width-values> || ruby ]
4596 <tr>
4597 <td>Initial:
4599 <td>normal
4601 <tr>
4602 <td>Applies to:
4604 <td>all elements
4606 <tr>
4607 <td>Inherited:
4609 <td>yes
4611 <tr>
4612 <td>Percentages:
4614 <td>N/A
4616 <tr>
4617 <td>Media:
4619 <td>visual
4621 <tr>
4622 <td>Computed value:
4624 <td>as specified
4626 <tr>
4627 <td>Animatable:
4629 <td>no
4630 </table>
4632 <p>Allows control of glyph substitution and sizing in East Asian text.
4634 <pre
4635 class=prod><dfn id=lteast-asian-variant-valuesgt><var><east-asian-variant-values></var></dfn> = [ jis78 | jis83 | jis90 | jis04 | simplified | traditional ]</pre>
4637 <pre
4638 class=prod><dfn id=lteast-asian-width-valuesgt><var><east-asian-width-values></var></dfn> = [ full-width | proportional-width ]</pre>
4640 <p>Individual values have the following meanings:
4642 <dl>
4643 <dt><dfn id=normal2>normal</dfn>
4645 <dd>None of the features listed below are enabled.
4647 <dt><dfn id=jis78>jis78</dfn>
4649 <dd>Enables rendering of JIS78 forms (OpenType feature: <span
4650 class=tag>jp78</span>).
4651 </dl>
4653 <div class=featex><img alt="JIS78 form example" src=jp78.png></div>
4655 <dl>
4656 <dt><dfn id=jis83>jis83</dfn>
4658 <dd>Enables rendering of JIS83 forms (OpenType feature: <span
4659 class=tag>jp83</span>).
4661 <dt><dfn id=jis90>jis90</dfn>
4663 <dd>Enables rendering of JIS90 forms (OpenType feature: <span
4664 class=tag>jp90</span>).
4666 <dt><dfn id=jis04>jis04</dfn>
4668 <dd>Enables rendering of JIS2004 forms (OpenType feature: <span
4669 class=tag>jp04</span>).
4670 <p>The various JIS variants reflect the glyph forms defined in different
4671 Japanese national standards. Fonts generally include glyphs defined by
4672 the most recent national standard but it's sometimes necessary to use
4673 older variants, to match signage for example.</p>
4675 <dt><dfn id=simplified>simplified</dfn>
4677 <dd>Enables rendering of simplified forms (OpenType feature: <span
4678 class=tag>smpl</span>).
4679 <p>The ‘<a href="#simplified"><code
4680 class=property>simplified</code></a>’ and ‘<a
4681 href="#traditional"><code class=property>traditional</code></a>’
4682 values allow control over the glyph forms for characters which have been
4683 simplified over time but for which the older, traditional form is still
4684 used in some contexts. The exact set of characters and glyph forms will
4685 vary to some degree by context for which a given font was designed.</p>
4687 <dt><dfn id=traditional>traditional</dfn>
4689 <dd>Enables rendering of traditional forms (OpenType feature: <span
4690 class=tag>trad</span>).
4691 </dl>
4693 <div class=featex><img alt="tradtional form example" src=trad.png></div>
4695 <dl>
4696 <dt><dfn id=full-width>full-width</dfn>
4698 <dd>Enables rendering of full-width variants (OpenType feature: <span
4699 class=tag>fwid</span>).
4701 <dt><dfn id=proportional-width>proportional-width</dfn>
4703 <dd>Enables rendering of proportionally-spaced variants (OpenType feature:
4704 <span class=tag>pwid</span>).
4705 </dl>
4707 <div class=featex><img alt="proportionally spaced Japanese example"
4708 src=pwid.png></div>
4710 <dl>
4711 <dt><dfn id=ruby>ruby</dfn>
4713 <dd>Enables display of ruby variant glyphs (OpenType feature: <span
4714 class=tag>ruby</span>). Since ruby text is generally smaller than the
4715 associated body text, font designers can design special glyphs for use
4716 with ruby that are more readable than scaled down versions of the default
4717 glyphs. Only glyph selection is affected, there is no associated font
4718 scaling or other change that affects line layout. The red ruby text below
4719 is shown with default glyphs (top) and with ruby variant glyphs (bottom).
4720 Note the slight difference in stroke thickness.
4721 </dl>
4723 <div class=featex><img alt="ruby variant example" src=rubyshinkansen.png></div>
4725 <h3 id=font-variant-prop><span class=secno>6.11 </span>Overall shorthand
4726 for font rendering: the <a href="#propdef-font-variant">font-variant</a>
4727 property</h3>
4729 <table class=propdef id=namefont-variantvaluenormal-none-ltcommo>
4730 <tbody>
4731 <tr>
4732 <td>Name:
4734 <td><dfn id=propdef-font-variant>font-variant</dfn>
4736 <tr>
4737 <td>Value:
4739 <td>normal | none | [ <common-lig-values> ||
4740 <discretionary-lig-values> || <historical-lig-values> ||
4741 <contextual-alt-values> || stylistic(<feature-value-name>)
4742 || historical-forms || styleset(<feature-value-name>#) ||
4743 character-variant(<feature-value-name>#) ||
4744 swash(<feature-value-name>) ||
4745 ornaments(<feature-value-name>) ||
4746 annotation(<feature-value-name>) || [ small-caps | all-small-caps
4747 | petite-caps | all-petite-caps | unicase | titling-caps ] ||
4748 <numeric-figure-values> || <numeric-spacing-values> ||
4749 <numeric-fraction-values> || ordinal || slashed-zero ||
4750 <east-asian-variant-values> || <east-asian-width-values> ||
4751 ruby ]
4753 <tr>
4754 <td>Initial:
4756 <td>normal
4758 <tr>
4759 <td>Applies to:
4761 <td>all elements
4763 <tr>
4764 <td>Inherited:
4766 <td>yes
4768 <tr>
4769 <td>Percentages:
4771 <td>see individual properties
4773 <tr>
4774 <td>Media:
4776 <td>visual
4778 <tr>
4779 <td>Computed value:
4781 <td>see individual properties
4783 <tr>
4784 <td>Animatable:
4786 <td>see individual properties
4787 </table>
4789 <p>The value ‘<a href="#normal2"><code
4790 class=property>normal</code></a>’ resets all other font feature
4791 properties to their inital value. The ‘<code
4792 class=property>none</code>’ value sets ‘<a
4793 href="#propdef-font-variant-ligatures"><code
4794 class=property>font-variant-ligatures</code></a>’ to ‘<code
4795 class=property>none</code>’ and resets all other font feature properties
4796 to their initial value. Like other shorthands, using ‘<a
4797 href="#propdef-font-variant"><code
4798 class=property>font-variant</code></a>’ resets unspecified font-variant
4799 subproperties to their initial values. It does not reset the values of
4800 either ‘<a href="#propdef-font-language-override"><code
4801 class=property>font-language-override</code></a>’ or ‘<a
4802 href="#propdef-font-feature-settings"><code
4803 class=property>font-feature-settings</code></a>’.
4805 <h3 id=font-feature-settings-prop><span class=secno>6.12 </span>Low-level
4806 font feature settings control: the <a
4807 href="#propdef-font-feature-settings">font-feature-settings</a> property</h3>
4809 <table class=propdef id=namefont-feature-settingsvaluenormal-ltf>
4810 <tbody>
4811 <tr>
4812 <td>Name:
4814 <td><dfn id=propdef-font-feature-settings>font-feature-settings</dfn>
4816 <tr>
4817 <td>Value:
4819 <td>normal | <feature-tag-value>#
4821 <tr>
4822 <td>Initial:
4824 <td>normal
4826 <tr>
4827 <td>Applies to:
4829 <td>all elements
4831 <tr>
4832 <td>Inherited:
4834 <td>yes
4836 <tr>
4837 <td>Percentages:
4839 <td>N/A
4841 <tr>
4842 <td>Media:
4844 <td>visual
4846 <tr>
4847 <td>Computed value:
4849 <td>as specified
4851 <tr>
4852 <td>Animatable:
4854 <td>no
4855 </table>
4857 <p>This property provides low-level control over OpenType font features. It
4858 is intended as a way of providing access to font features that are not
4859 widely used but are needed for a particular use case. A value of ‘<a
4860 href="#normal2"><code class=property>normal</code></a>’ means that no
4861 change in glyph selection or positioning occurs due to this property.
4863 <p>
4865 <pre>/* enable small caps and use second swash alternate */
4866 font-feature-settings: "smcp", "swsh" 2;</pre>
4868 <p>Feature tag values have the following syntax:
4870 <pre
4871 class=prod><dfn id=ltfeature-tag-valuegt><var><feature-tag-value></var></dfn> = <string> [ <integer> | on | off ]?</pre>
4873 <p>The <string> is a case-sensitive OpenType feature tag. As
4874 specified in the OpenType specification, feature tags contain four ASCII
4875 characters. Tag strings longer or shorter than four characters, or
4876 containing characters outside the U+20–7E codepoint range are invalid.
4877 User agents must not use a feature tag created by truncating or padding
4878 the string to four characters. Feature tags need only match a feature tag
4879 defined in the font, they are not limited to explicitly registered
4880 OpenType features. Fonts defining custom feature tags should follow the <a
4881 href="http://www.microsoft.com/typography/otspec/featuretags.htm">tag name
4882 rules</a> defined in the OpenType specification <a
4883 href="#OPENTYPE-FEATURES"
4884 rel=biblioentry>[OPENTYPE-FEATURES]<!--{{!OPENTYPE-FEATURES}}--></a>.
4885 Feature tags not present in the font are ignored; a user agent must not
4886 attempt to synthesize fallback behavior based on these feature tags.
4888 <p>This means that explicitly disabling the <span class=tag>kern</span>
4889 feature will not affect the application of kerning data found in the
4890 ‘<code class=property>kern</code>’ table (as opposed to kerning data
4891 associated with the <span class=tag>kern</span> feature in the ‘<code
4892 class=property>GPOS</code>’ table). Authors should use the ‘<a
4893 href="#propdef-font-kerning"><code
4894 class=property>font-kerning</code></a>’ property to explictly enable or
4895 disable kerning since this property affects both types of kerning.
4897 <p>If present, a value indicates an index used for glyph selection. An
4898 <integer> value must be 0 or greater. A value of 0 indicates that
4899 the feature is disabled. For boolean features, a value of 1 enables the
4900 feature. For non-boolean features, a value of 1 or greater enables the
4901 feature and indicates the feature selection index. A value of ‘<code
4902 class=property>on</code>’ is synonymous with 1 and ‘<code
4903 class=property>off</code>’ is synonymous with 0. If the value is
4904 omitted, a value of 1 is assumed.
4906 <pre>
4907 font-feature-settings: "dlig" 1; /* dlig=1 enable discretionary ligatures */
4908 font-feature-settings: "smcp" on; /* smcp=1 enable small caps */
4909 font-feature-settings: 'c2sc'; /* c2sc=1 enable caps to small caps */
4910 font-feature-settings: "liga" off; /* liga=0 no common ligatures */
4911 font-feature-settings: "tnum", 'hist'; /* tnum=1, hist=1 enable tabular numbers and historical forms */
4912 font-feature-settings: "tnum" "hist"; /* invalid, need a comma-delimited list */
4913 font-feature-settings: "palin" off; /* good idea but invalid tagname */
4914 font-feature-settings: "PKRN"; /* PKRN=1 enable custom feature */
4915 font-feature-settings: dlig; /* invalid, tag must be a string */
4916 </pre>
4918 <p>Authors should generally use ‘<a href="#propdef-font-variant"><code
4919 class=property>font-variant</code></a>’ and its related subproperties
4920 whenever possible and only use this property for special cases where its
4921 use is the only way of accessing a particular infrequently used font
4922 feature.
4924 <p>Although specifically defined for OpenType feature tags, feature tags
4925 for other modern font formats that support font features may be added in
4926 the future. Where possible, features defined for other font formats should
4927 attempt to follow the pattern of registered OpenType tags.
4929 <div class=example>
4930 <p>The Japanese text below will be rendered with half-width kana
4931 characters:</p>
4933 <pre lang=ja>
4934 body { font-feature-settings: "hwid"; /* Half-width OpenType feature */ }
4936 <p>毎日<a href="http://images.google.com/images?q=%E3%82%AB%E3%83%AC%E3%83%BC" style="text-decoration: none;">カレー</a>食べてるのに、飽きない</p>
4937 </pre>
4938 </div>
4940 <h3 id=font-language-override-prop><span class=secno>6.13 </span>Font
4941 language override: the <a
4942 href="#propdef-font-language-override">font-language-override</a> property</h3>
4944 <table class=propdef id=namefont-language-overridevaluenormal-lt>
4945 <tbody>
4946 <tr>
4947 <td>Name:
4949 <td><dfn id=propdef-font-language-override>font-language-override</dfn>
4951 <tr>
4952 <td>Value:
4954 <td>normal | <string>
4956 <tr>
4957 <td>Initial:
4959 <td>normal
4961 <tr>
4962 <td>Applies to:
4964 <td>all elements
4966 <tr>
4967 <td>Inherited:
4969 <td>yes
4971 <tr>
4972 <td>Percentages:
4974 <td>N/A
4976 <tr>
4977 <td>Media:
4979 <td>visual
4981 <tr>
4982 <td>Computed value:
4984 <td>as specified
4986 <tr>
4987 <td>Animatable:
4989 <td>no
4990 </table>
4992 <p>The value of ‘<a href="#normal2"><code
4993 class=property>normal</code></a>’ implies that when rendering with
4994 OpenType fonts the language of the document is used to infer the OpenType
4995 language system, used to select language specific features when rendering.
4996 The value of the <string> is a single three-letter OpenType <a
4997 href="http://www.microsoft.com/typography/otspec/languagetags.htm">language
4998 system tag</a>, defined in the layout tag registry of the OpenType
4999 specification.
5001 <div class=example>
5002 <p>The <a href="http://www.un.org/en/documents/udhr/index.shtml">Universal
5003 Declaration of Human Rights</a> has been translated into a wide variety
5004 of languages. In Turkish, Article 9 of this document might be marked up
5005 as below:</p>
5007 <pre lang=tr><body lang="tr">
5009 <h4>Madde 9</h4>
5010 <p>Hiç kimse keyfi olarak tutuklanamaz, alıkonulanamaz veya sürülemez.</p>
5011 </pre>
5013 <p>Here the user agent uses the value of the ‘<code
5014 class=property>lang</code>’ attribute when rendering text and
5015 appropriately renders this text without ‘<code
5016 class=property>fi</code>’ ligatures. There is no need to use the ‘<a
5017 href="#propdef-font-language-override"><code
5018 class=property>font-language-override</code></a>’ property.</p>
5020 <p>However, a given font may lack support for a specific language. In this
5021 situation authors may need to use the typographic conventions of a
5022 related language that are supported by that font:</p>
5024 <pre lang=mk><body lang="mk"> <!-- Macedonian lang code -->
5026 body { font-language-override: "SRB"; /* Serbian OpenType language tag */ }
5028 <h4>Члeн 9</h4>
5029 <p>Никoj чoвeк нeмa дa бидe пoдлoжeн нa прoизвoлнo aпсeњe, притвoр или прoгoнувaњe.</p>
5031 </pre>
5033 <p>The Macedonian text here will be rendered using Serbian typographic
5034 conventions, with the assumption that the font specified supports
5035 Serbian.</p>
5036 </div>
5038 <p><a id=rendering-considerations></a>
5040 <h2 id=font-feature-resolution><span class=secno>7 </span>Font Feature
5041 Resolution</h2>
5043 <p>As described in the previous section, font features can be enabled in a
5044 variety of ways, either via the use of ‘<a
5045 href="#propdef-font-variant"><code
5046 class=property>font-variant</code></a>’ or ‘<a
5047 href="#propdef-font-feature-settings"><code
5048 class=property>font-feature-settings</code></a>’ in a style rule or
5049 within an <code>@font-face</code> rule. The resolution order for the union
5050 of these settings is defined below. Features defined via CSS properties
5051 are applied on top of layout engine default features.
5053 <h3 id=default-features><span class=secno>7.1 </span>Default features</h3>
5055 <p>For OpenType fonts, user agents must enable the default features defined
5056 in the OpenType documentation for a given script and writing mode.
5057 Required ligatures, common ligatures and contextual forms must be enabled
5058 by default (OpenType features: <span class=tag>rlig, liga, clig,
5059 calt</span>), along with localized forms (OpenType feature: <span
5060 class=tag>locl</span>), and features required for proper display of
5061 composed characters and marks (OpenType features: <span class=tag>ccmp,
5062 mark, mkmk</span>). These features must always be enabled, even when the
5063 value of the ‘<a href="#propdef-font-variant"><code
5064 class=property>font-variant</code></a>’ and ‘<a
5065 href="#propdef-font-feature-settings"><code
5066 class=property>font-feature-settings</code></a>’ properties is ‘<a
5067 href="#normal2"><code class=property>normal</code></a>’. Individual
5068 features are only disabled when explicitly overridden by the author, as
5069 when ‘<a href="#propdef-font-variant-ligatures"><code
5070 class=property>font-variant-ligatures</code></a>’ is set to ‘<a
5071 href="#no-common-ligatures"><code
5072 class=property>no-common-ligatures</code></a>’. For handling complex
5073 scripts such as <a
5074 href="http://www.microsoft.com/typography/otfntdev/arabicot/features.aspx">Arabic</a>,
5075 <a
5076 href="http://www.microsoft.com/typography/otfntdev/mongolot/features.htm">Mongolian</a>
5077 or <a
5078 href="http://www.microsoft.com/typography/otfntdev/devanot/features.aspx">Devanagari</a>
5079 additional features are required. For upright text within vertical text
5080 runs, vertical alternates (OpenType feature: <span class=tag>vert</span>)
5081 must be enabled.
5083 <h3 id=feature-precedence><span class=secno>7.2 </span>Feature precedence</h3>
5085 <p>General and font specific font feature property settings are resolved in
5086 the order below, in ascending precedence order. This ordering is used to
5087 construct a combined list of font features that affect a given text run.
5089 <ol>
5090 <li>Font features enabled by default, including features required for a
5091 given script.
5093 <li>If the font is defined via an <code>@font-face</code> rule, the font
5094 features implied by the font-variant descriptor in the
5095 <code>@font-face</code> rule.
5097 <li>If the font is defined via an <code>@font-face</code> rule, the font
5098 features implied by the font-feature-settings descriptor in the
5099 <code>@font-face</code> rule.
5101 <li>Feature settings determined by properties other than ‘<a
5102 href="#propdef-font-variant"><code
5103 class=property>font-variant</code></a>’ or ‘<a
5104 href="#propdef-font-feature-settings"><code
5105 class=property>font-feature-settings</code></a>’. For example, setting
5106 a non-default value for the ‘<code
5107 class=property>letter-spacing</code>’ property disables ligatures.
5109 <li>Font features implied by the value of the ‘<a
5110 href="#propdef-font-variant"><code
5111 class=property>font-variant</code></a>’ property, the related
5112 font-variant subproperties and any other CSS property that may use
5113 OpenType features (e.g. the ‘<a href="#propdef-font-kerning"><code
5114 class=property>font-kerning</code></a>’ property).
5116 <li>Font features implied by the value of ‘<a
5117 href="#propdef-font-feature-settings"><code
5118 class=property>font-feature-settings</code></a>’ property.
5119 </ol>
5121 <p>This ordering allows authors to set up a general set of defaults for
5122 fonts within their <code>@font-face</code> rules, then override them with
5123 property settings for specific elements. General property settings
5124 override the settings in <code>@font-face</code> rules and low-level font
5125 feature settings override ‘<a href="#propdef-font-variant"><code
5126 class=property>font-variant</code></a>’ property settings.
5128 <p>For situations where the combined list of font feature settings contains
5129 more than one value for the same feature, the last value is used. When a
5130 font lacks support for a given underlying font feature, text is simply
5131 rendered as if that font feature was not enabled; font fallback does not
5132 occur and no attempt is made to synthesize the feature except where
5133 explicitly noted for specific properties.
5135 <h3 id=feature-precedence-examples><span class=secno>7.3 </span>Feature
5136 precedence examples</h3>
5138 <div class=example>
5139 <p>With the styles below, numbers are rendered proportionally when used
5140 within a paragraph but are shown in tabular form within tables of prices:</p>
5142 <pre>body {
5143 font-variant-numeric: proportional-nums;
5144 }
5146 table.prices td {
5147 font-variant-numeric: tabular-nums;
5148 }
5149 </pre>
5150 </div>
5152 <div class=example>
5153 <p>When the font-variant descriptor is used within an
5154 <code>@font-face</code> rule, it only applies to the font defined by that
5155 rule.</p>
5157 <pre>@font-face {
5158 font-family: MainText;
5159 src: url(http://example.com/font.ttf);
5160 font-variant: oldstyle-nums proportional-nums styleset(1,3);
5161 }
5163 body {
5164 font-family: MainText, Helvetica;
5165 }
5167 table.prices td {
5168 font-variant-numeric: tabular-nums;
5169 }
5170 </pre>
5172 <p>In this case, old-style numerals will be used throughout but only where
5173 the font "MainText" is used. Just as in the previous example, tabular
5174 values will be used in price tables since ‘<a
5175 href="#tabular-nums"><code class=property>tabular-nums</code></a>’
5176 appears in a general style rule and its use is mutually exclusive with
5177 ‘<a href="#proportional-nums"><code
5178 class=property>proportional-nums</code></a>’. Stylistic alternate sets
5179 will only be used where MainText is used.</p>
5180 </div>
5182 <div class=example>
5183 <p>The <code>@font-face</code> rule can also be used to access font
5184 features in locally available fonts via the use of <code>local()</code>
5185 in the ‘<a href="#descdef-src"><code class=property>src</code></a>’
5186 descriptor of the <code>@font-face</code> definition:</p>
5188 <pre>@font-face {
5189 font-family: BodyText;
5190 src: local("HiraMaruPro-W4");
5191 font-variant: proportional-width;
5192 font-feature-settings: "ital"; /* Latin italics within CJK text feature */
5193 }
5195 body { font-family: BodyText, serif; }
5196 </pre>
5198 <p>If available, a Japanese font "Hiragino Maru Gothic" will be used. When
5199 text rendering occurs, Japanese kana will be proportionally spaced and
5200 Latin text will be italicised. Text rendered with the fallback serif font
5201 will use default rendering properties.</p>
5202 </div>
5204 <div class=example>
5205 <p>In the example below, discretionary ligatures are enabled only for a
5206 downloadable font but are disabled within spans of class "special":</p>
5208 <pre>@font-face {
5209 font-family: main;
5210 src: url(fonts/ffmeta.woff) format("woff");
5211 font-variant: discretionary-ligatures;
5212 }
5214 body { font-family: main, Helvetica; }
5215 span.special { font-variant-ligatures: no-discretionary-ligatures; }
5216 </pre>
5218 <p>Adding an discretionary style rule with the <code>@font-face</code>
5219 above:</p>
5221 <pre>body { font-family: main, Helvetica; }
5222 span { font-feature-settings: "dlig"; }
5223 span.special { font-variant-ligatures: no-discretionary-ligatures; }
5224 </pre>
5226 <p>Within spans of class "special", discretionary ligatures <em>will</em>
5227 be rendered. This is because both the ‘<a
5228 href="#propdef-font-feature-settings"><code
5229 class=property>font-feature-settings</code></a>’ and ‘<a
5230 href="#propdef-font-variant-ligatures"><code
5231 class=property>font-variant-ligatures</code></a>’ properties apply to
5232 these spans. Although the ‘<code class=css>no-discretionary
5233 ligatures</code>’ setting of ‘<a
5234 href="#propdef-font-variant-ligatures"><code
5235 class=property>font-variant-ligatures</code></a>’ effectively disables
5236 the OpenType <span class=tag>dlig</span> feature, because the ‘<a
5237 href="#propdef-font-feature-settings"><code
5238 class=property>font-feature-settings</code></a>’ is resolved after
5239 that, the ‘<code class=property>dlig</code>’ value reenables
5240 discretionary ligatures.</p>
5241 </div>
5243 <h2 id=object-model><span class=secno>8 </span>Object Model</h2>
5245 <p>The contents of <code>@font-face</code> and
5246 <code>@font-feature-values</code> rules can be accessed via the following
5247 extensions to the CSS Object Model.
5249 <h3 id=om-fontface><span class=secno>8.1 </span>The <a
5250 href="#cssfontfacerule"><code>CSSFontFaceRule</code></a> interface</h3>
5252 <p>The <dfn id=cssfontfacerule>CSSFontFaceRule</dfn> interface represents a
5253 <code>@font-face</code> rule.
5255 <pre class=idl>
5256 interface CSSFontFaceRule : CSSRule {
5257 attribute DOMString family;
5258 attribute DOMString src;
5259 attribute DOMString style;
5260 attribute DOMString weight;
5261 attribute DOMString stretch;
5262 attribute DOMString unicodeRange;
5263 attribute DOMString variant;
5264 attribute DOMString featureSettings;
5265 }</pre>
5267 <p>The DOM Level 2 Style specification <a href="#DOM-LEVEL-2-STYLE"
5268 rel=biblioentry>[DOM-LEVEL-2-STYLE]<!--{{DOM-LEVEL-2-STYLE}}--></a>
5269 defined a different variant of this rule. This definition supercedes that
5270 one.
5272 <h3 id=om-fontfeaturevalues><span class=secno>8.2 </span>The <a
5273 href="#cssfontfeaturevaluesrule"><code>CSSFontFeatureValuesRule</code></a>
5274 interface</h3>
5276 <p>The <code>CSSRule</code> interface is extended as follows:
5278 <pre class=idl>partial interface CSSRule {
5279 const unsigned short FONT_FEATURE_VALUES_RULE = 14;
5280 }</pre>
5282 <p>The <dfn id=cssfontfeaturevaluesrule>CSSFontFeatureValuesRule</dfn>
5283 interface represents a <code>@font-feature-values</code> rule.
5285 <pre class=idl>interface CSSFontFeatureValuesRule : CSSRule {
5286 readonly attribute DOMString familyList;
5287 readonly attribute DOMString valueText;
5288 };</pre>
5290 <dl class=idl-attributes>
5291 <dt><var>familyList</var> of type <code>DOMString</code>, readonly
5293 <dd>The list of one or more font families for which a given set of feature
5294 values is defined.
5296 <dt><var>valueText</var> of type <code>DOMString</code>, readonly
5298 <dd>Serialized set of feature values.
5299 </dl>
5301 <h2 class=no-num id=platform-props-to-css>Appendix A: Mapping platform font
5302 properties to CSS properties</h2>
5304 <p><em>This appendix is included as background for some of the problems and
5305 situations that are described in other sections. It should be viewed as
5306 informative only.</em>
5308 <p>Font properties in CSS are designed to be independent of the underlying
5309 font formats used; they can be used to specify bitmap fonts, Type1 fonts,
5310 SVG fonts in addition to the common TrueType and OpenType fonts. But there
5311 are facets of the TrueType and OpenType formats that often cause confusion
5312 for authors and present challenges to implementers on different platforms.
5314 <p>Originally developed at Apple, TrueType was designed as an outline font
5315 format for both screen and print. Microsoft joined Apple in developing the
5316 TrueType format and both platforms have supported TrueType fonts since
5317 then. Font data in the TrueType format consists of a set of tables
5318 distinguished with common four-letter tag names, each containing a
5319 specific type of data. For example, naming information, including
5320 copyright and license information, is stored in the ‘<code
5321 class=property>name</code>’ table. The <a
5322 href="#character-map"><em>character map</em></a> (‘<code
5323 class=property>cmap</code>’) table contains a mapping of character
5324 encodings to glyphs. Apple later added additional tables for supporting
5325 enhanced typographic functionality; these are now called Apple Advanced
5326 Typography, or AAT, fonts. Microsoft and Adobe developed a separate set of
5327 tables for advanced typography and called their format OpenType <a
5328 href="#OPENTYPE" rel=biblioentry>[OPENTYPE]<!--{{!OPENTYPE}}--></a>.
5330 <p>In many cases the font data used under Microsoft Windows or Linux is
5331 slightly different from the data used under Apple's Mac OS X because the
5332 TrueType format allowed for explicit variation across platforms. This
5333 includes font metrics, names and <a href="#character-map"><em>character
5334 map</em></a> data.
5336 <p>Specifically, font family name data is handled differently across
5337 platforms. For TrueType and OpenType fonts these names are contained in
5338 the ‘<code class=property>name</code>’ table, in name records with
5339 name ID 1. Mulitple names can be stored for different locales but
5340 Microsoft recommends fonts always include at least a US English version of
5341 the name. On Windows, Microsoft made the decision for backwards
5342 compatibility to limit this family name to a maximum of four faces; for
5343 larger groupings the "preferred family" (name ID 16) or "WWS family" (name
5344 ID 21) can be used. Other platforms such as OSX don't have this
5345 limitation, the family name is used to define all possible groupings.
5347 <p>Other name table data provides names used to uniquely identify a
5348 specific face within a family. The full font name (name ID 4) and the
5349 Postscript name (name ID 6) describe a single face uniquely. The bold face
5350 of the Gill Sans family has a fullname of "Gill Sans Bold" and a
5351 Postscript name of "GillSans-Bold". There can be multiple localized
5352 versions of the fullname for a given face but the Postscript name is
5353 always a unique name made from a limited set of ASCII characters.
5355 <p>On various platforms, different names are used to search for a font. For
5356 example, with the Windows GDI CreateIndirectFont API, either a family or
5357 fullname can be used to lookup a face while on Mac OS X the
5358 CTFontCreateWithName API call is used to lookup a given face using the
5359 fullname and Postscript name. Under Linux, the fontconfig API allows fonts
5360 to be searched using any of these names. In situations where platform
5361 API's automatically substitute other font choices, it may be necessary to
5362 verify a returned font matches a given name.
5364 <p>The weight of a given face can be determined via the usWeightClass field
5365 of the OS/2 table or inferred from the style name (name ID 2). Likewise,
5366 the width can be determined via the usWidthClass of the OS/2 table or
5367 inferred from the style name. For historical reasons related to synthetic
5368 bolding at weights 200 or lower with the Windows GDI API, font designers
5369 have sometimes skewed values in the OS/2 table to avoid these weights.
5371 <p>Rendering complex scripts that use contextual shaping such as Thai,
5372 Arabic and Devanagari requires features present only in OpenType or AAT
5373 fonts. Currently, complex script rendering is supported on Windows and
5374 Linux using OpenType font features while both OpenType and AAT font
5375 features are used under Mac OS X.
5377 <h2 class=no-num id=ch-ch-ch-changes>Changes</h2>
5379 <h3 class=no-num id=recent-changes> Changes from the <a
5380 href="http://www.w3.org/TR/2013/WD-css3-fonts-20130212/">February 2013
5381 CSS3 Fonts Working Draft</a></h3>
5383 <p>Major changes include:
5385 <ul>
5386 <li>Moved font load events into a separate <a
5387 href="http://dev.w3.org/csswg/css3-font-load-events/">spec</a>
5389 <li>Tightened error handling rules for <code>@font-feature-values</code>
5390 rules
5392 <li>Added grammar productions for <code>@font-face</code> and
5393 <code>@font-feature-values</code> rules
5395 <li>Tightened definition of synthetic oblique
5396 </ul>
5398 <h2 class=no-num id=acknowledgments>Acknowledgments</h2>
5400 <p>I'd like to thank Tal Leming, Jonathan Kew and Christopher Slye for all
5401 their help and feedback. John Hudson was kind enough to take the time to
5402 explain the subtleties of OpenType language tags and provided the example
5403 of character variant usage for displaying text on Byzantine seals. Ken
5404 Lunde and Eric Muller provided valuable feedback on CJK OpenType features
5405 and Unicode variation selectors. The idea for supporting font features by
5406 using font-variant subproperties originated with Håkon Wium Lie, Adam
5407 Twardoch and Tal Leming. Elika Etemad supplied some of the initial design
5408 ideas for the <code>@font-feature-values</code> rule. Thanks also to House
5409 Industries for allowing the use of Ed Interlock in the discretionary
5410 ligatures example.
5412 <p>A special thanks to Robert Bringhurst for the sublime mind expansion
5413 that is <em>The Elements of Typographic Style</em>.
5415 <h2 class=no-num id=conformance> Conformance</h2>
5417 <h3 class=no-num id=conventions> Document Conventions</h3>
5419 <p>Conformance requirements are expressed with a combination of descriptive
5420 assertions and RFC 2119 terminology. The key words “MUST”, “MUST
5421 NOT”, “REQUIRED”, “SHALL”, “SHALL NOT”, “SHOULD”,
5422 “SHOULD NOT”, “RECOMMENDED”, “MAY”, and “OPTIONAL” in the
5423 normative parts of this document are to be interpreted as described in RFC
5424 2119. However, for readability, these words do not appear in all uppercase
5425 letters in this specification.
5427 <p>All of the text of this specification is normative except sections
5428 explicitly marked as non-normative, examples, and notes. <a
5429 href="#RFC2119" rel=biblioentry>[RFC2119]<!--{{!RFC2119}}--></a>
5431 <p>Examples in this specification are introduced with the words “for
5432 example” or are set apart from the normative text with
5433 <code>class="example"</code>, like this:
5435 <div class=example>
5436 <p>This is an example of an informative example.
5437 </div>
5439 <p>Informative notes begin with the word “Note” and are set apart from
5440 the normative text with <code>class="note"</code>, like this:
5442 <p class=note>Note, this is an informative note.
5444 <h3 class=no-num id=conformance-classes> Conformance Classes</h3>
5446 <p>Conformance to CSS Fonts Level 3 Module is defined for three conformance
5447 classes:
5449 <dl>
5450 <dt><dfn id=style-sheet title="style sheet!!as conformance class">style
5451 sheet</dfn>
5453 <dd>A <a href="http://www.w3.org/TR/CSS21/conform.html#style-sheet">CSS
5454 style sheet</a>.
5456 <dt><dfn id=renderer>renderer</dfn>
5458 <dd>A <a href="http://www.w3.org/TR/CSS21/conform.html#user-agent">UA</a>
5459 that interprets the semantics of a style sheet and renders documents that
5460 use them.
5462 <dt><dfn id=authoring-tool>authoring tool</dfn>
5464 <dd>A <a href="http://www.w3.org/TR/CSS21/conform.html#user-agent">UA</a>
5465 that writes a style sheet.
5466 </dl>
5468 <p>A style sheet is conformant to CSS Fonts Level 3 Module if all of its
5469 declarations that use properties defined in this module have values that
5470 are valid according to the generic CSS grammar and the individual grammars
5471 of each property as given in this module.
5473 <p>A renderer is conformant to CSS Fonts Level 3 Module if, in addition to
5474 interpreting the style sheet as defined by the appropriate specifications,
5475 it supports all the features defined by CSS Fonts Level 3 Module by
5476 parsing them correctly and rendering the document accordingly. However,
5477 the inability of a UA to correctly render a document due to limitations of
5478 the device does not make the UA non-conformant. (For example, a UA is not
5479 required to render color on a monochrome monitor.)
5481 <p>An authoring tool is conformant to CSS Fonts Level 3 Module if it writes
5482 style sheets that are syntactically correct according to the generic CSS
5483 grammar and the individual grammars of each feature in this module, and
5484 meet all other conformance requirements of style sheets as described in
5485 this module.
5487 <h3 class=no-num id=partial> Partial Implementations</h3>
5489 <p>So that authors can exploit the forward-compatible parsing rules to
5490 assign fallback values, CSS renderers <strong>must</strong> treat as
5491 invalid (and <a
5492 href="http://www.w3.org/TR/CSS21/conform.html#ignore">ignore as
5493 appropriate</a>) any at-rules, properties, property values, keywords, and
5494 other syntactic constructs for which they have no usable level of support.
5495 In particular, user agents <strong>must not</strong> selectively ignore
5496 unsupported component values and honor supported values in a single
5497 multi-value property declaration: if any value is considered invalid (as
5498 unsupported values must be), CSS requires that the entire declaration be
5499 ignored.
5501 <h3 class=no-num id=experimental> Experimental Implementations</h3>
5503 <p>To avoid clashes with future CSS features, the CSS2.1 specification
5504 reserves a <a
5505 href="http://www.w3.org/TR/CSS21/syndata.html#vendor-keywords">prefixed
5506 syntax</a> for proprietary and experimental extensions to CSS.
5508 <p>Prior to a specification reaching the Candidate Recommendation stage in
5509 the W3C process, all implementations of a CSS feature are considered
5510 experimental. The CSS Working Group recommends that implementations use a
5511 vendor-prefixed syntax for such features, including those in W3C Working
5512 Drafts. This avoids incompatibilities with future changes in the draft.
5514 <h3 class=no-num id=testing> Non-Experimental Implementations</h3>
5516 <p>Once a specification reaches the Candidate Recommendation stage,
5517 non-experimental implementations are possible, and implementors should
5518 release an unprefixed implementation of any CR-level feature they can
5519 demonstrate to be correctly implemented according to spec.
5521 <p>To establish and maintain the interoperability of CSS across
5522 implementations, the CSS Working Group requests that non-experimental CSS
5523 renderers submit an implementation report (and, if necessary, the
5524 testcases used for that implementation report) to the W3C before releasing
5525 an unprefixed implementation of any CSS features. Testcases submitted to
5526 W3C are subject to review and correction by the CSS Working Group.
5528 <p>Further information on submitting testcases and implementation reports
5529 can be found from on the CSS Working Group's website at <a
5530 href="http://www.w3.org/Style/CSS/Test/">http://www.w3.org/Style/CSS/Test/</a>.
5531 Questions should be directed to the <a
5532 href="http://lists.w3.org/Archives/Public/public-css-testsuite">public-css-testsuite@w3.org</a>
5533 mailing list.
5535 <h2 class=no-num id=references>References</h2>
5537 <h3 class=no-num id=normative-references>Normative References</h3>
5538 <!--begin-normative-->
5539 <!-- Sorted by label -->
5541 <dl class=bibliography>
5542 <dd style="display: none"><!-- keeps the doc valid if the DL is empty -->
5543 <!---->
5545 <dt id=CHARMOD>[CHARMOD]
5547 <dd>Martin J. Dürst; et al. <a
5548 href="http://www.w3.org/TR/2005/REC-charmod-20050215/"><cite>Character
5549 Model for the World Wide Web 1.0: Fundamentals.</cite></a> 15 February
5550 2005. W3C Recommendation. URL: <a
5551 href="http://www.w3.org/TR/2005/REC-charmod-20050215/">http://www.w3.org/TR/2005/REC-charmod-20050215/</a>
5552 </dd>
5553 <!---->
5555 <dt id=CORS>[CORS]
5557 <dd>Anne van Kesteren. <a
5558 href="http://www.w3.org/TR/2013/CR-cors-20130129/"><cite>Cross-Origin
5559 Resource Sharing.</cite></a> 29 January 2013. W3C Candidate
5560 Recommendation. (Work in progress.) URL: <a
5561 href="http://www.w3.org/TR/2013/CR-cors-20130129/">http://www.w3.org/TR/2013/CR-cors-20130129/</a>
5562 </dd>
5563 <!---->
5565 <dt id=CSS21>[CSS21]
5567 <dd>Bert Bos; et al. <a
5568 href="http://www.w3.org/TR/2011/REC-CSS2-20110607"><cite>Cascading Style
5569 Sheets Level 2 Revision 1 (CSS 2.1) Specification.</cite></a> 7 June
5570 2011. W3C Recommendation. URL: <a
5571 href="http://www.w3.org/TR/2011/REC-CSS2-20110607">http://www.w3.org/TR/2011/REC-CSS2-20110607</a>
5572 </dd>
5573 <!---->
5575 <dt id=CSS3VAL>[CSS3VAL]
5577 <dd>Håkon Wium Lie; Tab Atkins; Elika J. Etemad. <a
5578 href="http://www.w3.org/TR/2012/CR-css3-values-20120828/"><cite>CSS
5579 Values and Units Module Level 3.</cite></a> 28 August 2012. W3C Candidate
5580 Recommendation. (Work in progress.) URL: <a
5581 href="http://www.w3.org/TR/2012/CR-css3-values-20120828/">http://www.w3.org/TR/2012/CR-css3-values-20120828/</a>
5582 </dd>
5583 <!---->
5585 <dt id=HTML5>[HTML5]
5587 <dd>Ian Hickson. <a
5588 href="http://www.w3.org/TR/2012/CR-html5-20121217/"><cite>HTML5.</cite></a>
5589 17 December 2012. W3C Candidate Recommendation. (Work in progress.) URL:
5590 <a
5591 href="http://www.w3.org/TR/2012/CR-html5-20121217/">http://www.w3.org/TR/2012/CR-html5-20121217/</a>
5592 </dd>
5593 <!---->
5595 <dt id=OPEN-FONT-FORMAT>[OPEN-FONT-FORMAT]
5597 <dd><a
5598 href="http://standards.iso.org/ittf/PubliclyAvailableStandards/c052136_ISO_IEC_14496-22_2009(E).zip"><cite>Information
5599 technology — Coding of audio-visual objects — Part 22: Open Font
5600 Format.</cite></a> International Organization for Standardization.
5601 ISO/IEC 14496-22:2009. URL: <a
5602 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>
5603 </dd>
5604 <!---->
5606 <dt id=OPENTYPE>[OPENTYPE]
5608 <dd><a
5609 href="http://www.microsoft.com/typography/otspec/default.htm"><cite>OpenType
5610 specification.</cite></a> Microsoft. URL: <a
5611 href="http://www.microsoft.com/typography/otspec/default.htm">http://www.microsoft.com/typography/otspec/default.htm</a>
5612 </dd>
5613 <!---->
5615 <dt id=OPENTYPE-FEATURES>[OPENTYPE-FEATURES]
5617 <dd><a
5618 href="http://www.microsoft.com/typography/otspec/featurelist.htm"><cite>OpenType
5619 feature registry.</cite></a> Microsoft. URL: <a
5620 href="http://www.microsoft.com/typography/otspec/featurelist.htm">http://www.microsoft.com/typography/otspec/featurelist.htm</a>
5621 </dd>
5622 <!---->
5624 <dt id=RFC2119>[RFC2119]
5626 <dd>S. Bradner. <a href="http://www.ietf.org/rfc/rfc2119.txt"><cite>Key
5627 words for use in RFCs to Indicate Requirement Levels.</cite></a> Internet
5628 RFC 2119. URL: <a
5629 href="http://www.ietf.org/rfc/rfc2119.txt">http://www.ietf.org/rfc/rfc2119.txt</a>
5630 </dd>
5631 <!---->
5633 <dt id=UAX15>[UAX15]
5635 <dd>Mark Davis; Ken Whistler. <a
5636 href="http://www.unicode.org/reports/tr15/"><cite>Unicode Normalization
5637 Forms.</cite></a> 31 August 2012. Unicode Standard Annex #15. URL: <a
5638 href="http://www.unicode.org/reports/tr15/">http://www.unicode.org/reports/tr15/</a>
5639 </dd>
5640 <!---->
5642 <dt id=UAX29>[UAX29]
5644 <dd>Mark Davis. <a
5645 href="http://www.unicode.org/reports/tr29/"><cite>Unicode Text
5646 Segmentation.</cite></a> 12 September 2012. Unicode Standard Annex #29.
5647 URL: <a
5648 href="http://www.unicode.org/reports/tr29/">http://www.unicode.org/reports/tr29/</a>
5649 </dd>
5650 <!---->
5652 <dt id=UNICODE6>[UNICODE6]
5654 <dd>The Unicode Consortium. <a
5655 href="http://www.unicode.org/versions/Unicode6.2.0/"><cite>The Unicode
5656 Standard, Version 6.2.0.</cite></a> Defined by: The Unicode Standard,
5657 Version 6.2.0 URL: <a
5658 href="http://www.unicode.org/versions/Unicode6.2.0/">http://www.unicode.org/versions/Unicode6.2.0/</a>
5659 </dd>
5660 <!---->
5661 </dl>
5662 <!--end-normative-->
5663 <!--{{!CSS21}}-->
5664 <!--{{!CSS3VAL}}-->
5665 <!--{{!OPENTYPE}}-->
5666 <!--{{!OPENTYPE-FEATURES}}-->
5667 <!--{{!OPEN-FONT-FORMAT}}-->
5668 <!--{{!UNICODE6}}-->
5669 <!--{{!UAX15}}-->
5670 <!--{{!UAX29}}-->
5671 <!--{{!CORS}}-->
5672 <!--{{!HTML5}}-->
5673 <!--{{!CHARMOD}}-->
5675 <h3 class=no-num id=other-references>Other References</h3>
5676 <!--begin-informative-->
5677 <!-- Sorted by label -->
5679 <dl class=bibliography>
5680 <dd style="display: none"><!-- keeps the doc valid if the DL is empty -->
5681 <!---->
5683 <dt id=AAT-FEATURES>[AAT-FEATURES]
5685 <dd><a href="http://developer.apple.com/fonts/registry/"><cite>Apple
5686 Advanced Typography font feature registry.</cite></a> Apple. URL: <a
5687 href="http://developer.apple.com/fonts/registry/">http://developer.apple.com/fonts/registry/</a>
5688 </dd>
5689 <!---->
5691 <dt id=ARABIC-TYPO>[ARABIC-TYPO]
5693 <dd>Huda Smitshuijzen AbiFares. <cite>Arabic Typography: A Comprehensive
5694 Sourcebook.</cite> Saqi Books. 2001. ISBN 0-86356-347-3.</dd>
5695 <!---->
5697 <dt id=CHARMOD-NORM>[CHARMOD-NORM]
5699 <dd>François Yergeau; et al. <a
5700 href="http://www.w3.org/TR/2012/WD-charmod-norm-20120501/"><cite>Character
5701 Model for the World Wide Web 1.0: Normalization.</cite></a> 1 May 2012.
5702 W3C Working Draft. (Work in progress.) URL: <a
5703 href="http://www.w3.org/TR/2012/WD-charmod-norm-20120501/">http://www.w3.org/TR/2012/WD-charmod-norm-20120501/</a>
5704 </dd>
5705 <!---->
5707 <dt id=CJKV-INFO-PROCESSING>[CJKV-INFO-PROCESSING]
5709 <dd>Ken Lunde. <cite>CJKV Information Processing, Second Edition.</cite>
5710 O'Reilly Media, Inc. 2009. ISBN 0-596-51447-1.</dd>
5711 <!---->
5713 <dt id=CSS3-CONDITIONAL>[CSS3-CONDITIONAL]
5715 <dd>L. David Baron. <a
5716 href="http://www.w3.org/TR/2012/WD-css3-conditional-20121213/"><cite>CSS
5717 Conditional Rules Module Level 3.</cite></a> 13 December 2012. W3C
5718 Working Draft. (Work in progress.) URL: <a
5719 href="http://www.w3.org/TR/2012/WD-css3-conditional-20121213/">http://www.w3.org/TR/2012/WD-css3-conditional-20121213/</a>
5720 </dd>
5721 <!---->
5723 <dt id=CSS3TEXT>[CSS3TEXT]
5725 <dd>Elika J. Etemad; Koji Ishii. <a
5726 href="http://www.w3.org/TR/2012/WD-css3-text-20121113/"><cite>CSS Text
5727 Module Level 3.</cite></a> 13 November 2012. W3C Working Draft. (Work in
5728 progress.) URL: <a
5729 href="http://www.w3.org/TR/2012/WD-css3-text-20121113/">http://www.w3.org/TR/2012/WD-css3-text-20121113/</a>
5730 </dd>
5731 <!---->
5733 <dt id=DIGITAL-TYPOGRAPHY>[DIGITAL-TYPOGRAPHY]
5735 <dd>Richard Rubinstein. <cite>Digital Typography, An Introduction to Type
5736 and Composition for Computer System Design.</cite> Addison-Wesley. 1988.
5737 ISBN 0-201-17633-5.</dd>
5738 <!---->
5740 <dt id=DOM-LEVEL-2-STYLE>[DOM-LEVEL-2-STYLE]
5742 <dd>Chris Wilson; Philippe Le Hégaret; Vidur Apparao. <a
5743 href="http://www.w3.org/TR/2000/REC-DOM-Level-2-Style-20001113/"><cite>Document
5744 Object Model (DOM) Level 2 Style Specification.</cite></a> 13 November
5745 2000. W3C Recommendation. URL: <a
5746 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>
5747 </dd>
5748 <!---->
5750 <dt id=ELEMTYPO>[ELEMTYPO]
5752 <dd>Robert Bringhurst. <cite>The Elements of Typographic Style, Version
5753 4.</cite> Hartley & Marks. 2013. ISBN 0-88179-212-8.</dd>
5754 <!---->
5756 <dt id=LANGCULTTYPE>[LANGCULTTYPE]
5758 <dd>John D. Berry, Ed. <cite>Language Culture Type.</cite> Graphis. 2001.
5759 ISBN 1-932026-01-0.</dd>
5760 <!---->
5762 <dt id=OPENTYPE-FONT-GUIDE>[OPENTYPE-FONT-GUIDE]
5764 <dd><a
5765 href="https://www.fontfont.com/staticcontent/downloads/FF_OT_User_Guide.pdf"><cite>OpenType
5766 User Guide.</cite></a> FontShop International. URL: <a
5767 href="https://www.fontfont.com/staticcontent/downloads/FF_OT_User_Guide.pdf">https://www.fontfont.com/staticcontent/downloads/FF_OT_User_Guide.pdf</a>
5768 </dd>
5769 <!---->
5771 <dt id=RASTER-TRAGEDY>[RASTER-TRAGEDY]
5773 <dd>Beat Stamm. <a href="http://www.rastertragedy.com/"><cite>The Raster
5774 Tragedy at Low-Resolution Revisited.</cite></a> 7 December 2011. URL: <a
5775 href="http://www.rastertragedy.com/">http://www.rastertragedy.com/</a></dd>
5776 <!---->
5778 <dt id=WINDOWS-GLYPH-PROC>[WINDOWS-GLYPH-PROC]
5780 <dd>John Hudson. <a
5781 href="http://www.microsoft.com/typography/developers/opentype/default.htm"><cite>Windows
5782 Glyph Processing.</cite></a> Microsoft Typogrraphy. URL: <a
5783 href="http://www.microsoft.com/typography/developers/opentype/default.htm">http://www.microsoft.com/typography/developers/opentype/default.htm</a>
5784 </dd>
5785 <!---->
5786 </dl>
5787 <!--end-informative-->
5788 <!--{{ARABIC-TYPO}}-->
5789 <!--{{CJKV-INFO-PROCESSING}}-->
5790 <!--{{DIGITAL-TYPOGRAPHY}}-->
5791 <!--{{DOM-LEVEL-2-STYLE}}-->
5792 <!--{{ELEMTYPO}}-->
5793 <!--{{LANGCULTTYPE}}-->
5794 <!--{{OPENTYPE-FONT-GUIDE}}-->
5795 <!--{{RASTER-TRAGEDY}}-->
5796 <!--{{WINDOWS-GLYPH-PROC}}-->
5797 <!--{{CHARMOD-NORM}}-->
5798 <!--{{AAT-FEATURES}}-->
5799 <!--{{CSS3-CONDITIONAL}}-->
5800 <!--{{CSS3TEXT}}-->
5802 <h2 class=no-num id=index>Index</h2>
5803 <!--begin-index-->
5805 <ul class=indexlist>
5806 <li><absolute-size>, <a href="#ltabsolute-sizegt"
5807 title="<absolute-size>"><strong>3.5</strong></a>
5809 <li><var><common-lig-values></var>, <a href="#ltcommon-lig-values"
5810 title="<common-lig-values>"><strong>6.4</strong></a>
5812 <li><var><contextual-alt-values></var>, <a
5813 href="#ltcontextual-alt-valuesgt"
5814 title="<contextual-alt-values>"><strong>6.4</strong></a>
5816 <li><var><discretionary-lig-values></var>, <a
5817 href="#ltdiscretionary-lig-values"
5818 title="<discretionary-lig-values>"><strong>6.4</strong></a>
5820 <li><var><east-asian-variant-values></var>, <a
5821 href="#lteast-asian-variant-valuesgt"
5822 title="<east-asian-variant-values>"><strong>6.10</strong></a>
5824 <li><var><east-asian-width-values></var>, <a
5825 href="#lteast-asian-width-valuesgt"
5826 title="<east-asian-width-values>"><strong>6.10</strong></a>
5828 <li><var><feature-tag-value></var>, <a href="#ltfeature-tag-valuegt"
5829 title="<feature-tag-value>"><strong>6.12</strong></a>
5831 <li><font-face-name>, <a href="#ltfont-face-namegt"
5832 title="<font-face-name>"><strong>4.3</strong></a>
5834 <li><var><font-variant-css21></var>, <a
5835 href="#ltfont-variant-css21gt"
5836 title="<font-variant-css21>"><strong>3.7</strong></a>
5838 <li><var><historical-lig-values></var>, <a
5839 href="#lthistorical-lig-values"
5840 title="<historical-lig-values>"><strong>6.4</strong></a>
5842 <li><length>, <a href="#ltlengthgt" title="<length>">3.5</a>
5844 <li><number>, <a href="#ltnumbergt" title="<number>">3.6</a>
5846 <li><var><numeric-figure-values></var>, <a
5847 href="#ltnumeric-figure-valuesgt"
5848 title="<numeric-figure-values>"><strong>6.7</strong></a>
5850 <li><var><numeric-fraction-values></var>, <a
5851 href="#ltnumeric-fraction-valuesgt"
5852 title="<numeric-fraction-values>"><strong>6.7</strong></a>
5854 <li><var><numeric-spacing-values></var>, <a
5855 href="#ltnumeric-spacing-valuesgt"
5856 title="<numeric-spacing-values>"><strong>6.7</strong></a>
5858 <li><percentage>, <a href="#ltpercentagegt-"
5859 title="<percentage>">3.5</a>
5861 <li><relative-size>, <a href="#ltrelative-sizegt"
5862 title="<relative-size>"><strong>3.5</strong></a>
5864 <li><urange>, <a href="#lturangegt"
5865 title="<urange>"><strong>4.5</strong></a>
5867 <li>@font-face, <a href="#font-face" title="@font-face">4.1</a>, <a
5868 href="#font-face0" title="@font-face">4.3</a>
5870 <li>all-petite-caps, <a href="#all-petite-caps"
5871 title=all-petite-caps><strong>6.6</strong></a>
5873 <li>all-small-caps, <a href="#all-small-caps"
5874 title=all-small-caps><strong>6.6</strong></a>
5876 <li>annotation, <a href="#annotationltfeature-value-namegt"
5877 title=annotation><strong>6.8</strong></a>
5879 <li>aspect value, <a href="#aspect-value0" title="aspect
5880 value"><strong>3.6</strong></a>
5882 <li>authoring tool, <a href="#authoring-tool" title="authoring
5883 tool"><strong>#</strong></a>
5885 <li>character map, <a href="#character-map" title="character
5886 map"><strong>5.2</strong></a>
5888 <li>character-variant, <a href="#character-variantltfeature-value-namegt"
5889 title=character-variant><strong>6.8</strong></a>
5891 <li>common-ligatures, <a href="#common-ligatures"
5892 title=common-ligatures><strong>6.4</strong></a>
5894 <li>contextual, <a href="#contextual"
5895 title=contextual><strong>6.4</strong></a>
5897 <li>CSSFontFaceRule, <a href="#cssfontfacerule"
5898 title=CSSFontFaceRule><strong>8.1</strong></a>
5900 <li>CSSFontFeatureValuesRule, <a href="#cssfontfeaturevaluesrule"
5901 title=CSSFontFeatureValuesRule><strong>8.2</strong></a>
5903 <li>cursive, definition of, <a href="#cursive0" title="cursive, definition
5904 of"><strong>#</strong></a>
5906 <li>default face, <a href="#default-face" title="default
5907 face"><strong>5.2</strong></a>
5909 <li>descriptor_declaration, <a href="#descriptordeclaration"
5910 title="descriptor_declaration"><strong>4.1</strong></a>
5912 <li>diagonal-fractions, <a href="#diagonal-fractions"
5913 title=diagonal-fractions><strong>6.7</strong></a>
5915 <li>discretionary-ligatures, <a href="#discretionary-ligatures"
5916 title=discretionary-ligatures><strong>6.4</strong></a>
5918 <li>fantasy, definition of, <a href="#fantasy0" title="fantasy, definition
5919 of"><strong>#</strong></a>
5921 <li>feature_type, <a href="#featuretype"
5922 title="feature_type"><strong>6.9</strong></a>
5924 <li>feature_value_block, <a href="#featurevalueblock"
5925 title="feature_value_block"><strong>6.9</strong></a>
5927 <li>feature_value_definition, <a href="#featurevaluedefinition"
5928 title="feature_value_definition"><strong>6.9</strong></a>
5930 <li>font, <a href="#propdef-font" title=font><strong>3.7</strong></a>
5932 <li>font-family, <a href="#descdef-font-family"
5933 title=font-family><strong>4.2</strong></a>, <a
5934 href="#propdef-font-family" title=font-family><strong>3.1</strong></a>
5936 <li>font-feature-settings, <a href="#propdef-font-feature-settings"
5937 title=font-feature-settings><strong>6.12</strong></a>
5939 <li>font-feature-settings (descriptor), <a
5940 href="#descdef-font-feature-settings" title="font-feature-settings
5941 (descriptor)"><strong>4.6</strong></a>
5943 <li>font-kerning, <a href="#propdef-font-kerning"
5944 title=font-kerning><strong>6.3</strong></a>
5946 <li>font-language-override, <a href="#propdef-font-language-override"
5947 title=font-language-override><strong>6.13</strong></a>
5949 <li>font-size, <a href="#propdef-font-size"
5950 title=font-size><strong>3.5</strong></a>
5952 <li>font-size-adjust, <a href="#propdef-font-size-adjust"
5953 title=font-size-adjust><strong>3.6</strong></a>
5955 <li>font-stretch, <a href="#propdef-font-stretch"
5956 title=font-stretch><strong>3.3</strong></a>
5958 <li>font-stretch (descriptor), <a href="#descdef-font-stretch"
5959 title="font-stretch (descriptor)"><strong>4.4</strong></a>
5961 <li>font-style, <a href="#propdef-font-style"
5962 title=font-style><strong>3.4</strong></a>
5964 <li>font-style (descriptor), <a href="#descdef-font-style"
5965 title="font-style (descriptor)"><strong>4.4</strong></a>
5967 <li>font-synthesis, <a href="#propdef-font-synthesis"
5968 title=font-synthesis><strong>3.8</strong></a>
5970 <li>font-variant, <a href="#propdef-font-variant"
5971 title=font-variant><strong>6.11</strong></a>
5973 <li>font-variant (descriptor), <a href="#descdef-font-variant"
5974 title="font-variant (descriptor)"><strong>4.6</strong></a>
5976 <li>font-variant-alternates, <a href="#propdef-font-variant-alternates"
5977 title=font-variant-alternates><strong>6.8</strong></a>
5979 <li>font-variant-caps, <a href="#propdef-font-variant-caps"
5980 title=font-variant-caps><strong>6.6</strong></a>
5982 <li>font-variant-east-asian, <a href="#propdef-font-variant-east-asian"
5983 title=font-variant-east-asian><strong>6.10</strong></a>
5985 <li>font-variant-ligatures, <a href="#propdef-font-variant-ligatures"
5986 title=font-variant-ligatures><strong>6.4</strong></a>
5988 <li>font-variant-numeric, <a href="#propdef-font-variant-numeric"
5989 title=font-variant-numeric><strong>6.7</strong></a>
5991 <li>font-variant-position, <a href="#propdef-font-variant-position"
5992 title=font-variant-position><strong>6.5</strong></a>
5994 <li>font-weight, <a href="#propdef-font-weight"
5995 title=font-weight><strong>3.2</strong></a>
5997 <li>font-weight (descriptor), <a href="#descdef-font-weight"
5998 title="font-weight (descriptor)"><strong>4.4</strong></a>
6000 <li>font_face_rule, <a href="#fontfacerule"
6001 title="font_face_rule"><strong>4.1</strong></a>
6003 <li>font_family_name, <a href="#fontfamilyname"
6004 title="font_family_name"><strong>6.9</strong></a>
6006 <li>font_family_name_list, <a href="#fontfamilynamelist"
6007 title="font_family_name_list"><strong>6.9</strong></a>
6009 <li>font_feature_values_rule, <a href="#fontfeaturevaluesrule"
6010 title="font_feature_values_rule"><strong>6.9</strong></a>
6012 <li>full-width, <a href="#full-width"
6013 title=full-width><strong>6.10</strong></a>
6015 <li>historical-forms, <a href="#historical-forms"
6016 title=historical-forms><strong>6.8</strong></a>
6018 <li>historical-ligatures, <a href="#historical-ligatures"
6019 title=historical-ligatures><strong>6.4</strong></a>
6021 <li>jis04, <a href="#jis04" title=jis04><strong>6.10</strong></a>
6023 <li>jis78, <a href="#jis78" title=jis78><strong>6.10</strong></a>
6025 <li>jis83, <a href="#jis83" title=jis83><strong>6.10</strong></a>
6027 <li>jis90, <a href="#jis90" title=jis90><strong>6.10</strong></a>
6029 <li>lining-nums, <a href="#lining-nums"
6030 title=lining-nums><strong>6.7</strong></a>
6032 <li>monospace, definition of, <a href="#monospace0" title="monospace,
6033 definition of"><strong>#</strong></a>
6035 <li>no-common-ligatures, <a href="#no-common-ligatures"
6036 title=no-common-ligatures><strong>6.4</strong></a>
6038 <li>no-contextual, <a href="#no-contextual"
6039 title=no-contextual><strong>6.4</strong></a>
6041 <li>no-discretionary-ligatures, <a href="#no-discretionary-ligatures"
6042 title=no-discretionary-ligatures><strong>6.4</strong></a>
6044 <li>no-historical-ligatures, <a href="#no-historical-ligatures"
6045 title=no-historical-ligatures><strong>6.4</strong></a>
6047 <li>normal, <a href="#normal" title=normal><strong>6.6</strong></a>, <a
6048 href="#normal0" title=normal><strong>6.7</strong></a>, <a href="#normal1"
6049 title=normal><strong>6.8</strong></a>, <a href="#normal2"
6050 title=normal><strong>6.10</strong></a>
6052 <li>oldstyle-nums, <a href="#oldstyle-nums"
6053 title=oldstyle-nums><strong>6.7</strong></a>
6055 <li>ordinal, <a href="#ordinal" title=ordinal><strong>6.7</strong></a>
6057 <li>ornaments, <a href="#ornamentsltfeature-value-namegt"
6058 title=ornaments><strong>6.8</strong></a>
6060 <li>petite-caps, <a href="#petite-caps"
6061 title=petite-caps><strong>6.6</strong></a>
6063 <li>proportional-nums, <a href="#proportional-nums"
6064 title=proportional-nums><strong>6.7</strong></a>
6066 <li>proportional-width, <a href="#proportional-width"
6067 title=proportional-width><strong>6.10</strong></a>
6069 <li>renderer, <a href="#renderer" title=renderer><strong>#</strong></a>
6071 <li>ruby, <a href="#ruby" title=ruby><strong>6.10</strong></a>
6073 <li>sans-serif, definition of, <a href="#sans-serif0" title="sans-serif,
6074 definition of"><strong>#</strong></a>
6076 <li>serif, definition of, <a href="#serif0" title="serif, definition
6077 of"><strong>#</strong></a>
6079 <li>simplified, <a href="#simplified"
6080 title=simplified><strong>6.10</strong></a>
6082 <li>slashed-zero, <a href="#slashed-zero"
6083 title=slashed-zero><strong>6.7</strong></a>
6085 <li>small-caps, <a href="#small-caps"
6086 title=small-caps><strong>6.6</strong></a>
6088 <li>src, <a href="#descdef-src" title=src><strong>4.3</strong></a>
6090 <li>stacked-fractions, <a href="#stacked-fractions"
6091 title=stacked-fractions><strong>6.7</strong></a>
6093 <li>style sheet
6094 <ul>
6095 <li>as conformance class, <a href="#style-sheet" title="style sheet, as
6096 conformance class"><strong>#</strong></a>
6097 </ul>
6099 <li>styleset, <a href="#stylesetltfeature-value-namegt"
6100 title=styleset><strong>6.8</strong></a>
6102 <li>stylistic, <a href="#stylisticltfeature-value-namegt"
6103 title=stylistic><strong>6.8</strong></a>
6105 <li>swash, <a href="#swashltfeature-value-namegt"
6106 title=swash><strong>6.8</strong></a>
6108 <li>tabular-nums, <a href="#tabular-nums"
6109 title=tabular-nums><strong>6.7</strong></a>
6111 <li>titling-caps, <a href="#titling-caps"
6112 title=titling-caps><strong>6.6</strong></a>
6114 <li>traditional, <a href="#traditional"
6115 title=traditional><strong>6.10</strong></a>
6117 <li>unicase, <a href="#unicase" title=unicase><strong>6.6</strong></a>
6119 <li>unicode-range, <a href="#descdef-unicode-range"
6120 title=unicode-range><strong>4.5</strong></a>
6122 <li>weight, <a href="#weight" title=weight><strong>2</strong></a>
6124 <li>width, <a href="#width" title=width><strong>2</strong></a>
6125 </ul>
6126 <!--end-index-->
6128 <h2 class=no-num id=property-index>Property index</h2>
6129 <!--begin-properties-->
6131 <table class=proptable>
6132 <thead>
6133 <tr>
6134 <th>Property
6136 <th>Values
6138 <th>Initial
6140 <th>Applies to
6142 <th>Inh.
6144 <th>Percentages
6146 <th>Media
6148 <tbody>
6149 <tr>
6150 <th><a class=property href="#propdef-font">font</a>
6152 <td>[ [ <‘font-style’> || <font-variant-css21> ||
6153 <‘font-weight’> || <‘font-stretch’> ]?
6154 <‘font-size’> [ / <‘line-height’> ]?
6155 <‘font-family’> ] | caption | icon | menu | message-box |
6156 small-caption | status-bar
6158 <td>see individual properties
6160 <td>all elements
6162 <td>yes
6164 <td>see individual properties
6166 <td>visual
6168 <tr>
6169 <th><a class=property href="#descdef-font-family">font-family</a>
6171 <td>[ <family-name> | <generic-family> ]#
6173 <td>depends on user agent
6175 <td>all elements
6177 <td>yes
6179 <td>N/A
6181 <td>visual
6183 <tr>
6184 <th><a class=property
6185 href="#propdef-font-feature-settings">font-feature-settings</a>
6187 <td>normal | <feature-tag-value>#
6189 <td>normal
6191 <td>all elements
6193 <td>yes
6195 <td>N/A
6197 <td>visual
6199 <tr>
6200 <th><a class=property href="#propdef-font-kerning">font-kerning</a>
6202 <td>auto | normal | none
6204 <td>auto
6206 <td>all elements
6208 <td>yes
6210 <td>N/A
6212 <td>visual
6214 <tr>
6215 <th><a class=property
6216 href="#propdef-font-language-override">font-language-override</a>
6218 <td>normal | <string>
6220 <td>normal
6222 <td>all elements
6224 <td>yes
6226 <td>N/A
6228 <td>visual
6230 <tr>
6231 <th><a class=property href="#propdef-font-size">font-size</a>
6233 <td><absolute-size> | <relative-size> | <length> |
6234 <percentage>
6236 <td>medium
6238 <td>all elements
6240 <td>yes
6242 <td>refer to parent element's font size
6244 <td>visual
6246 <tr>
6247 <th><a class=property
6248 href="#propdef-font-size-adjust">font-size-adjust</a>
6250 <td>none | auto | <number>
6252 <td>none
6254 <td>all elements
6256 <td>yes
6258 <td>N/A
6260 <td>visual
6262 <tr>
6263 <th><a class=property href="#propdef-font-stretch">font-stretch</a>
6265 <td>normal | ultra-condensed | extra-condensed | condensed |
6266 semi-condensed | semi-expanded | expanded | extra-expanded |
6267 ultra-expanded
6269 <td>normal
6271 <td>all elements
6273 <td>yes
6275 <td>N/A
6277 <td>visual
6279 <tr>
6280 <th><a class=property href="#propdef-font-style">font-style</a>
6282 <td>normal | italic | oblique
6284 <td>normal
6286 <td>all elements
6288 <td>yes
6290 <td>N/A
6292 <td>visual
6294 <tr>
6295 <th><a class=property href="#propdef-font-synthesis">font-synthesis</a>
6297 <td>none | [ weight || style ]
6299 <td>weight style
6301 <td>all elements
6303 <td>yes
6305 <td>N/A
6307 <td>visual
6309 <tr>
6310 <th><a class=property href="#propdef-font-variant">font-variant</a>
6312 <td>normal | none | [ <common-lig-values> ||
6313 <discretionary-lig-values> || <historical-lig-values> ||
6314 <contextual-alt-values> || stylistic(<feature-value-name>)
6315 || historical-forms || styleset(<feature-value-name>#) ||
6316 character-variant(<feature-value-name>#) ||
6317 swash(<feature-value-name>) ||
6318 ornaments(<feature-value-name>) ||
6319 annotation(<feature-value-name>) || [ small-caps | all-small-caps
6320 | petite-caps | all-petite-caps | unicase | titling-caps ] ||
6321 <numeric-figure-values> || <numeric-spacing-values> ||
6322 <numeric-fraction-values> || ordinal || slashed-zero ||
6323 <east-asian-variant-values> || <east-asian-width-values> ||
6324 ruby ]
6326 <td>normal
6328 <td>all elements
6330 <td>yes
6332 <td>see individual properties
6334 <td>visual
6336 <tr>
6337 <th><a class=property
6338 href="#propdef-font-variant-alternates">font-variant-alternates</a>
6340 <td>normal | [ stylistic(<feature-value-name>) || historical-forms
6341 || styleset(<feature-value-name>#) ||
6342 character-variant(<feature-value-name>#) ||
6343 swash(<feature-value-name>) ||
6344 ornaments(<feature-value-name>) ||
6345 annotation(<feature-value-name>) ]
6347 <td>normal
6349 <td>all elements
6351 <td>yes
6353 <td>N/A
6355 <td>visual
6357 <tr>
6358 <th><a class=property
6359 href="#propdef-font-variant-caps">font-variant-caps</a>
6361 <td>normal | small-caps | all-small-caps | petite-caps | all-petite-caps
6362 | unicase | titling-caps
6364 <td>normal
6366 <td>all elements
6368 <td>yes
6370 <td>N/A
6372 <td>visual
6374 <tr>
6375 <th><a class=property
6376 href="#propdef-font-variant-east-asian">font-variant-east-asian</a>
6378 <td>normal | [ <east-asian-variant-values> ||
6379 <east-asian-width-values> || ruby ]
6381 <td>normal
6383 <td>all elements
6385 <td>yes
6387 <td>N/A
6389 <td>visual
6391 <tr>
6392 <th><a class=property
6393 href="#propdef-font-variant-ligatures">font-variant-ligatures</a>
6395 <td>normal | none | [ <common-lig-values> ||
6396 <discretionary-lig-values> || <historical-lig-values> ||
6397 <contextual-alt-values> ]
6399 <td>normal
6401 <td>all elements
6403 <td>yes
6405 <td>N/A
6407 <td>visual
6409 <tr>
6410 <th><a class=property
6411 href="#propdef-font-variant-numeric">font-variant-numeric</a>
6413 <td>normal | [ <numeric-figure-values> ||
6414 <numeric-spacing-values> || <numeric-fraction-values> ||
6415 ordinal || slashed-zero ]
6417 <td>normal
6419 <td>all elements
6421 <td>yes
6423 <td>N/A
6425 <td>visual
6427 <tr>
6428 <th><a class=property
6429 href="#propdef-font-variant-position">font-variant-position</a>
6431 <td>normal | sub | super
6433 <td>normal
6435 <td>all elements
6437 <td>yes
6439 <td>N/A
6441 <td>visual
6443 <tr>
6444 <th><a class=property href="#propdef-font-weight">font-weight</a>
6446 <td>normal | bold | bolder | lighter | 100 | 200 | 300 | 400 | 500 | 600
6447 | 700 | 800 | 900
6449 <td>normal
6451 <td>all elements
6453 <td>yes
6455 <td>N/A
6457 <td>visual
6458 </table>
6459 <!--end-properties-->
6460 <!--begin-descriptors-->
6462 <table class=proptable>
6463 <thead>
6464 <tr>
6465 <th>Descriptor
6467 <th>Value
6469 <th>Initial
6471 <th>Percentages
6473 <th>Media
6475 <tbody>
6476 <tr>
6477 <th><a class=property href="#descdef-font-family">font-family</a>
6479 <td><family-name>
6481 <td>N/A
6483 <tr>
6484 <th><a class=property
6485 href="#propdef-font-feature-settings">font-feature-settings</a>
6487 <td>normal | <feature-tag-value>#
6489 <td>normal
6491 <tr>
6492 <th><a class=property href="#propdef-font-stretch">font-stretch</a>
6494 <td>normal | ultra-condensed | extra-condensed | condensed |
6495 semi-condensed | semi-expanded | expanded | extra-expanded |
6496 ultra-expanded
6498 <td>normal
6500 <tr>
6501 <th><a class=property href="#propdef-font-style">font-style</a>
6503 <td>normal | italic | oblique
6505 <td>normal
6507 <tr>
6508 <th><a class=property href="#propdef-font-variant">font-variant</a>
6510 <td>normal | [ <common-lig-values> ||
6511 <discretionary-lig-values> || <historical-lig-values> ||
6512 <contextual-alt-values> || stylistic(<feature-value-name>)
6513 || historical-forms || styleset(<feature-value-name>#) ||
6514 character-variant(<feature-value-name>#) ||
6515 swash(<feature-value-name>) ||
6516 ornaments(<feature-value-name>) ||
6517 annotation(<feature-value-name>) || [ small-caps | all-small-caps
6518 | petite-caps | all-petite-caps | unicase | titling-caps ] ||
6519 <numeric-figure-values> || <numeric-spacing-values> ||
6520 <numeric-fraction-values> || ordinal || slashed-zero ||
6521 <east-asian-variant-values> || <east-asian-width-values> ||
6522 ruby ]
6524 <td>normal
6526 <tr>
6527 <th><a class=property href="#propdef-font-weight">font-weight</a>
6529 <td>normal | bold | 100 | 200 | 300 | 400 | 500 | 600 | 700 | 800 | 900
6531 <td>normal
6533 <tr>
6534 <th><a class=property href="#descdef-src">src</a>
6536 <td>[ <url> [format(<string>#)]? | <font-face-name> ]#
6538 <td>N/A
6540 <tr>
6541 <th><a class=property href="#descdef-unicode-range">unicode-range</a>
6543 <td><urange>#
6545 <td>U+0-10FFFF
6546 </table>
6547 <!--end-descriptors-->
6548 <script type="text/javascript">
6549 window.onload = function () {
6550 if (!("devicePixelRatio" in window && window.devicePixelRatio > 1)) return;
6551 var i, hiresElements = document.getElementsByClassName("hires");
6552 for (i = 0; i < hiresElements.length; i++) {
6553 var h = hiresElements[i];
6554 if (h.tagName != "IMG") continue;
6555 var src = h.getAttribute("src");
6556 var src2x = src.replace(/\.\w+$/, function(m) { return "@2x" + m; });
6557 h.src = src2x;
6558 }
6559 }
6560 </script>
6561 </html>
6562 <!-- Keep this comment at the end of the file
6563 Local variables:
6564 mode: sgml
6565 sgml-declaration:"~/SGML/HTML4.decl"
6566 sgml-default-doctype-name:"html"
6567 sgml-minimize-attributes:t
6568 sgml-nofill-elements:("pre" "style" "br")
6569 sgml-live-element-indicator:t
6570 sgml-omittag:nil
6571 sgml-shorttag:nil
6572 sgml-namecase-general:t
6573 sgml-general-insert-case:lower
6574 sgml-always-quote-attributes:t
6575 sgml-indent-step:nil
6576 sgml-indent-data:t
6577 sgml-parent-document:nil
6578 sgml-exposed-tags:nil
6579 sgml-local-catalogs:nil
6580 sgml-local-ecat-files:nil
6581 End:
6582 -->
6583 <!--
6585 to do:
6587 - wording of OpenType family name handling
6588 - handling combining sequences in the font matching algorithm
6589 - fix-up fi ligature example
6591 -->