Fri, 17 May 2013 17:03:30 +0900
[css-fonts] minor editorial tweaks
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-17-may-2013>Editor's Draft 17
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-20130517/">http://www.w3.org/TR/2013/ED-css3-fonts-20130517/</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>The scale is relative, so a face with a font-stretch value higher in the
1179 list above should never appear wider. When a face does not exist for a
1180 given width, normal or condensed values map to a narrower face, otherwise
1181 a wider face. Conversely, expanded values map to a wider face, otherwise a
1182 narrower face. The figure below shows how the nine font-stretch property
1183 settings affect font selection for font family containing a variety of
1184 widths, grey indicates a width for which no face exists and a different
1185 width is substituted:
1187 <div class=figure><img alt="width mappings for a family with condensed,
1188 normal and expanded faces" src=universwidths.png>
1189 <p class=caption>Width mappings for a font family with condensed, normal
1190 and expanded width faces
1191 </div>
1193 <p id=font-stretch-animation>Animation of font stretch: Font stretch is
1194 interpolated in discrete steps. The interpolation happens as though the
1195 ordered values are equally spaced real numbers. The interpolation result
1196 is rounded to the nearest value, with values exactly halfway between two
1197 values rounded towards the later value in the list above.</p>
1198 <!-- prop: font-style -->
1200 <h3 id=font-style-prop><span class=secno>3.4 </span>Font style: the <a
1201 href="#propdef-font-style">font-style</a> property</h3>
1203 <table class=propdef id=namefont-stylevaluenormal-italic-oblique>
1204 <tbody>
1205 <tr>
1206 <td>Name:
1208 <td><dfn id=propdef-font-style>font-style</dfn>
1210 <tr>
1211 <td>Value:
1213 <td>normal | italic | oblique
1215 <tr>
1216 <td>Initial:
1218 <td>normal
1220 <tr>
1221 <td>Applies to:
1223 <td>all elements
1225 <tr>
1226 <td>Inherited:
1228 <td>yes
1230 <tr>
1231 <td>Percentages:
1233 <td>N/A
1235 <tr>
1236 <td>Media:
1238 <td>visual
1240 <tr>
1241 <td>Computed value:
1243 <td>as specified
1245 <tr>
1246 <td>Animatable:
1248 <td>no
1249 </table>
1251 <p>The <a class=noxref href="#font-style-prop"><span
1252 class=property>‘<code class=property>font-style</code>’</span></a>
1253 property allows italic or oblique faces to be selected. Italic forms are
1254 generally cursive in nature while oblique faces are typically sloped
1255 versions of the regular face. Oblique faces can be simulated by
1256 artificially sloping the glyphs of the regular face. Compare the
1257 artificially sloped renderings of Palatino ‘<code
1258 class=property>a</code>’ and Baskerville ‘<code
1259 class=property>N</code>’ in grey with the actual italic versions:
1261 <div class=figure><img alt="artificial sloping vs. real italics"
1262 src=realvsfakeitalics.png>
1263 <p class=caption>Artificial sloping versus real italics
1264 </div>
1266 <p>A value of ‘<a href="#normal2"><code
1267 class=property>normal</code></a>’ selects a face that is classified as
1268 ‘<a href="#normal2"><code class=property>normal</code></a>’, while
1269 ‘<code class=property>oblique</code>’ selects a font that is labeled
1270 ‘<code class=property>oblique</code>’. A value of ‘<code
1271 class=property>italic</code>’ selects a font that is labeled ‘<code
1272 class=property>italic</code>’, or, if that is not available, one labeled
1273 ‘<code class=property>oblique</code>’. If no italic or oblique face is
1274 available, oblique faces can be synthesized by rendering non-obliqued
1275 faces with a right sloping transformation applied. When synthesizing these
1276 faces, the transformation should apply to all glyphs in the same way and
1277 not vary based on codepoint or due to horizontal or vertical line
1278 orientation.
1280 <p>Many scripts lack the tradition of mixing a cursive form within text
1281 rendered with a normal face. Chinese, Japanese and Korean fonts almost
1282 always lack italic or oblique faces. Fonts that support a mixture of
1283 scripts will sometimes omit specific scripts such as Arabic from the set
1284 of glyphs supported in the italic face. User agents should be careful
1285 about making character map assumptions across faces.
1287 <p class=issue>For synthetic italics in vertical runs of Chinese, Japanese,
1288 or Korean text, is there a need to define explicitly the direction of the
1289 faux oblique for runs that include a mixture of ideographic and Latin
1290 text?</p>
1291 <!-- prop: font-size -->
1293 <h3 id=font-size-prop><span class=secno>3.5 </span>Font size: the <a
1294 href="#propdef-font-size">font-size</a> property</h3>
1296 <table class=propdef id=namefont-sizevalueltabsolute-size-ltrela>
1297 <tbody>
1298 <tr>
1299 <td>Name:
1301 <td><dfn id=propdef-font-size>font-size</dfn>
1303 <tr>
1304 <td>Value:
1306 <td><absolute-size> | <relative-size> | <length> |
1307 <percentage>
1309 <tr>
1310 <td>Initial:
1312 <td>medium
1314 <tr>
1315 <td>Applies to:
1317 <td>all elements
1319 <tr>
1320 <td>Inherited:
1322 <td>yes
1324 <tr>
1325 <td>Percentages:
1327 <td>refer to parent element's font size
1329 <tr>
1330 <td>Media:
1332 <td>visual
1334 <tr>
1335 <td>Computed value:
1337 <td>absolute length
1339 <tr>
1340 <td>Animatable:
1342 <td>as <a
1343 href="http://dev.w3.org/csswg/css3-transitions/#animtype-length">length</a>
1344 </table>
1346 <p>This property indicates the desired height of glyphs from the font. For
1347 scalable fonts, the font-size is a scale factor applied to the EM unit of
1348 the font. (Note that certain glyphs may bleed outside their EM box.) For
1349 non-scalable fonts, the font-size is converted into absolute units and
1350 matched against the declared font-size of the font, using the same
1351 absolute coordinate space for both of the matched values. Values have the
1352 following meanings:
1354 <dl>
1355 <dt><a name=x18><span class=index-def id=ltabsolute-sizegt
1356 title="<absolute-size>">
1357 <strong><absolute-size></strong></span></a>
1359 <dd> An <a class=value-def
1360 name=value-def-absolute-size><absolute-size></a> keyword refers to
1361 an entry in a table of font sizes computed and kept by the user agent.
1362 Possible values are:
1363 <p> [ xx-small | x-small | small | medium | large | x-large | xx-large ]</p>
1365 <dt><a name=x19><span class=index-def id=ltrelative-sizegt
1366 title="<relative-size>">
1367 <strong><relative-size></strong></span></a>
1369 <dd> A <a class=value-def
1370 name=value-def-relative-size><relative-size></a> keyword is
1371 interpreted relative to the table of font sizes and the computed ‘<a
1372 href="#propdef-font-size"><code class=property>font-size</code></a>’ of
1373 the parent element. Possible values are:
1374 <p> [ larger | smaller ]
1376 <p> For example, if the parent element has a font size of ‘<code
1377 class=property>medium</code>’, a value of ‘<code
1378 class=property>larger</code>’ will make the font size of the current
1379 element be ‘<code class=property>large</code>’. If the parent
1380 element's size is not close to a table entry, the user agent is free to
1381 interpolate between table entries or round off to the closest one. The
1382 user agent may have to extrapolate table values if the numerical value
1383 goes beyond the keywords.
1385 <dt><span class=index-inst id=ltlengthgt
1386 title="<length>"><length></span>
1388 <dd>A length value specifies an absolute font size (independent of the
1389 user agent's font table). Negative lengths are illegal.
1391 <dt><span class=index-inst id=ltpercentagegt-
1392 title="<percentage>"><percentage> </span>
1394 <dd>A percentage value specifies an absolute font size relative to the
1395 parent element's font size. Use of percentage values, or values in
1396 ‘<code class=property>em</code>’s, leads to more robust and
1397 cascadable style sheets.
1398 </dl>
1400 <p>The following table provides user agent guidelines for the absolute-size
1401 scaling factor and their mapping to HTML heading and absolute font-sizes.
1402 The ‘<code class=property>medium</code>’ value is used as the
1403 reference middle value. The user agent may fine-tune these values for
1404 different fonts or different types of display devices.
1406 <table class=data>
1407 <thead>
1408 <tr>
1409 <th>CSS absolute-size values
1411 <th>xx-small
1413 <th>x-small
1415 <th>small
1417 <th>medium
1419 <th>large
1421 <th>x-large
1423 <th>xx-large
1425 <th>
1427 <tbody>
1428 <tr>
1429 <th>scaling factor
1431 <td>3/5
1433 <td>3/4
1435 <td>8/9
1437 <td>1
1439 <td>6/5
1441 <td>3/2
1443 <td>2/1
1445 <td>3/1
1447 <tr>
1448 <th>HTML headings
1450 <td>h6
1452 <td>
1454 <td>h5
1456 <td>h4
1458 <td>h3
1460 <td>h2
1462 <td>h1
1464 <td>
1466 <tr>
1467 <th>HTML font sizes
1469 <td>1
1471 <td>
1473 <td>2
1475 <td>3
1477 <td>4
1479 <td>5
1481 <td>6
1483 <td>7
1484 </table>
1486 <p class=note><em><strong>Note 1.</strong> To preserve readability, an UA
1487 applying these guidelines should nevertheless avoid creating font-size
1488 resulting in less than 9 device pixels per EM unit on a computer display
1489 .</em>
1491 <p class=note><em><strong>Note 2.</strong> In CSS1, the suggested scaling
1492 factor between adjacent indexes was 1.5 which user experience proved to be
1493 too large. In CSS2, the suggested scaling factor for computer screen
1494 between adjacent indexes was 1.2 which still created issues for the small
1495 sizes. The new scaling factor varies between each index to provide a
1496 better readability.</em>
1498 <p>The actual value of this property may differ from the computed value due
1499 a numerical value on ‘<a href="#propdef-font-size-adjust"><code
1500 class=property>font-size-adjust</code></a>’ and the unavailability of
1501 certain font sizes.
1503 <p>Child elements inherit the computed <a class=noxref
1504 href="#font-size-prop"> <span class=property>‘<code
1505 class=property>font-size</code>’</span></a> value (otherwise, the effect
1506 of <a class=noxref href="#font-size-adjust-prop"><span
1507 class=property>‘<code
1508 class=property>font-size-adjust</code>’</span></a> would compound).
1510 <div class=example>
1511 <p style="display:none">Example(s):
1513 <p>
1515 <pre>p { font-size: 12pt; }
1516 blockquote { font-size: larger }
1517 em { font-size: 150% }
1518 em { font-size: 1.5em }
1519 </pre>
1520 </div>
1521 <!-- prop: font-size-adjust -->
1523 <h3 id=font-size-adjust-prop><span class=secno>3.6 </span>Relative sizing:
1524 the <a href="#propdef-font-size-adjust">font-size-adjust</a> property</h3>
1526 <table class=propdef id=namefont-size-adjustvaluenone-auto-ltnum>
1527 <tbody>
1528 <tr>
1529 <td>Name:
1531 <td><dfn id=propdef-font-size-adjust>font-size-adjust</dfn>
1533 <tr>
1534 <td>Value:
1536 <td>none | auto | <number>
1538 <tr>
1539 <td>Initial:
1541 <td>none
1543 <tr>
1544 <td>Applies to:
1546 <td>all elements
1548 <tr>
1549 <td>Inherited:
1551 <td>yes
1553 <tr>
1554 <td>Percentages:
1556 <td>N/A
1558 <tr>
1559 <td>Media:
1561 <td>visual
1563 <tr>
1564 <td>Computed value:
1566 <td>as specified
1568 <tr>
1569 <td>Animatable:
1571 <td>as <a
1572 href="http://dev.w3.org/csswg/css3-transitions/#animtype-number">number</a>
1573 </table>
1575 <p>For any given font size, the apparent size and legibility of text varies
1576 across fonts. For scripts such as Latin or Cyrillic that distinguish
1577 between upper and lowercase letters, the relative height of lowercase
1578 letters compared to their uppercase counterparts is a determining factor
1579 of legibility. This is commonly referred to as the <a class=index-def
1580 href="#aspect-value" id=aspect-value0 title="aspect value"><dfn
1581 id=aspect-value>aspect value</dfn></a>. Precisely defined, it is equal to
1582 the x-height of a font divided by the font size.
1584 <p>In situations where font fallback occurs, fallback fonts may not share
1585 the same aspect ratio as the desired font family and will thus appear less
1586 readable. The font-size-adjust property is a way to preserve the
1587 readability of text when font fallback occurs. It does this by adjusting
1588 the font-size so that the x-height is the same regardless of the font
1589 used.
1591 <div class=example>
1592 <p>The style defined below defines Verdana as the desired font family, but
1593 if Verdana is not available Futura or Times will be used.</p>
1595 <pre>p {
1596 font-family: Verdana, Futura, Times;
1597 }
1599 <p>Lorem ipsum dolor sit amet, ...</p>
1600 </pre>
1602 <p>Verdana has a relatively high aspect ratio, lowercase letters are
1603 relatively tall compared to uppercase letters, so at small sizes text
1604 appears legible. Times has a lower aspect ratio and so if fallback
1605 occurs, the text will be less legible at small sizes than Verdana.</p>
1606 </div>
1608 <p>How text rendered in each of these fonts compares is shown below, the
1609 columns show text rendered in Verdana, Futura and Times. The same
1610 font-size value is used across cells within each row and red lines are
1611 included to show the differences in x-height. In the upper half each row
1612 is rendered in the same font-size value. The same is true for the lower
1613 half but in this half the font-size-adjust property is also set so that
1614 the actual font size is adjusted to preserve the x-height across each row.
1615 Note how small text remains relatively legible across each row in the
1616 lower half.
1618 <div class=figure><img alt="text with and without font-size-adjust"
1619 src=fontsizeadjust.png>
1620 <p class=caption>Text with and without the use of font-size-adjust
1621 </div>
1623 <p>This property allows authors to specify an aspect value for an element
1624 that will effectively preserve the x-height of the first choice font,
1625 whether it is substituted or not. Values have the following meanings:
1627 <dl>
1628 <dt><strong>none</strong>
1630 <dd>Do not preserve the font's x-height.
1632 <dt><strong>auto</strong>
1634 <dd>Behaves just like <number>, except the number used is the aspect
1635 value calculated by user agents for the first font in the list of fonts
1636 defined for the initial value of the ‘<a
1637 href="#descdef-font-family"><code
1638 class=property>font-family</code></a>’ property. Effectively this is
1639 the default font used when ‘<a href="#descdef-font-family"><code
1640 class=property>font-family</code></a>’ is not otherwise specified.
1641 <p>Authors can use this value to specify that font size should be
1642 normalized across fonts based on the x-height without the need to
1643 specify the aspect ratio explicitly.</p>
1645 <dt><span class=index-inst id=ltnumbergt
1646 title="<number>"><number></span>
1648 <dd>Specifies the aspect value used in the calculation below to calculate
1649 the adjusted font size:
1650 <pre>c = ( a / a' ) s
1651 </pre>
1653 <p>where:</p>
1655 <pre>s = font-size value
1656 a = aspect value as specified by the font-size-adjust property
1657 a' = aspect value of actual font
1658 c = adjusted font-size to use
1659 </pre>
1661 <p>This value applies to any font that is selected but in typical usage
1662 it should be based on the aspect value of the first font in the
1663 font-family list. If this is specified accurately, the <tt>(a/a')</tt>
1664 term in the formula above is effectively 1 for the first font and no
1665 adjustment occurs. If the value is specified inaccurately, text rendered
1666 using the first font in the family list will display differently in
1667 older user agents that don't support font-size-adjust.</p>
1668 </dl>
1670 <p>Authors can calculate the aspect value for a given font by comparing
1671 spans with the same content but different font-size-adjust properties. If
1672 the same font-size is used, the spans will match when the font-size-adjust
1673 value is accurate for the given font.
1675 <div class=example>
1676 <p>Two spans with borders are used to determine the aspect value of a
1677 font. The font-size is the same for both spans but the font-size-adjust
1678 property is specified only for the right span. Starting with a value of
1679 0.5, the aspect value can be adjusted until the borders around the two
1680 letters line up.</p>
1682 <pre>p {
1683 font-family: Futura;
1684 font-size: 500px;
1685 }
1687 span {
1688 border: solid 1px red;
1689 }
1691 .adjust {
1692 font-size-adjust: 0.5;
1693 }
1695 <p><span>b</span><span class="adjust">b</span></p>
1696 </pre>
1698 <div class=figure><img alt="Futura with an aspect value of 0.5"
1699 src=beforefontsizeadjust.png>
1700 <p class=caption>Futura with an aspect value of 0.5
1701 </div>
1703 <p>The box on the right is a bit bigger than the one on the left, so the
1704 aspect value of this font is something less than 0.5. Adjust the value
1705 until the boxes align.</p>
1706 </div>
1707 <!-- prop: font -->
1708 <!-- jtdfix, crap, preprocessor is inserting links to descriptors rather than properties. bert, make it stop... -->
1709 <!-- <a href="#font-stretch-prop" class="noxref"><span class="property">'font-stretch'</span></a> -->
1711 <h3 id=font-prop><span class=secno>3.7 </span>Shorthand font property: the
1712 <a href="#propdef-font">font</a> property</h3>
1714 <table class=propdef id=namefontvalue-ltlsquofont-stylersquo-ltf>
1715 <tbody>
1716 <tr>
1717 <td>Name:
1719 <td><dfn id=propdef-font>font</dfn>
1721 <tr>
1722 <td>Value:
1724 <td>[ [ <‘<a href="#propdef-font-style"><code
1725 class=property>font-style</code></a>’> || <font-variant-css21> ||
1726 <‘<a href="#propdef-font-weight"><code
1727 class=property>font-weight</code></a>’> || <‘<a
1728 href="#propdef-font-stretch"><code
1729 class=property>font-stretch</code></a>’> ]? <‘<a
1730 href="#propdef-font-size"><code class=property>font-size</code></a>’>
1731 [ / <‘<code class=property>line-height</code>’> ]? <‘<a
1732 href="#descdef-font-family"><code
1733 class=property>font-family</code></a>’> ] | caption | icon | menu |
1734 message-box | small-caption | status-bar
1736 <tr>
1737 <td>Initial:
1739 <td>see individual properties
1741 <tr>
1742 <td>Applies to:
1744 <td>all elements
1746 <tr>
1747 <td>Inherited:
1749 <td>yes
1751 <tr>
1752 <td>Percentages:
1754 <td>see individual properties
1756 <tr>
1757 <td>Media:
1759 <td>visual
1761 <tr>
1762 <td>Computed value:
1764 <td>see individual properties
1766 <tr>
1767 <td>Animatable:
1769 <td>see individual properties
1770 </table>
1772 <p>The <span class=property>‘<a href="#propdef-font"><code
1773 class=property>font</code></a>’</span> property is, except as described
1774 below, a shorthand property for setting ‘<a
1775 href="#propdef-font-style"><code class=property>font-style</code></a>’,
1776 <span class=property>‘<a href="#propdef-font-variant"><code
1777 class=property>font-variant</code></a>’</span>, <span
1778 class=property>‘<a href="#propdef-font-weight"><code
1779 class=property>font-weight</code></a>’</span>, <span
1780 class=property>‘<a href="#propdef-font-stretch"><code
1781 class=property>font-stretch</code></a>’</span>, <span
1782 class=property>‘<a href="#propdef-font-size"><code
1783 class=property>font-size</code></a>’</span>, ‘<code
1784 class=property>line-height</code>’, <span class=property>‘<a
1785 href="#descdef-font-family"><code
1786 class=property>font-family</code></a>’</span> at the same place in the
1787 stylesheet. Values for the <span class=property>‘<a
1788 href="#propdef-font-variant"><code
1789 class=property>font-variant</code></a>’</span> property may also be
1790 included but only those supported in CSS 2.1, none of the font-variant
1791 values added in this specification can be used in the <span
1792 class=property>‘<a href="#propdef-font"><code
1793 class=property>font</code></a>’</span> shorthand:
1795 <pre
1796 class=prod><dfn id=ltfont-variant-css21gt><var><font-variant-css21></var></dfn> = [normal | small-caps]</pre>
1798 <p>The syntax of this property is based on a traditional typographical
1799 shorthand notation to set multiple properties related to fonts.
1801 <p>All font-related properties are first reset to their initial values,
1802 including those listed in the preceding paragraph plus <span
1803 class=property>‘<a href="#propdef-font-size-adjust"><code
1804 class=property>font-size-adjust</code></a>’</span>, <span
1805 class=property>‘<a href="#propdef-font-kerning"><code
1806 class=property>font-kerning</code></a>’</span> and all font feature
1807 properties. Then, those properties that are given explicit values in the
1808 <span class=property>‘<a href="#propdef-font"><code
1809 class=property>font</code></a>’</span> shorthand are set to those
1810 values. For a definition of allowed and initial values, see the previously
1811 defined properties. For reasons of backwards compatibility, it is not
1812 possible to set <span class=property>‘<a
1813 href="#propdef-font-size-adjust"><code
1814 class=property>font-size-adjust</code></a>’</span> to anything other
1815 than its initial value using the <span class=property>‘<a
1816 href="#propdef-font"><code class=property>font</code></a>’</span>
1817 shorthand property; instead, use the individual property.
1819 <div class=example>
1820 <p style="display:none">Example(s):
1822 <p>
1824 <pre>p { font: 12pt/14pt sans-serif }
1825 p { font: 80% sans-serif }
1826 p { font: x-large/110% "new century schoolbook", serif }
1827 p { font: bold italic large Palatino, serif }
1828 p { font: normal small-caps 120%/120% fantasy }
1829 p { font: condensed oblique 12pt "Helvetica Neue", serif; }
1830 </pre>
1832 <p> In the second rule, the font size percentage value (‘<code
1833 class=css>80%</code>’) refers to the computed ‘<a
1834 href="#propdef-font-size"><code class=property>font-size</code></a>’ of
1835 the parent element. In the third rule, the line height percentage
1836 (‘<code class=css>110%</code>’) refers to the font size of the
1837 element itself.
1839 <p>The first three rules do not specify the <span class=property>‘<a
1840 href="#propdef-font-variant"><code
1841 class=property>font-variant</code></a>’</span> and <span
1842 class=property>‘<a href="#propdef-font-weight"><code
1843 class=property>font-weight</code></a>’</span> explicitly, so these
1844 properties receive their initial values (‘<a href="#normal2"><code
1845 class=property>normal</code></a>’). Notice that the font family name
1846 "new century schoolbook", which contains spaces, is enclosed in quotes.
1847 The fourth rule sets the <span class=property>‘<a
1848 href="#propdef-font-weight"><code
1849 class=property>font-weight</code></a>’</span> to ‘<code
1850 class=property>bold</code>’, the <span class=property>‘<a
1851 href="#propdef-font-style"><code
1852 class=property>font-style</code></a>’</span> to ‘<code
1853 class=property>italic</code>’, and implicitly sets <span
1854 class=property>‘<a href="#propdef-font-variant"><code
1855 class=property>font-variant</code></a>’</span> to ‘<a
1856 href="#normal2"><code class=property>normal</code></a>’.
1858 <p> The fifth rule sets the <span class=property>‘<a
1859 href="#propdef-font-variant"><code
1860 class=property>font-variant</code></a>’</span> (‘<a
1861 href="#small-caps"><code class=property>small-caps</code></a>’), the
1862 <span class=property>‘<a href="#propdef-font-size"><code
1863 class=property>font-size</code></a>’</span> (120% of the parent's font
1864 size), the <span class=property>‘<code
1865 class=property>line-height</code>’</span> (120% of the font size) and
1866 the <span class=property>‘<a href="#descdef-font-family"><code
1867 class=property>font-family</code></a>’</span> (‘<a
1868 href="#fantasy"><code class=property>fantasy</code></a>’). It follows
1869 that the keyword ‘<a href="#normal2"><code
1870 class=property>normal</code></a>’ applies to the two remaining
1871 properties: <span class=property>‘<a href="#propdef-font-style"><code
1872 class=property>font-style</code></a>’</span> and <span
1873 class=property>‘<a href="#propdef-font-weight"><code
1874 class=property>font-weight</code></a>’</span>.
1876 <p>The sixth rule sets the <span class=property>‘<a
1877 href="#propdef-font-style"><code
1878 class=property>font-style</code></a>’</span>, <span
1879 class=property>‘<a href="#propdef-font-stretch"><code
1880 class=property>font-stretch</code></a>’</span>, <span
1881 class=property>‘<a href="#propdef-font-size"><code
1882 class=property>font-size</code></a>’</span>, and <span
1883 class=property>‘<a href="#descdef-font-family"><code
1884 class=property>font-family</code></a>’</span>, the other font
1885 properties being set to their initial values.
1886 </div>
1888 <p>Since the ‘<a href="#propdef-font-stretch"><code
1889 class=property>font-stretch</code></a>’ property was not defined in CSS
1890 2.1, when using ‘<a href="#propdef-font-stretch"><code
1891 class=property>font-stretch</code></a>’ values within ‘<a
1892 href="#propdef-font"><code class=property>font</code></a>’ rules,
1893 authors should include a extra version compatible with older user agents:
1895 <pre>p {
1896 font: 80% sans-serif; /* for older user agents */
1897 font: condensed 80% sans-serif;
1898 }</pre>
1900 <p>The following values refer to system fonts:
1902 <dl>
1903 <dt><strong>caption</strong>
1905 <dd>The font used for captioned controls (e.g., buttons, drop-downs,
1906 etc.).
1908 <dt><strong>icon</strong>
1910 <dd>The font used to label icons.
1912 <dt><strong>menu</strong>
1914 <dd>The font used in menus (e.g., dropdown menus and menu lists).
1916 <dt><strong>message-box</strong>
1918 <dd>The font used in dialog boxes.
1920 <dt><strong>small-caption</strong>
1922 <dd>The font used for labeling small controls.
1924 <dt><strong>status-bar</strong>
1926 <dd>The font used in window status bars.
1927 </dl>
1929 <p>System fonts may only be set as a whole; that is, the font family, size,
1930 weight, style, etc. are all set at the same time. These values may then be
1931 altered individually if desired. If no font with the indicated
1932 characteristics exists on a given platform, the user agent should either
1933 intelligently substitute (e.g., a smaller version of the ‘<code
1934 class=property>caption</code>’ font might be used for the ‘<code
1935 class=property>small-caption</code>’ font), or substitute a user agent
1936 default font. As for regular fonts, if, for a system font, any of the
1937 individual properties are not part of the operating system's available
1938 user preferences, those properties should be set to their initial values.
1940 <p>That is why this property is "almost" a shorthand property: system fonts
1941 can only be specified with this property, not with <span
1942 class=property>‘<a href="#descdef-font-family"><code
1943 class=property>font-family</code></a>’</span> itself, so <span
1944 class=property>‘<a href="#propdef-font"><code
1945 class=property>font</code></a>’</span> allows authors to do more than
1946 the sum of its subproperties. However, the individual properties such as
1947 <span class=property>‘<a href="#propdef-font-weight"><code
1948 class=property>font-weight</code></a>’</span> are still given values
1949 taken from the system font, which can be independently varied.
1951 <p>Note that the keywords used for the system fonts listed above are only
1952 treated as keywords when they occur in the initial position, in other
1953 positions the same string is treated as part of the font family name:
1955 <pre> font: menu; /* use the font settings for system menus */
1956 font: large menu; /* use a font family named "menu" */</pre>
1958 <div class=example>
1959 <p style="display:none">Example(s):
1961 <p>
1963 <pre>button { font: 300 italic 1.3em/1.7em "FB Armada", sans-serif }
1964 button p { font: menu }
1965 button p em { font-weight: bolder }
1966 </pre>
1968 <p>If the font used for dropdown menus on a particular system happened to
1969 be, for example, 9-point Charcoal, with a weight of 600, then P elements
1970 that were descendants of BUTTON would be displayed as if this rule were
1971 in effect:
1973 <pre>button p { font: 600 9pt Charcoal }
1974 </pre>
1976 <p>Because the <span class=property>‘<a href="#propdef-font"><code
1977 class=property>font</code></a>’</span> shorthand resets to its initial
1978 value any property not explicitly given a value, this has the same effect
1979 as this declaration:
1981 <pre>button p {
1982 font-style: normal;
1983 font-variant: normal;
1984 font-weight: 600;
1985 font-size: 9pt;
1986 line-height: normal;
1987 font-family: Charcoal
1988 }
1989 </pre>
1990 </div>
1991 <!-- prop: font-synthesis -->
1993 <h3 id=font-synthesis-prop><span class=secno>3.8 </span>Controlling
1994 synthetic faces: the <a href="#propdef-font-synthesis">font-synthesis</a>
1995 property</h3>
1997 <table class=propdef id=namefont-synthesisvaluenone-weight-style>
1998 <tbody>
1999 <tr>
2000 <td>Name:
2002 <td><dfn id=propdef-font-synthesis>font-synthesis</dfn>
2004 <tr>
2005 <td>Value:
2007 <td>none | [ weight || style ]
2009 <tr>
2010 <td>Initial:
2012 <td>weight style
2014 <tr>
2015 <td>Applies to:
2017 <td>all elements
2019 <tr>
2020 <td>Inherited:
2022 <td>yes
2024 <tr>
2025 <td>Percentages:
2027 <td>N/A
2029 <tr>
2030 <td>Media:
2032 <td>visual
2034 <tr>
2035 <td>Computed value:
2037 <td>as specified
2039 <tr>
2040 <td>Animatable:
2042 <td>no
2043 </table>
2045 <p>This property controls whether user agents are allowed to synthesize
2046 bold or oblique font faces when a font family lacks bold or italic faces.
2047 If ‘<a href="#weight"><code class=property>weight</code></a>’ is not
2048 specified, user agents must not synthesize bold faces and if ‘<code
2049 class=property>style</code>’ is not specified user agents must not
2050 synthesize italic faces. A value of ‘<code class=property>none</code>’
2051 disallows all synthetic faces.
2053 <div class=example>
2054 <p>The style rule below disables the use of synthetically obliqued Arabic:</p>
2056 <pre>*:lang(ar) { font-synthesis: none; }
2057 </pre>
2058 </div>
2060 <h2 id=font-resources><span class=secno>4 </span>Font Resources</h2>
2062 <h3 id=font-face-rule><span class=secno>4.1 </span>The
2063 <code>@font-face</code> rule</h3>
2065 <p>The <code>@font-face</code> rule allows for linking to fonts that are
2066 automatically activated when needed. This allows authors to select a font
2067 that closely matches the design goals for a given page rather than
2068 limiting the font choice to a set of fonts available on all platforms. A
2069 set of font descriptors define the location of a font resource, either
2070 locally or externally, along with the style characteristics of an
2071 individual face. Multiple <code>@font-face</code> rules can be used to
2072 construct font families with a variety of faces. Using CSS font matching
2073 rules, a user agent can selectively download only those faces that are
2074 needed for a given piece of text.
2076 <p>In terms of the grammar, this specification defines the following
2077 productions:
2079 <pre><dfn id=fontfacerule>font_face_rule</dfn>
2080 : FONT_FACE_SYM S* '{' S* descriptor_declaration? [ ';' S* descriptor_declaration? ]* '}' S*
2081 ;
2083 <dfn id=descriptordeclaration>descriptor_declaration</dfn>
2084 : property ':' S* expr
2085 ;</pre>
2087 <p>The following new definitions are introduced:
2089 <pre>- -|\\0{0,4}2d(\r\n|[ \t\r\n\f])?
2090 F f|\\0{0,4}(46|66)(\r\n|[ \t\r\n\f])?</pre>
2092 <p>The following new token is introduced:
2094 <pre>@{F}{O}{N}{T}{-}{F}{A}{C}{E} {return FONT_FACE_SYM;}</pre>
2096 <p>Each <span class=index-inst id=font-face
2097 title="@font-face"><code>@font-face</code></span> rule specifies a value
2098 for every font descriptor, either implicitly or explicitly. Those not
2099 given explicit values in the rule take the initial value listed with each
2100 descriptor in this specification. These descriptors apply solely within
2101 the context of the <code>@font-face</code> rule in which they are defined,
2102 and do not apply to document language elements. There is no notion of
2103 which elements the descriptors apply to or whether the values are
2104 inherited by child elements. When a given descriptor occurs multiple times
2105 in a given <code>@font-face</code> rule, only the last specified value is
2106 used, all prior values for that descriptor are ignored.
2108 <div class=example>
2109 <p>To use a downloadable font called Gentium:</p>
2111 <pre>
2112 @font-face {
2113 font-family: Gentium;
2114 src: url(http://example.com/fonts/Gentium.ttf);
2115 }
2117 p { font-family: Gentium, serif; }
2118 </pre>
2120 <p>The user agent will download Gentium and use it when rendering text
2121 within paragraph elements. If for some reason the site serving the font
2122 is unavailable, the default serif font will be used.</p>
2123 </div>
2125 <p>A given set of <code>@font-face</code> rules define a set of fonts
2126 available to containing documents. Multiple rules can be used to define a
2127 family with a large set of faces. When font matching is done fonts defined
2128 using these rules are considered before other available fonts on a system.
2131 <p>Downloaded fonts are only available to documents that reference them,
2132 the process of activating these fonts should not make them available to
2133 other applications or to documents that don't directly link to the same
2134 font. User agent implementers might consider it convenient to use
2135 downloaded fonts when rendering characters in other documents for which no
2136 other available font exists as part of the system font fallback procedure.
2137 This would cause a security leak since the contents of one page would be
2138 able to affect other pages, something an attacker could use as an attack
2139 vector. These restrictions do not affect caching behavior, fonts are
2140 cached the same way other web resources are cached.
2142 <p>User agents which do not understand the <code>@font-face</code> rule
2143 encounter the opening curly bracket and ignore forward until the closing
2144 curly bracket. This at-rule conforms with the forward-compatible parsing
2145 requirement of CSS, parsers may ignore these rules without error. Any
2146 descriptors that are not recognized or implemented by a given user agent
2147 must be ignored. <code>@font-face</code> rules require a font-family and
2148 src descriptor, if either of these are missing the <code>@font-face</code>
2149 must be ignored.
2151 <p>In cases where user agents have limited platform resources or implement
2152 the ability to disable downloadable font resources,
2153 <code>@font-face</code> rules must simply be ignored; the behavior of
2154 individual descriptors as defined in this specification should not be
2155 altered.
2157 <h3 id=font-family-desc><span class=secno>4.2 </span>Font family: the <a
2158 href="#descdef-font-family">font-family</a> descriptor</h3>
2160 <table class=descdef>
2161 <tbody>
2162 <tr>
2163 <td>Name:
2165 <td><dfn id=descdef-font-family>font-family</dfn>
2167 <tr>
2168 <td>Value:
2170 <td><family-name>
2172 <tr>
2173 <td><em>Initial:</em>
2175 <td>N/A
2176 </table>
2178 <p>This descriptor defines the font family name that will be used in all
2179 CSS font family name matching, overriding font family names contained in
2180 the underlying font data. If the font family name is the same as a font
2181 family available in a given user's environment, it effectively hides the
2182 underlying font for documents that use the stylesheet. This permits a web
2183 author to freely choose font-family names without worrying about conflicts
2184 with font family names present in a given user's environment. Errors
2185 loading font data do not affect font name matching behavior. User agents
2186 that apply platform font aliasing rules to font family names defined via
2187 <code>@font-face</code> rules are considered non-conformant.
2189 <h3 id=src-desc><span class=secno>4.3 </span>Font reference: the <a
2190 href="#descdef-src">src</a> descriptor</h3>
2192 <table class=descdef>
2193 <tbody>
2194 <tr>
2195 <td>Name:
2197 <td><dfn id=descdef-src>src</dfn>
2199 <tr>
2200 <td>Value:
2202 <td>[ <uri> [format(<string>#)]? | <font-face-name> ]#
2204 <tr>
2205 <td><em>Initial:</em>
2207 <td>N/A
2208 </table>
2210 <p>This descriptor specifies the resource containing font data. It is
2211 required, whether the font is downloadable or locally installed. Its value
2212 is a prioritized, comma-separated list of external references or locally
2213 installed font face names. When a font is needed the user agent iterates
2214 over the set of references listed, using the first one it can successfully
2215 activate. Fonts containing invalid data or local font faces that are not
2216 found are ignored and the user agent loads the next font in the list
2217 (platform substitutions for a given font must not be used).
2219 <p>As with other URIs in CSS, the URI 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 URI, followed by an optional hint
2240 describing the format of the font resource referenced by that URI. 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, local() can be used. The locally
2317 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> is a
2320 format-specific string that uniquely identifies a single font face within
2321 a larger family. The syntax for a <font-face-name> is a unique font
2322 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.
2339 <pre>
2340 /* bold face of Gentium */
2341 @font-face {
2342 font-family: MyGentium;
2343 src: local(Gentium Bold), /* full font name */
2344 local(Gentium-Bold), /* Postscript name */
2345 url(GentiumBold.ttf); /* otherwise, download it */
2346 font-weight: bold;
2347 }
2348 </pre>
2350 <p>Just as a <code>@font-face</code> rule specifies the characteristics of
2351 a single font within a family, the unique name used with local() specifies
2352 a single font, not an entire font family. Defined in terms of OpenType
2353 font data, the Postscript name is found in the font's <a
2354 href="http://www.microsoft.com/typography/otspec/name.htm">name table</a>,
2355 in the name record with nameID = 6 (see <a href="#OPENTYPE"
2356 rel=biblioentry>[OPENTYPE]<!--{{!OPENTYPE}}--></a> for more details). The
2357 Postscript name is the commonly used key for all fonts on OSX and for
2358 Postscript CFF fonts under Windows. The full font name (nameID = 4) is
2359 used as a unique key for fonts with TrueType glyphs on Windows.
2361 <p>For OpenType fonts with multiple localizations of the full font name,
2362 the US English version is used (language ID = 0x409 for Windows and
2363 language ID = 0 for Macintosh) or the first localization when a US English
2364 full font name is not available (the OpenType specification recommends
2365 that <a href="http://www.microsoft.com/typography/otspec/recom.htm">all
2366 fonts minimally include US English names</a>). User agents that also match
2367 other full font names, e.g. matching the Dutch name when the current
2368 system locale is set to Dutch, are considered non-conformant. This is done
2369 not to prefer English but to avoid matching inconsistencies across font
2370 versions and OS localizations, since font style names (e.g. "Bold") are
2371 frequently localized into many languages and the set of localizations
2372 available varies widely across platform and font version. User agents that
2373 match a concatenation of family name (nameID = 1) with style name (nameID
2374 = 2) are considered non-conformant.
2376 <p>This also allows for referencing faces that belong to larger families
2377 that cannot otherwise be referenced.
2379 <div class=example>
2380 <p>Use a local font or reference an SVG font in another document:</p>
2382 <pre>
2383 @font-face {
2384 font-family: Headline;
2385 src: local(Futura-Medium),
2386 url(fonts.svg#MyGeometricModern) format("svg");
2387 }
2388 </pre>
2390 <p>Create an alias for local Japanese fonts on different platforms:</p>
2392 <pre>
2393 @font-face {
2394 font-family: jpgothic;
2395 src: local(HiraKakuPro-W3), local(Meiryo), local(IPAPGothic);
2396 }
2397 </pre>
2399 <p>Reference a font face that cannot be matched within a larger family:</p>
2401 <pre>
2402 @font-face {
2403 font-family: Hoefler Text Ornaments;
2404 /* has the same font properties as Hoefler Text Regular */
2405 src: local(HoeflerText-Ornaments);
2406 }
2407 </pre>
2409 <p>Since localized fullnames should never match, a document with the
2410 header style rules below would always render using the default serif
2411 font, regardless whether a particular system locale parameter is set to
2412 Finnish or not:</p>
2414 <pre>
2415 @font-face {
2416 font-family: SectionHeader;
2417 src: local("Arial Lihavoitu"); /* Finnish fullname for Arial Bold, should fail */
2418 font-weight: bold;
2419 }
2421 h2 { font-family: SectionHeader, serif; }
2422 </pre>
2424 <p>A conformant user agent should never load the font ‘<code
2425 class=css>gentium.eot</code>’ in the example below, since it is
2426 included in the first definition of the ‘<a href="#descdef-src"><code
2427 class=property>src</code></a>’ descriptor which is overridden by the
2428 second definition in the same <code>@font-face</code> rule:</p>
2430 <pre>
2431 @font-face {
2432 font-family: MainText;
2433 src: url(gentium.eot); /* for use with older non-conformant user agents */
2434 src: local("Gentium"), url(gentium.ttf); /* Overrides src definition */
2435 }
2436 </pre>
2437 </div>
2439 <h3 id=font-prop-desc><span class=secno>4.4 </span>Font property
2440 descriptors: the <a href="#descdef-font-style">font-style</a>, <a
2441 href="#descdef-font-weight">font-weight</a>, <a
2442 href="#descdef-font-stretch">font-stretch</a> descriptors</h3>
2444 <table class=descdef>
2445 <tbody>
2446 <tr>
2447 <td>Name:
2449 <td><dfn id=descdef-font-style title="font-style
2450 (descriptor)">font-style</dfn>
2452 <tr>
2453 <td>Value:
2455 <td>normal | italic | oblique
2457 <tr>
2458 <td><em>Initial:</em>
2460 <td>normal
2461 </table>
2463 <table class=descdef>
2464 <tbody>
2465 <tr>
2466 <td>Name:
2468 <td><dfn id=descdef-font-weight title="font-weight
2469 (descriptor)">font-weight</dfn>
2471 <tr>
2472 <td>Value:
2474 <td>normal | bold | 100 | 200 | 300 | 400 | 500 | 600 | 700 | 800 | 900
2476 <tr>
2477 <td><em>Initial:</em>
2479 <td>normal
2480 </table>
2482 <table class=descdef>
2483 <tbody>
2484 <tr>
2485 <td>Name:
2487 <td><dfn id=descdef-font-stretch title="font-stretch
2488 (descriptor)">font-stretch</dfn>
2490 <tr>
2491 <td>Value:
2493 <td>normal | ultra-condensed | extra-condensed | condensed |
2494 semi-condensed | semi-expanded | expanded | extra-expanded |
2495 ultra-expanded
2497 <tr>
2498 <td><em>Initial:</em>
2500 <td>normal
2501 </table>
2503 <p>These descriptors define the characteristics of a font face and are used
2504 in the process of matching styles to specific faces. For a font family
2505 defined with several <code>@font-face</code> rules, user agents can either
2506 download all faces in the family or use these descriptors to selectively
2507 download font faces that match actual styles used in document. The values
2508 for these descriptors are the same as those for the corresponding font
2509 properties except that relative keywords are not allowed, ‘<code
2510 class=property>bolder</code>’ and ‘<code
2511 class=property>lighter</code>’. If these descriptors are omitted,
2512 default values are assumed.
2514 <p>The value for these font face style attributes is used in place of the
2515 style implied by the underlying font data. This allows authors to combine
2516 faces in flexible combinations, even in situations where the original font
2517 data was arranged differently. User agents that implement synthetic
2518 bolding and obliqueing must only apply synthetic styling in cases where
2519 the font descriptors imply this is needed, rather than based on the style
2520 attributes implied by the font data.
2522 <h3 id=unicode-range-desc><span class=secno>4.5 </span>Character range: the
2523 <a href="#descdef-unicode-range">unicode-range</a> descriptor</h3>
2525 <table class=descdef>
2526 <tbody>
2527 <tr>
2528 <td>Name:
2530 <td><dfn id=descdef-unicode-range>unicode-range</dfn>
2532 <tr>
2533 <td>Value:
2535 <td><urange>#
2537 <tr>
2538 <td><em>Initial:</em>
2540 <td>U+0-10FFFF
2541 </table>
2543 <p>This descriptor defines the range of Unicode characters supported by a
2544 given font. The values of <span class=index-def id=lturangegt
2545 title="<urange>"><a name=value-def-urange><urange></a></span>
2546 are expressed using hexadecimal numbers prefixed by "U+" or "u+",
2547 corresponding to <a href="http://www.unicode.org/charts/">Unicode
2548 character code points</a>. The unicode-range descriptor serves as a hint
2549 for user agents when deciding whether or not to download a font resource.
2551 <p>Unicode range values are written using hexadecimal values and are ASCII
2552 case-insensitive. Each is prefixed by "U+" or "u+" and multiple,
2553 discontinuous ranges are separated by commas. Whitespace before or after
2554 commas is ignored. Valid character code values vary between 0 and 10FFFF
2555 inclusive. A single range has three basic forms:
2557 <ul>
2558 <li>a single code point (e.g. U+416)
2560 <li>an interval value range (e.g. U+400-4ff)
2562 <li>a range where trailing ‘<code class=css>?</code>’ characters imply
2563 ‘<code class=css>any digit value</code>’ (e.g. U+4??)
2564 </ul>
2566 <p>Ranges that do not fit any of the above three forms are considered to be
2567 parse errors and the descriptor is omitted. Interval ranges consisting of
2568 a single code point are valid. Ranges specified with ‘?’ that lack an
2569 initial digit (e.g. "U+???") are also valid, and are treated as if there
2570 was a single 0 before the question marks (thus, "U+???" = "U+0???" =
2571 "U+0000-0FFF"). "U+??????" is not a syntax error, even though "U+0??????"
2572 would be. Ranges can overlap but interval ranges that descend (e.g.
2573 U+400-32f) are invalid and omitted rather than treated as parse errors;
2574 they have no effect on other ranges in a list of ranges. Ranges are
2575 clipped to the domain of Unicode code points (currently 0 – 10FFFF
2576 inclusive); a range entirely outside the domain is omitted. Without any
2577 valid ranges, the descriptor is omitted. User agents may normalize the
2578 list of ranges into a list that is different but represents the same set
2579 of character code points.
2581 <p>The character range can be a subset of the full <a
2582 href="#character-map"><em>character map</em></a> of the underlying font.
2583 The effective unicode-range used when mapping characters to fonts is the
2584 intersection of the unicode range specified and the underlying <a
2585 href="#character-map"><em>character map</em></a> of the font. This means
2586 that authors do not need to define the unicode-range of a font precisely,
2587 broad ranges for which a sparse set of code points are defined in the font
2588 can be used. Code points outside of the defined unicode-range are ignored,
2589 regardless of whether the font contains a glyph for that code point or
2590 not. User agents that download fonts for characters outside the defined
2591 unicode-range are considered non-conformant. Likewise, user agents that
2592 render a character using a font resource for which the defined
2593 unicode-range does not include that character are also considered
2594 non-conformant.
2596 <p>Example ranges for specific languages or characters:
2598 <dl>
2599 <dt>unicode-range: U+A5;
2601 <dd>a single code point, the yen/yuan symbol
2603 <dt>unicode-range: U+0-7F;
2605 <dd>code range for basic ASCII characters
2607 <dt>unicode-range: U+590-5ff;
2609 <dd>code range for Hebrew characters
2611 <dt>unicode-range: U+A5, U+4E00-9FFF, U+30??, U+FF00-FF9F;
2613 <dd>code range for Japanese kanji, hiragana and katakana characters plus
2614 yen/yuan symbol
2615 </dl>
2617 <div class=example>
2618 <p>The BBC provides news services in a wide variety of languages, many
2619 that are not well supported across all platforms. Using an
2620 <code>@font-face</code> rule, the BBC could provide a font for any of
2621 these languages, as it already does via a manual font download.</p>
2623 <pre>
2624 @font-face {
2625 font-family: BBCBengali;
2626 src: url(fonts/BBCBengali.ttf) format("opentype");
2627 unicode-range: U+00-FF, U+980-9FF;
2628 }
2629 </pre>
2630 </div>
2632 <div class=example>
2633 <p>Technical documents often require a wide range of symbols. The STIX
2634 Fonts project is one project aimed at providing fonts to support a wide
2635 range of technical typesetting in a standardized way. The example below
2636 shows the use of a font that provides glyphs for many of the mathematical
2637 and technical symbol ranges within Unicode:</p>
2639 <pre>
2640 @font-face {
2641 font-family: STIXGeneral;
2642 src: local(STIXGeneral), url(/stixfonts/STIXGeneral.otf);
2643 unicode-range: U+000-49F, U+2000-27FF, U+2900-2BFF, U+1D400-1D7FF;
2644 }
2645 </pre>
2646 </div>
2648 <p>Multiple <code>@font-face</code> rules with different unicode ranges for
2649 the same family and style descriptor values can be used to create
2650 composite fonts that mix the glyphs from different fonts for different
2651 scripts. This can be used to combine fonts that only contain glyphs for a
2652 single script (e.g. Latin, Greek, Cyrillic) or it can be used by authors
2653 as a way of segmenting a font into fonts for commonly used characters and
2654 less frequently used characters. Since the user agent will only pull down
2655 the fonts it needs this helps reduce page bandwidth.
2657 <p>If the unicode ranges overlap for a set of <code>@font-face</code> rules
2658 with the same family and style descriptor values, the rules are ordered in
2659 the reverse order they were defined; the last rule defined is the first to
2660 be checked for a given character.
2662 <div class=example>
2663 <p>This example shows how an author can override the glyphs used for Latin
2664 characters in a Japanese font with glyphs from a different font. The
2665 first rule specifies no range so it defaults to the entire range. The
2666 range specified in the second rule overlaps but takes precedence because
2667 it is defined later.</p>
2669 <pre>
2670 @font-face {
2671 font-family: JapaneseWithGentium;
2672 src: local(MSMincho);
2673 /* no range specified, defaults to entire range */
2674 }
2676 @font-face {
2677 font-family: JapaneseWithGentium;
2678 src: url(../fonts/Gentium.ttf);
2679 unicode-range: U+0-2FF;
2680 }
2681 </pre>
2682 </div>
2684 <div class=example>
2685 <p>Consider a family constructed to optimize bandwidth by separating out
2686 Latin, Japanese and other characters into different font files:</p>
2688 <pre>
2689 /* fallback font - size: 4.5MB */
2690 @font-face {
2691 font-family: DroidSans;
2692 src: url(DroidSansFallback.ttf);
2693 /* no range specified, defaults to entire range */
2694 }
2696 /* Japanese glyphs - size: 1.2MB */
2697 @font-face {
2698 font-family: DroidSans;
2699 src: url(DroidSansJapanese.ttf);
2700 unicode-range: U+3000-9FFF, U+ff??;
2701 }
2703 /* Latin, Greek, Cyrillic along with some
2704 punctuation and symbols - size: 190KB */
2705 @font-face {
2706 font-family: DroidSans;
2707 src: url(DroidSans.ttf);
2708 unicode-range: U+000-5FF, U+1e00-1fff, U+2000-2300;
2709 }
2710 </pre>
2712 <p>For simple Latin text, only the font for Latin characters is
2713 downloaded:</p>
2715 <pre>
2716 body { font-family: DroidSans; }
2718 <p>This is that</p>
2719 </pre>
2721 <p>In this case the user agent first checks the unicode-range for the font
2722 containing Latin characters (DroidSans.ttf). Since all the characters
2723 above are in the range U+0-5FF, the user agent downloads the font and
2724 renders the text with that font.</p>
2726 <p>Next, consider text that makes use of an arrow character (⇨):</p>
2728 <pre>
2729 <p>This &#x21e8; that<p>
2730 </pre>
2732 <p>The user agent again first checks the unicode-range of the font
2733 containing Latin characters. Since U+2000-2300 includes the arrow code
2734 point (U+21E8), the user agent downloads the font. For this character
2735 however the Latin font does not have a matching glyph, so the effective
2736 unicode-range used for font matching excludes this code point. Next, the
2737 user agent evaluates the Japanese font. The unicode-range for the
2738 Japanese font, U+3000-9FFF and U+ff??, does not include U+21E8, so the
2739 user agent does not download the Japanese font. Next the fallback font is
2740 considered. The <code>@font-face</code> rule for the fallback font does
2741 not define unicode-range so its value defaults to the range of all
2742 Unicode code points. The fallback font is downloaded and used to render
2743 the arrow character.</p>
2744 </div>
2746 <h3 id=font-rend-desc><span class=secno>4.6 </span>Font features: the <a
2747 href="#descdef-font-variant">font-variant</a> and <a
2748 href="#descdef-font-feature-settings">font-feature-settings</a>
2749 descriptors</h3>
2751 <table class=descdef>
2752 <tbody>
2753 <tr>
2754 <td>Name:
2756 <td><dfn id=descdef-font-variant title="font-variant
2757 (descriptor)">font-variant</dfn>
2759 <tr>
2760 <td>Value:
2762 <td>normal | [ <common-lig-values> ||
2763 <discretionary-lig-values> || <historical-lig-values> ||
2764 <contextual-alt-values> || stylistic(<feature-value-name>)
2765 || historical-forms || styleset(<feature-value-name>#) ||
2766 character-variant(<feature-value-name>#) ||
2767 swash(<feature-value-name>) ||
2768 ornaments(<feature-value-name>) ||
2769 annotation(<feature-value-name>) || [ small-caps | all-small-caps
2770 | petite-caps | all-petite-caps | unicase | titling-caps ] ||
2771 <numeric-figure-values> || <numeric-spacing-values> ||
2772 <numeric-fraction-values> || ordinal || slashed-zero ||
2773 <east-asian-variant-values> || <east-asian-width-values> ||
2774 ruby ]
2776 <tr>
2777 <td><em>Initial:</em>
2779 <td>normal
2780 </table>
2782 <table class=descdef>
2783 <tbody>
2784 <tr>
2785 <td>Name:
2787 <td><dfn id=descdef-font-feature-settings title="font-feature-settings
2788 (descriptor)">font-feature-settings</dfn>
2790 <tr>
2791 <td>Value:
2793 <td>normal | <feature-tag-value>#
2795 <tr>
2796 <td><em>Initial:</em>
2798 <td>normal
2799 </table>
2801 <p>These descriptors define settings that apply when the font defined by an
2802 <code>@font-face</code> rule is rendered. They do not affect font
2803 selection. Values are identical to those defined for the corresponding
2804 ‘<a href="#propdef-font-variant"><code
2805 class=property>font-variant</code></a>’ and ‘<a
2806 href="#propdef-font-feature-settings"><code
2807 class=property>font-feature-settings</code></a>’ properties defined
2808 below except that the value ‘<code class=property>inherit</code>’ is
2809 omitted. When multiple font feature descriptors or properties are used,
2810 the cumulative effect on text rendering is detailed in the section <a
2811 href="#font-feature-resolution">Font Feature Resolution</a> below. In
2812 cases where specific values define synthesized fallback for certain ‘<a
2813 href="#propdef-font-variant"><code
2814 class=property>font-variant</code></a>’ subproperties, the same
2815 synthesized fallback applies when used within those values are used with
2816 the <a href="#descdef-font-variant">‘<code
2817 class=property>font-variant</code>’</a> descriptor.
2819 <h3 id=font-face-loading><span class=secno>4.7 </span>Font loading
2820 guidelines</h3>
2822 <p>The <code>@font-face</code> rule is designed to allow lazy loading of
2823 fonts, fonts are only downloaded when needed for use within a document. A
2824 stylesheet can include <code>@font-face</code> rules for a library of
2825 fonts of which only a select set are used; user agents must only download
2826 those fonts that are referred to within the style rules applicable to a
2827 given page. User agents that download all fonts defined in
2828 <code>@font-face</code> rules without considering whether those fonts are
2829 in fact used within a page are considered non-conformant. In cases where a
2830 font might be downloaded in character fallback cases, user agents may
2831 download a font if it's listed in a font list but is not actually used for
2832 a given text run.
2834 <pre>
2835 @font-face {
2836 font-family: GeometricModern;
2837 src: url(font.ttf);
2838 }
2840 p {
2841 /* font will be downloaded for pages with p elements */
2842 font-family: GeometricModern, sans-serif;
2843 }
2845 h2 {
2846 /* font may be downloaded for pages with h2 elements, even if Futura is available locally */
2847 font-family: Futura, GeometricModern, sans-serif;
2848 }
2849 </pre>
2851 <p>In cases where textual content is loaded before downloadable fonts are
2852 available, user agents may render text as it would be rendered if
2853 downloadable font resources are not available or they may render text
2854 transparently with fallback fonts to avoid a flash of text using a
2855 fallback font. In cases where the font download fails user agents must
2856 display text, simply leaving transparent text is considered non-conformant
2857 behavior. Authors are advised to use fallback fonts in their font lists
2858 that closely match the vertical metrics of the downloadable fonts to avoid
2859 large page reflows where possible.
2861 <h3 id=same-origin-restriction><span class=secno>4.8 </span>Same-origin
2862 restriction for fonts</h3>
2864 <h4 id=default-same-origin-restriction><span class=secno>4.8.1
2865 </span>Default same-origin restriction</h4>
2866 <!-- TPAC 2011 Resolution to require same-origin restriction for loading fonts:
2867 http://lists.w3.org/Archives/Public/www-style/2011Nov/0711.html
2868 http://www.w3.org/2011/10/31-webapps-minutes.html#item02
2869 -->
2871 <p>User agents must implement a same-origin restriction when loading fonts
2872 via the <code>@font-face</code> mechanism. This restriction limits the
2873 loading of fonts for a given document to fonts loaded from the same
2874 origin. Fonts can only be loaded via the same host, port, and method
2875 combination as the containing document, using the <a
2876 href="http://www.w3.org/TR/html5/browsers.html#origin">origin matching
2877 algorithm</a> described in the <a href="#HTML5"
2878 rel=biblioentry>[HTML5]<!--{{!HTML5}}--></a> specification. The origin of
2879 the stylesheet containing <code>@font-face</code> rules is not used when
2880 deciding whether a font is same origin or not, only the origin of the
2881 containing document is used. The restriction applies to all font types.
2883 <p>Given a document located at http://example.com/page.html, fonts defined
2884 with ‘<a href="#descdef-src"><code class=property>src</code></a>’
2885 definitions considered cross origin must not be loaded:
2887 <pre>
2888 /* same origin (i.e. domain, protocol, port match document) */
2889 src: url(fonts/simple.ttf);
2890 src: url(//fonts/simple.ttf);
2892 /* cross origin, different protocol */
2893 src: url(https://example.com/fonts/simple.ttf);
2895 /* cross origin, different domain */
2896 src: url(http://another.example.com/fonts/simple.ttf);
2897 </pre>
2899 <h4 id=allowing-cross-origin-font-loading><span class=secno>4.8.2
2900 </span>Allowing cross-origin font loading</h4>
2902 <p>User agents must also implement the ability to relax this restriction
2903 using cross-site origin controls <a href="#CORS"
2904 rel=biblioentry>[CORS]<!--{{!CORS}}--></a> for fonts loaded via HTTP.
2905 Sites can explicitly allow cross-site downloading of font data using the
2906 <code>Access-Control-Allow-Origin</code> HTTP header. For other protocols,
2907 no explicit relaxation mechanism is defined or required.
2909 <p>For font loads over HTTP, cross-origin requests must be made with the
2910 following parameter settings which are used in conjunction with the <a
2911 href="http://www.w3.org/TR/cors/#cross-origin-request-0"> <em>cross-origin
2912 request algorithm</em></a> <a href="#CORS"
2913 rel=biblioentry>[CORS]<!--{{!CORS}}--></a>:
2915 <ul>
2916 <li><em>request URL</em> — the URL of the font resource in the <a
2917 href="#descdef-src"><code>src</code></a> descriptor
2919 <li><em>request method</em> — GET
2921 <li><em>author request headers</em> — none
2923 <li><em>request entity body</em> — empty
2925 <li><em>source origin</em> — the origin of the page which linked to the
2926 stylesheet
2928 <li><em>manual redirect flag</em> — false
2930 <li><em>omit credentials flag</em> — true
2932 <li><em>force preflight flag</em> — false
2933 </ul>
2935 <h2 id=font-matching-algorithm><span class=secno>5 </span>Font Matching
2936 Algorithm</h2>
2938 <p>The algorithm below describes how fonts are associated with individual
2939 runs of text. For each character in the run a font family is chosen and a
2940 particular font face is selected containing a glyph for that character.
2942 <h3 id=font-family-casing><span class=secno>5.1 </span>Case sensitivity of
2943 font family names</h3>
2945 <p>As part of the font matching algorithm outlined below, user agents must
2946 match font family names used in style rules with actual font family names
2947 contained in fonts available in a given environment or defined via
2948 <code>@font-face</code> rules. User agents must match these names case
2949 insensitively, using the "Default Caseless Matching" algorithm outlined in
2950 the Unicode specification <a href="#UNICODE6"
2951 rel=biblioentry>[UNICODE6]<!--{{!UNICODE6}}--></a>. This algorithm is
2952 detailed in section 3.13 entitled "Default Case Algorithms". Specifically,
2953 the algorithm must be applied without normalizing the strings involved and
2954 without applying any language-specific tailorings. The case folding method
2955 specified by this algorithm uses the case mappings with status field
2956 ‘<code class=property>C</code>’ or ‘<code class=property>F</code>’
2957 in the CaseFolding.txt file of the Unicode Character Database.
2959 <p class=note> Implementors should take care to verify that a given
2960 caseless string comparison implementation uses this precise algorithm and
2961 not assume that a given platform string matching routine follows it, as
2962 many of these have locale-specific behavior or use some level of string
2963 normalization.
2965 <p class=note> For authors this means that font family names are matched
2966 case insensitively, whether or not those names exist in a platform font or
2967 in the <code>@font-face</code> rules contained in a stylesheet. Authors
2968 should take care to ensure that names use a character sequence consistent
2969 with the actual font family name, particularly when using combining
2970 characters such as diacritical marks. For example, a family name that
2971 contains an uppercase A (U+0041) followed by a combining ring (U+030A)
2972 will <strong>not</strong> match a name that looks identical but which uses
2973 the precomposed lowercase a-ring character (U+00E5) instead of the
2974 combining sequence.
2976 <h3 id=font-style-matching><span class=secno>5.2 </span>Matching font
2977 styles</h3>
2979 <p>The procedure for choosing fonts consists of iterating over the font
2980 families determined by the font-family property, selecting a font face
2981 with the appropriate style based on other font properties and then
2982 determining whether a glyph exists for a given character. This is done
2983 using the <dfn id=character-map>character map</dfn> of the font, data
2984 which maps characters to the default glyph for that character. Codepoint
2985 sequences consisting of a base character followed by a sequence of
2986 combining characters are treated slightly differently, see the section on
2987 <a href="#cluster-matching">cluster matching</a> below.
2989 <p>For this procedure, the <dfn id=default-face>default face</dfn> for a
2990 given font family is defined to be the face that would be selected if all
2991 font style properties were set to their initial value.
2993 <ol id=fontmatchingalg>
2994 <li>Using the computed font property values for a given element, the user
2995 agent starts with the first family name in the fontlist specified by the
2996 <span class=property>‘<a href="#descdef-font-family"><code
2997 class=property>font-family</code></a>’</span> property.
2999 <li>If the family name is unquoted and is a generic family name, the user
3000 agent looks up the appropriate font family name to be used. User agents
3001 may choose the generic font family to use based on the language of the
3002 containing element or the Unicode range of the character.
3004 <li>For other family names, the user agent attempts to find the family
3005 name among fonts defined via <code>@font-face</code> rules and then among
3006 available system fonts, matching names with a case-insensitive comparison
3007 as outlined <a href="#font-family-casing">in the section above</a>. On
3008 systems containing fonts with multiple localized font family names, user
3009 agents must match any of these names independent of the underlying system
3010 locale or platform API used. If the font resources defined for a given
3011 face in an @font-face rule are either not available or contain invalid
3012 font data, then the face should be treated as not present in the family.
3013 If no faces are present for a family defined via @font-face rules, the
3014 family should be treated as missing; matching a platform font with the
3015 same name must not occur in this case.
3017 <li>If a font family match occurs, the user agent assembles the set of
3018 font faces in that family and then narrows the set to a single face using
3019 other font properties in the order given below:
3020 <ol id=fontstylematchingalg>
3021 <li><span class=property>‘<a href="#propdef-font-stretch"><code
3022 class=property>font-stretch</code></a>’</span> is tried first. If the
3023 matching set contains faces with width values matching the ‘<a
3024 href="#propdef-font-stretch"><code
3025 class=property>font-stretch</code></a>’ value, faces with other width
3026 values are removed from the matching set. If there is no face that
3027 exactly matches the width value the nearest width is used instead. If
3028 the value of ‘<a href="#propdef-font-stretch"><code
3029 class=property>font-stretch</code></a>’ is ‘<a
3030 href="#normal2"><code class=property>normal</code></a>’ or one of the
3031 condensed values, narrower width values are checked first, then wider
3032 values. If the value of ‘<a href="#propdef-font-stretch"><code
3033 class=property>font-stretch</code></a>’ is one of the expanded
3034 values, wider values are checked first, followed by narrower values.
3035 Once the closest matching width has been determined by this process,
3036 faces with other widths are removed from the matching set.
3038 <li><span class=property>‘<a href="#propdef-font-style"><code
3039 class=property>font-style</code></a>’</span> is tried next. If the
3040 value of ‘<a href="#propdef-font-style"><code
3041 class=property>font-style</code></a>’ is ‘<code
3042 class=property>italic</code>’, italic faces are checked first, then
3043 oblique, then normal faces. If the value is ‘<code
3044 class=property>oblique</code>’, oblique faces are checked first, then
3045 italic faces and then normal faces. If the value is ‘<a
3046 href="#normal2"><code class=property>normal</code></a>’, normal faces
3047 are checked first, then oblique faces, then italic faces. Faces with
3048 other style values are excluded from the matching set. User agents are
3049 permitted to distinguish between italic and oblique faces within
3050 platform font families but this is not required, they may treat all
3051 italic or oblique faces as italic faces. However, within font families
3052 defined via <code>@font-face</code> rules, italic and oblique faces
3053 must be distinguished using the value of the ‘<a
3054 href="#propdef-font-style"><code
3055 class=property>font-style</code></a>’ descriptor.
3057 <li><span class=property>‘<a href="#propdef-font-weight"><code
3058 class=property>font-weight</code></a>’</span> is matched next, it
3059 will always reduce the matching set to a single font face. If
3060 bolder/lighter relative weights are used, the effective weight is
3061 calculated based on the inherited weight value, as described in the
3062 definition of the ‘<a href="#propdef-font-weight"><code
3063 class=property>font-weight</code></a>’ property. Given the desired
3064 weight and the weights of faces in the matching set after the steps
3065 above, if the desired weight is available that face matches. Otherwise,
3066 a weight is chosen using the rules below:
3067 <ul>
3068 <li>If the desired weight is less than 400, weights below the desired
3069 weight are checked in descending order followed by weights above the
3070 desired weight in ascending order until a match is found.
3072 <li>If the desired weight is greater than 500, weights above the
3073 desired weight are checked in ascending order followed by weights
3074 below the desired weight in descending order until a match is found.
3076 <li>If the desired weight is 400, 500 is checked first and then the
3077 rule for desired weights less than 400 is used.
3079 <li>If the desired weight is 500, 400 is checked first and then the
3080 rule for desired weights less than 400 is used.
3081 </ul>
3083 <li><span class=property>‘<a href="#propdef-font-size"><code
3084 class=property>font-size</code></a>’</span> must be matched within a
3085 UA-dependent margin of tolerance. (Typically, sizes for scalable fonts
3086 are rounded to the nearest whole pixel, while the tolerance for
3087 bitmapped fonts could be as large as 20%.) Further computations, e.g.,
3088 by ‘<code class=property>em</code>’ values in other properties, are
3089 based on the <span class=property>‘<a href="#propdef-font-size"><code
3090 class=property>font-size</code></a>’</span> value that is used, not
3091 the one that is specified.
3092 </ol>
3094 <li>
3095 <p>If no matching face exists or the matched face does not contain a
3096 glyph for the character to be rendered, the next family name is selected
3097 and the previous two steps repeated. Glyphs from other faces in the
3098 family are not considered. The only exception is that user agents may
3099 optionally substitute a synthetic version of the <a
3100 href="#default-face"><em>default face</em></a> if that face supports a
3101 given glyph (e.g. a synthetic italic version of the regular face may be
3102 used if the italic face doesn't support glyphs for Arabic).</p>
3103 <!-- resolution on the above: http://lists.w3.org/Archives/Public/www-style/2012Nov/0292.html -->
3105 <p>If the matched font is defined via an <code>@font-face</code> rule and
3106 needs to be downloaded, the font resource is downloaded. While the
3107 download occurs, the user agent can either wait until the font is
3108 downloaded or render once with substituted font metrics and render again
3109 once the font is downloaded.</p>
3111 <li>If there are no more font families to be evaluated and no matching
3112 face has been found, then the user agent performs a <em>system font
3113 fallback</em> procedure to find the best match for the character to be
3114 rendered. The result of this procedure may vary across user agents.
3116 <li>If a particular character cannot be displayed using any font, the user
3117 agent should indicate by some means that a character is not being
3118 displayed, displaying either a symbolic representation of the missing
3119 glyph (e.g. using a <a
3120 href="http://en.wikipedia.org/wiki/Last_resort_font">Last Resort
3121 Font</a>) or using the missing character glyph from a default font.
3122 </ol>
3124 <h3 id=cluster-matching><span class=secno>5.3 </span>Cluster matching</h3>
3126 <p>When text contains characters such as combining diacritics, ideally the
3127 base character should be rendered using the same font as the diacritic,
3128 this assures proper placement of the diacritic. For this reason, the font
3129 matching algorithm for clusters is more specialized than the general case
3130 of matching a single character by itself. For sequences containing
3131 variation selectors, which indicate the precise glyph to be used for a
3132 given character, user agents always attempt system font fallback to find
3133 the appropriate glyph before using the default glyph of the base
3134 character.
3136 <p>A font is considered to <em>support</em> a given character if (1) the
3137 character is contained in the font's <a
3138 href="#character-map"><em>character map</em></a> and (2) if required by
3139 the containing script, shaping information is available for that
3140 character. Some legacy fonts may include a given character in the <a
3141 href="#character-map"><em>character map</em></a> but lack the shaping
3142 information (e.g. <a
3143 href="http://www.microsoft.com/typography/otspec/ttochap1.htm">OpenType
3144 layout tables</a> or <a
3145 href="http://scripts.sil.org/cms/scripts/page.php?site_id=projects&item_id=graphite_techAbout">Graphite
3146 tables</a>) necessary for correctly rendering text runs containing that
3147 character.
3149 <p>A sequence of codepoints containing combining diacritics or other
3150 modifiers is termed a grapheme cluster (see <a href="#CSS3TEXT"
3151 rel=biblioentry>[CSS3TEXT]<!--{{CSS3TEXT}}--></a> for a more complete
3152 description). For a given cluster containing a base character, <em>b</em>
3153 and a sequence of combining characters <em>c1, c2…</em>, the entire
3154 cluster is matched using these steps:
3156 <ol>
3157 <li>For each family in the font list, a face is chosen using the style
3158 selection rules defined in the previous section.
3159 <ol>
3160 <li>If all characters in the sequence <em>b + c1 + c2 …</em> are
3161 completely supported by the font, select this font for the sequence.
3163 <li>If a sequence of multiple codepoints is canonically equivalent to a
3164 single character and the font supports that character, select this font
3165 for the sequence.
3166 </ol>
3168 <li>If no font was found in the font list in step 1:
3169 <ol>
3170 <li>If <em>c1</em> is a variation selector, system fallback must be used
3171 to find a font that supports the full sequence of <em>b + c1</em>. If
3172 no font on the system supports the full sequence, match the single
3173 character <em>b</em> using the normal procedure for matching single
3174 characters and ignore the variation selector. Note: a sequence with
3175 more than one variation selector is treated as an encoding error and
3176 the trailing selectors are ignored.
3178 <li>Otherwise, the user agent may optionally use system font fallback to
3179 match a font that supports the entire cluster.
3180 </ol>
3182 <li>If no font is found in step 2, use the matching sequence from step 1
3183 to determine the longest sequence that is completely matched by a font in
3184 the font list and attempt to match the remaining combining characters
3185 separately using the rules for single characters.
3186 </ol>
3188 <h3 id=char-handling-issues><span class=secno>5.4 </span>Character handling
3189 issues</h3>
3191 <p>The procedure above is always performed on text runs containing Unicode
3192 characters, documents using legacy encodings are assumed to have been
3193 transcoded before matching fonts. For fonts containing <a
3194 href="#character-map"><em title="character map">character maps</em></a>
3195 for both legacy encodings and Unicode, the contents of the legacy encoding
3196 <a href="#character-map"><em>character map</em></a> must have no effect on
3197 the results of the font matching process.
3199 <p>The font matching process does not assume that text runs are in either
3200 normalized or denormalized form (see <a href="#CHARMOD-NORM"
3201 rel=biblioentry>[CHARMOD-NORM]<!--{{CHARMOD-NORM}}--></a> for more
3202 details). Layout engines often convert base character plus combining
3203 character sequences into precomposed characters if they exist. The font
3204 matching algorithm outlined here supports both ways and fonts can
3205 generally support either but variations can occur. Authors should always
3206 tailor their choice of fonts to their content, including whether that
3207 content contains normalized or denormalized character streams.
3209 <p>If a given character is a Private-Use Area Unicode codepoint and none of
3210 the fonts in the fontlist contain a glyph for that codepoint, user agents
3211 must display some form of missing glyph symbol for that character rather
3212 than attempting system font fallback for that codepoint. When matching the
3213 replacement character U+FFFD, user agents may skip the font matching
3214 process and immediately display some form of missing glyph symbol, they
3215 are not required to display the glyph from the font that would be selected
3216 by the font matching process.
3218 <p>In general, the fonts for a given family will all have the same or
3219 similar <a href="#character-map"><em title="character map">character
3220 maps</em></a>. The process outlined here is designed to handle even font
3221 families containing faces with widely variant <a href="#character-map"><em
3222 title="character map">character maps</em></a>. However, authors are
3223 cautioned that the use of such families can lead to unexpected results.
3225 <p>Optimizations of this process are allowed provided that an
3226 implementation behaves as if the algorithm had been followed exactly.
3227 Matching occurs in a well-defined order to insure that the results are as
3228 consistent as possible across user agents, given an identical set of
3229 available fonts and rendering technology.
3231 <h3 id=font-matching-changes><span class=secno>5.5 </span>Font matching
3232 changes since CSS 2.1</h3>
3234 <p>The algorithm above is different from CSS 2.1 in a number of key places.
3235 These changes were made to better reflect actual font matching behavior
3236 across user agent implementations.
3238 <p>Differences compared to the font matching algorithm in CSS 2.1:
3240 <ul>
3241 <li>The algorithm includes font-stretch matching.
3243 <li>All possible font-style matching scenarios are delineated.
3245 <li>Small-caps fonts are not matched as part of the font matching process,
3246 they are now handled via font features.
3248 <li>Unicode variation selector matching is required.
3250 <li>Cluster sequences are matched as a unit.
3251 </ul>
3253 <h3 id=font-matching-examples><span class=secno>5.6 </span>Font matching
3254 examples</h3>
3256 <div class=example>
3257 <p>It's useful to note that the CSS selector syntax may be used to create
3258 language-sensitive typography. For example, some Chinese and Japanese
3259 characters are unified to have the same Unicode code point, although the
3260 abstract glyphs are not the same in the two languages.
3262 <pre>*:lang(ja-jp) { font: 900 14pt/16pt "Heisei Mincho W9", serif; }
3263 *:lang(zh-tw) { font: 800 14pt/16.5pt "Li Sung", serif; }
3264 </pre>
3266 <p>This selects any element that has the given language - Japanese or
3267 Traditional Chinese - and uses the appropriate font.
3268 </div>
3270 <h2 id=font-rend-props><span class=secno>6 </span>Font Feature Properties</h2>
3272 <p>Modern font technologies support a variety of advanced typographic and
3273 language-specific font features. Using these features, a single font can
3274 provide glyphs for a wide range of ligatures, contextual and stylistic
3275 alternates, tabular and old-style figures, small capitals, automatic
3276 fractions, swashes, and alternates specific to a given language. To allow
3277 authors control over these font capabilities, the font-variant property
3278 has been expanded for CSS3, it now functions as a shorthand for a set of
3279 properties that provide control over stylistic font features.
3281 <h3 id=glyph-selection-positioning><span class=secno>6.1 </span>Glyph
3282 selection and positioning</h3>
3284 <p>Simple fonts used for displaying Latin text use a very basic processing
3285 model, fonts contain a <a href="#character-map"><em>character map</em></a>
3286 which maps a given character to a glyph for that character. Glyphs for
3287 subsequent characters are simply placed next in line along a run of text.
3288 Font formats such as OpenType and AAT (Apple Advanced Typography) use a
3289 richer processing model, the glyph for a given character can be chosen and
3290 positioned not just based on a single character, but also based on
3291 surrounding characters along with the language, script, and features
3292 enabled for the text. Font features may be required for specific scripts,
3293 or recommended as enabled by default or they may be stylistic features
3294 meant to be used under author control.
3296 <p>For a good visual overview of these features, see the <a
3297 href="#OPENTYPE-FONT-GUIDE"
3298 rel=biblioentry>[OPENTYPE-FONT-GUIDE]<!--{{OPENTYPE-FONT-GUIDE}}--></a>.
3299 For a detailed description of glyph processing for OpenType fonts, see <a
3300 href="#WINDOWS-GLYPH-PROC"
3301 rel=biblioentry>[WINDOWS-GLYPH-PROC]<!--{{WINDOWS-GLYPH-PROC}}--></a>.
3303 <p>Stylistic font features can be classified into two broad categories,
3304 ones that affect the harmonization of glyph shapes with the surrounding
3305 context, such as kerning and ligature features, and those such as the
3306 small-caps, subscript/superscript and alternate features that affect shape
3307 selection.
3309 <p>The subproperties of font-variant listed below are used to control these
3310 stylistic font features; they do not control features that are required
3311 for displaying certain scripts, such as the OpenType features used when
3312 displaying Arabic or Indic language text. They affect glyph selection and
3313 positioning, they do not affect font selection as described in the font
3314 matching section (except in cases required for compatibility with CSS
3315 2.1).
3317 <p>To assure consistent behavior across user agents, the equivalent
3318 OpenType property settings are listed for individual properties and must
3319 be considered normative. When using other font formats these should be
3320 used as a guideline to map CSS font feature property values to specific
3321 font features.
3323 <h3 id=language-specific-support><span class=secno>6.2
3324 </span>Language-specific display</h3>
3326 <p>OpenType also supports language-specific glyph selection and
3327 positioning, so that text can be displayed correctly in cases where the
3328 language dictates a specific display behavior. Languages often share a
3329 common script but the shape of certain letters may vary across those
3330 languages, such as the variations in certain Cyrillic letters used in
3331 Russian and Bulgarian text. In Latin text, it's common to render "fi" with
3332 an explicit fi-ligature that lacks a dot on the "i". However, in languages
3333 such as Turkish which uses both a dotted-i and a dotless-i, it's important
3334 to not use this ligature or use a specialized version that contains a dot
3335 over the "i". The example below shows language-specific variations based
3336 on stylistic traditions found in Spanish, Italian and French orthography:
3338 <div class=featex><img alt="language specific forms, spanish"
3339 src=locl-1.png></div>
3341 <div class=featex><img alt="language specific forms, italian"
3342 src=locl-2.png></div>
3344 <div class=featex><img alt="language specific forms, french"
3345 src=locl-3.png></div>
3347 <p>If the content language of the element is known, according to the rules
3348 of the <a
3349 href="http://www.w3.org/TR/CSS21/conform.html#doclanguage">document
3350 language</a>, user agents are required to infer the OpenType language
3351 system from the content language and use that when selecting and
3352 positioning glyphs using an OpenType font.
3354 <p>For OpenType fonts, in some cases it may be necessary to explicitly
3355 declare the OpenType language to be used, for example when displaying text
3356 in a given language that uses the typographic conventions of another
3357 language or when the font does not explicitly support a given language but
3358 supports a language that shares common typographic conventions. The ‘<a
3359 href="#propdef-font-language-override"><code
3360 class=property>font-language-override</code></a>’ property is used for
3361 this purpose.
3363 <p class=issue>Should user agents be allowed to infer the OpenType language
3364 or simply use only the default language system? Do we also need a
3365 normative definition of how the script system is inferred?</p>
3366 <!-- prop: font-kerning -->
3368 <h3 id=font-kerning-prop><span class=secno>6.3 </span>Kerning: the <a
3369 href="#propdef-font-kerning">font-kerning</a> property</h3>
3371 <table class=propdef id=namefont-kerningvalueauto-normal-noneini>
3372 <tbody>
3373 <tr>
3374 <td>Name:
3376 <td><dfn id=propdef-font-kerning>font-kerning</dfn>
3378 <tr>
3379 <td>Value:
3381 <td>auto | normal | none
3383 <tr>
3384 <td>Initial:
3386 <td>auto
3388 <tr>
3389 <td>Applies to:
3391 <td>all elements
3393 <tr>
3394 <td>Inherited:
3396 <td>yes
3398 <tr>
3399 <td>Percentages:
3401 <td>N/A
3403 <tr>
3404 <td>Media:
3406 <td>visual
3408 <tr>
3409 <td>Computed value:
3411 <td>as specified
3413 <tr>
3414 <td>Animatable:
3416 <td>no
3417 </table>
3419 <p>Kerning is the contextual adjustment of inter-glyph spacing. This
3420 property controls metric kerning, kerning that utilizes adjustment data
3421 contained in the font. The value ‘<a href="#normal2"><code
3422 class=property>normal</code></a>’ implies that kerning is applied while
3423 the value ‘<code class=property>none</code>’ implies that kerning is
3424 not applied when rendering text. If the value is ‘<code
3425 class=property>auto</code>’, a user agent is free to choose whether
3426 kerning is enabled or not by default and to vary that default based on the
3427 underlying text script.
3429 <p>For fonts that do not include kerning data this property will have no
3430 visible effect. When rendering with OpenType fonts, the <a
3431 href="#OPENTYPE" rel=biblioentry>[OPENTYPE]<!--{{!OPENTYPE}}--></a>
3432 specification suggests that kerning be enabled by default. When kerning is
3433 enabled, the OpenType <span class=tag>kern</span> feature is enabled (for
3434 vertical text runs the <span class=tag>vkrn</span> feature is enabled).
3435 User agents must also support fonts that only support kerning via data
3436 contained in a ‘<code class=property>kern</code>’ font table, as
3437 detailed in the OpenType specification. Authors may prefer to disable
3438 kerning in situations where performance is more important that precise
3439 appearance. If the ‘<code class=property>letter-spacing</code>’
3440 property is defined, kerning adjustments are considered part of the
3441 default spacing, letter spacing adjustments are made after kerning has
3442 been applied.</p>
3443 <!-- prop: font-variant-ligatures -->
3445 <h3 id=font-variant-ligatures-prop><span class=secno>6.4 </span>Ligatures:
3446 the <a href="#propdef-font-variant-ligatures">font-variant-ligatures</a>
3447 property</h3>
3449 <table class=propdef id=namefont-variant-ligaturesvaluenormal-no>
3450 <tbody>
3451 <tr>
3452 <td>Name:
3454 <td><dfn id=propdef-font-variant-ligatures>font-variant-ligatures</dfn>
3456 <tr>
3457 <td>Value:
3459 <td>normal | none | [ <common-lig-values> ||
3460 <discretionary-lig-values> || <historical-lig-values> ||
3461 <contextual-alt-values> ]
3463 <tr>
3464 <td>Initial:
3466 <td>normal
3468 <tr>
3469 <td>Applies to:
3471 <td>all elements
3473 <tr>
3474 <td>Inherited:
3476 <td>yes
3478 <tr>
3479 <td>Percentages:
3481 <td>N/A
3483 <tr>
3484 <td>Media:
3486 <td>visual
3488 <tr>
3489 <td>Computed value:
3491 <td>as specified
3493 <tr>
3494 <td>Animatable:
3496 <td>no
3497 </table>
3499 <p>Ligatures and contextual forms are ways of combining glyphs to produce
3500 more harmonized forms. A value of ‘<a href="#normal2"><code
3501 class=property>normal</code></a>’ implies that common default features
3502 are enabled, <a href="#font-feature-resolution">as described in detail in
3503 the next section</a>. For OpenType fonts, common ligatures and contextual
3504 forms are on by default, discretionary and historical ligatures are not. A
3505 value of ‘<code class=property>none</code>’ implies that all types of
3506 ligatures and contextual forms covered by this property are explicitly
3507 disabled. In situations where ligatures are not considered necessary, this
3508 may improve the speed of text rendering.
3510 <pre
3511 class=prod><dfn id=ltcommon-lig-values><var><common-lig-values></var></dfn> = [ common-ligatures | no-common-ligatures ]</pre>
3513 <pre
3514 class=prod><dfn id=ltdiscretionary-lig-values><var><discretionary-lig-values></var></dfn> = [ discretionary-ligatures | no-discretionary-ligatures ]</pre>
3516 <pre
3517 class=prod><dfn id=lthistorical-lig-values><var><historical-lig-values></var></dfn> = [ historical-ligatures | no-historical-ligatures ]</pre>
3519 <pre
3520 class=prod><dfn id=ltcontextual-alt-valuesgt><var><contextual-alt-values></var></dfn> = [ contextual | no-contextual ]</pre>
3522 <p>Individual values have the following meanings:
3524 <dl>
3525 <dt><dfn id=common-ligatures>common-ligatures</dfn>
3527 <dd>Enables display of common ligatures (OpenType features: <span
3528 class=tag>liga, clig</span>). For OpenType fonts, common ligatures are
3529 enabled by default.
3530 </dl>
3532 <div class=featex><img alt="common ligature example" src=liga.png></div>
3534 <dl>
3535 <dt><dfn id=no-common-ligatures>no-common-ligatures</dfn>
3537 <dd>Disables display of common ligatures (OpenType features: <span
3538 class=tag>liga, clig</span>).
3540 <dt><dfn id=discretionary-ligatures>discretionary-ligatures</dfn>
3542 <dd>Enables display of discretionary ligatures (OpenType feature: <span
3543 class=tag>dlig</span>). Which ligatures are discretionary, or optional,
3544 is decided by the type designer so authors will need to refer to the
3545 documentation of a given font to understand which ligatures are
3546 considered discretionary.
3547 </dl>
3549 <div class=featex><img alt="discretionary ligature example" src=dlig.png></div>
3551 <dl>
3552 <dt><dfn id=no-discretionary-ligatures>no-discretionary-ligatures</dfn>
3554 <dd>Disables display of discretionary ligatures (OpenType feature: <span
3555 class=tag>dlig</span>).
3557 <dt><dfn id=historical-ligatures>historical-ligatures</dfn>
3559 <dd>Enables display of historical ligatures (OpenType feature: <span
3560 class=tag>hlig</span>).
3561 </dl>
3563 <div class=featex><img alt="historical ligature example" src=hlig.png></div>
3565 <dl>
3566 <dt><dfn id=no-historical-ligatures>no-historical-ligatures</dfn>
3568 <dd>Disables display of historical ligatures (OpenType feature: <span
3569 class=tag>hlig</span>).
3571 <dt><dfn id=contextual>contextual</dfn>
3573 <dd>Enables display of contextual alternates (OpenType feature: <span
3574 class=tag>calt</span>). Although not strictly a ligature feature, like
3575 ligatures this feature is commonly used to harmonize the shapes of glyphs
3576 with the surrounding context. For OpenType fonts, this feature is on by
3577 default.
3578 </dl>
3580 <div class=featex><img alt="contextual alternate example" src=calt.png></div>
3582 <dl>
3583 <dt><dfn id=no-contextual>no-contextual</dfn>
3585 <dd>Disables display of contextual alternates (OpenType feature: <span
3586 class=tag>calt</span>).
3587 </dl>
3589 <p>Required ligatures, needed for correctly rendering complex scripts, are
3590 not affected by the settings above, including ‘<code
3591 class=property>none</code>’ (OpenType feature: <span
3592 class=tag>rlig</span>).</p>
3593 <!-- prop: font-variant-position -->
3595 <h3 id=font-variant-position-prop><span class=secno>6.5 </span>Subscript
3596 and superscript forms: the <a
3597 href="#propdef-font-variant-position">font-variant-position</a> property</h3>
3599 <table class=propdef id=namefont-variant-positionvaluenormal-sub>
3600 <tbody>
3601 <tr>
3602 <td>Name:
3604 <td><dfn id=propdef-font-variant-position>font-variant-position</dfn>
3606 <tr>
3607 <td>Value:
3609 <td>normal | sub | super
3611 <tr>
3612 <td>Initial:
3614 <td>normal
3616 <tr>
3617 <td>Applies to:
3619 <td>all elements
3621 <tr>
3622 <td>Inherited:
3624 <td>yes
3626 <tr>
3627 <td>Percentages:
3629 <td>N/A
3631 <tr>
3632 <td>Media:
3634 <td>visual
3636 <tr>
3637 <td>Computed value:
3639 <td>as specified
3641 <tr>
3642 <td>Animatable:
3644 <td>no
3645 </table>
3647 <p>This property is used to enable typographic subscript and superscript
3648 glyphs. These are alternate glyphs designed within the same em-box as
3649 default glyphs and are intended to be laid out on the same baseline as the
3650 default glyphs, with no resizing or repositioning of the baseline. They
3651 are explicitly designed to match the surrounding text and to be more
3652 readable without affecting the line height.
3654 <div class=figure><img alt="comparison between real subscript glyphs and
3655 synthesized ones" src=realsubscripts.png>
3656 <p class=caption>Subscript glyphs (top) vs. typical synthesized subscripts
3657 (bottom)
3658 </div>
3660 <p>The values ‘<code class=property>sub</code>’ and ‘<code
3661 class=property>super</code>’ imply the appropriate variant glyph is
3662 displayed when available in the font (OpenType features: <span
3663 class=tag>subs, sups</span>). A value of ‘<a href="#normal2"><code
3664 class=property>normal</code></a>’ implies neither of these alternate
3665 glyphs are substituted.
3667 <p>Because of the semantic nature of subscripts and superscripts, when the
3668 value is either ‘<code class=property>sub</code>’ or ‘<code
3669 class=property>super</code>’ for a given contiguous run of text, if a
3670 variant glyph is not available for all the characters in the run,
3671 simulated glyphs must be synthesized for all characters using reduced
3672 forms of the glyphs that would be used without this feature applied. This
3673 is done to avoid a mixture of variant glyphs and synthesized ones that
3674 would not align correctly.
3676 <p>In the case of OpenType fonts that lack subscript or superscript glyphs
3677 for a given character, user agents must use the appropriate subscript and
3678 superscript metrics specified in the selected font's <a
3679 href="http://www.microsoft.com/typography/otspec/os2.htm#subxs">OS/2
3680 table</a> <a href="#OPENTYPE"
3681 rel=biblioentry>[OPENTYPE]<!--{{!OPENTYPE}}--></a> to calculate the size
3682 and offset of the synthesized substitutes.
3684 <p>In the past, user agents have used font-size and vertical-align to
3685 simulate subscripts and superscripts for the <span class=tag>sub</span>
3686 and <span class=tag>sup</span> elements. To allow a backwards compatible
3687 way of defining subscripts and superscripts, it is recommended that
3688 authors use conditional rules <a href="#CSS3-CONDITIONAL"
3689 rel=biblioentry>[CSS3-CONDITIONAL]<!--{{CSS3-CONDITIONAL}}--></a> so that
3690 older user agents will still render subscripts and superscripts via the
3691 older mechanism.
3693 <p>Authors should note that fonts typically only provide subscript and
3694 superscript glyphs for a subset of all characters supported by the font.
3695 While subscript and superscript glyphs are often available for Latin
3696 numbers, glyphs for punctuation and letter characters are less frequently
3697 provided. The synthetic fallback rules defined for this property assure
3698 that subscripts and superscripts will always appear but the appearance may
3699 not match author expectations if the font used does not provide the
3700 appropriate alternate glyph for all characters contained in a subscript or
3701 superscript.
3703 <div class=figure><img alt="alternate superscripts vs. glyphs synthesized
3704 using superscript metrics" src=superscript-alt-synth.png>
3705 <p class=caption>Superscript alternate glyph (left), synthesized
3706 superscript glyphs (middle), and incorrect mixture of the two (right)
3707 </div>
3709 <p>This property is not cumulative, applying it to subelements within a
3710 subscript or superscript won't nest the placement of a subscript or
3711 superscript glyph. Images contained within text runs where the value of
3712 this property is ‘<code class=property>sub</code>’ or ‘<code
3713 class=property>super</code>’ will be drawn just as they would if the
3714 value was ‘<a href="#normal2"><code class=property>normal</code></a>’.
3715 Likewise, text decorations such as underlines or emphasis marks will
3716 render in the same position as they would for the default glyphs, since
3717 this property does not affect the baseline position.
3719 <p>Because of these limitations, font-variant-position is not recommended
3720 for use in user agent stylesheets. Authors should use it in cases where
3721 subscripts or superscripts will only contain the narrow range of
3722 characters supported by the fonts specified.
3724 <div class=example>
3725 <p>A typical user agent default style for the <span class=tag>sub</span>
3726 element:</p>
3728 <pre>sub {
3729 vertical-align: sub;
3730 font-size: smaller;
3731 line-height: normal;
3732 }
3733 </pre>
3735 <p>Using font-variant-position to specify typographic subscripts in a way
3736 that will still show subscripts in older user agents:</p>
3738 <pre>@supports ( font-variant-position: sub ) {
3740 sub {
3741 vertical-align: inherit;
3742 font-size: 100%;
3743 line-height: inherit;
3744 font-variant-position: sub;
3745 }
3747 }
3748 </pre>
3750 <p>User agents that support the ‘<a
3751 href="#propdef-font-variant-position"><code
3752 class=property>font-variant-position</code></a>’ property will select a
3753 subscript variant glyph and render this without adjusting the baseline or
3754 font-size. Older user agents will ignore the ‘<a
3755 href="#propdef-font-variant-position"><code
3756 class=property>font-variant-position</code></a>’ property definition
3757 and use the standard defaults for subscripts.</p>
3758 </div>
3759 <!-- prop: font-variant-caps -->
3761 <h3 id=font-variant-caps-prop><span class=secno>6.6 </span>Capitalization:
3762 the <a href="#propdef-font-variant-caps">font-variant-caps</a> property</h3>
3764 <table class=propdef id=namefont-variant-capsvaluenormal-small-c>
3765 <tbody>
3766 <tr>
3767 <td>Name:
3769 <td><dfn id=propdef-font-variant-caps>font-variant-caps</dfn>
3771 <tr>
3772 <td>Value:
3774 <td>normal | small-caps | all-small-caps | petite-caps | all-petite-caps
3775 | unicase | titling-caps
3777 <tr>
3778 <td>Initial:
3780 <td>normal
3782 <tr>
3783 <td>Applies to:
3785 <td>all elements
3787 <tr>
3788 <td>Inherited:
3790 <td>yes
3792 <tr>
3793 <td>Percentages:
3795 <td>N/A
3797 <tr>
3798 <td>Media:
3800 <td>visual
3802 <tr>
3803 <td>Computed value:
3805 <td>as specified
3807 <tr>
3808 <td>Animatable:
3810 <td>no
3811 </table>
3813 <p>Specifies control over capitalized forms.
3815 <p>Individual values have the following meanings:
3817 <dl>
3818 <dt><dfn id=normal>normal</dfn>
3820 <dd>None of the features listed below are enabled.
3822 <dt><dfn id=small-caps>small-caps</dfn>
3824 <dd>Enables display of small capitals (OpenType feature: <span
3825 class=tag>smcp</span>). Small-caps glyphs typically use the form of
3826 uppercase letters but are reduced to the size of lowercase letters.
3827 </dl>
3829 <div class=featex><img alt="small-caps example" src=smcp.png></div>
3831 <dl>
3832 <dt><dfn id=all-small-caps>all-small-caps</dfn>
3834 <dd>Enables display of small capitals for both upper and lowercase letters
3835 (OpenType features: <span class=tag>c2sc, smcp</span>).
3837 <dt><dfn id=petite-caps>petite-caps</dfn>
3839 <dd>Enables display of petite capitals (OpenType feature: <span
3840 class=tag>pcap</span>).
3842 <dt><dfn id=all-petite-caps>all-petite-caps</dfn>
3844 <dd>Enables display of petite capitals for both upper and lowercase
3845 letters (OpenType features: <span class=tag>c2pc, pcap</span>).
3847 <dt><dfn id=unicase>unicase</dfn>
3849 <dd>Enables display of mixture of small capitals for uppercase letters
3850 with normal lowercase letters (OpenType feature: <span
3851 class=tag>unic</span>).
3853 <dt><dfn id=titling-caps>titling-caps</dfn>
3855 <dd>Enables display of titling capitals (OpenType feature: <span
3856 class=tag>titl</span>). Uppercase letter glyphs are often designed for
3857 use with lowercase letters. When used in all uppercase titling sequences
3858 they can appear too strong. Titling capitals are designed specifically
3859 for this situation.
3860 </dl>
3862 <p>This property allows the selection of alternate glyphs used for small or
3863 petite capitals or for titling. These glyphs are specifically designed to
3864 blend well with the surrounding normal glyphs, to maintain the weight and
3865 readability which suffers when text is simply resized to fit this purpose.
3867 <p>The availability of these glyphs is based on whether a given feature is
3868 defined or not in the feature list of the font. User agents can optionally
3869 decide this on a per-script basis but should explicitly not decide this on
3870 a per-character basis.
3872 <p>Some fonts may only support a subset or none of the features described
3873 for this property. For backwards compatibility with CSS 2.1, if ‘<a
3874 href="#small-caps"><code class=property>small-caps</code></a>’ or ‘<a
3875 href="#all-small-caps"><code class=property>all-small-caps</code></a>’
3876 is specified but small-caps glyphs are not available for a given font,
3877 user agents should simulate a small-caps font, for example by taking a
3878 normal font and replacing the glyphs for lowercase letters with scaled
3879 versions of the glyphs for uppercase characters (replacing the glyphs for
3880 both upper and lowercase letters in the case of ‘<a
3881 href="#all-small-caps"><code class=property>all-small-caps</code></a>’).
3883 <div class=figure style="padding: 0; margin: auto;"><img alt="synthetic vs.
3884 real small-caps" class=hires src=synthetic-vs-real-small-caps.png
3885 width=512px>
3886 <p class=caption>Synthetic vs. real small-caps
3887 </div>
3889 <p>To match the surrounding text, a font may provide alternate glyphs for
3890 caseless characters when these features are enabled but when a user agent
3891 simulates small capitals, it must not attempt to simulate alternates for
3892 codepoints which are considered caseless.
3894 <div class=figure style="padding: 0; margin: auto;"><img alt="caseless
3895 characters with small-caps, all-small-caps enabled" class=hires
3896 src=small-capitals-variations.png width=418px>
3897 <p class=caption>Caseless characters with small-caps, all-small-caps
3898 enabled
3899 </div>
3901 <p>If either ‘<a href="#petite-caps"><code
3902 class=property>petite-caps</code></a>’ or ‘<a
3903 href="#all-petite-caps"><code class=property>all-petite-caps</code></a>’
3904 is specified for a font that doesn't support these features, the property
3905 behaves as if ‘<a href="#small-caps"><code
3906 class=property>small-caps</code></a>’ or ‘<a
3907 href="#all-small-caps"><code class=property>all-small-caps</code></a>’,
3908 respectively, had been specified. If ‘<a href="#unicase"><code
3909 class=property>unicase</code></a>’ is specified for a font that doesn't
3910 support that feature, the property behaves as if ‘<a
3911 href="#small-caps"><code class=property>small-caps</code></a>’ was
3912 applied only to lowercased uppercase letters. If ‘<a
3913 href="#titling-caps"><code class=property>titling-caps</code></a>’ is
3914 specified with a font that does not support this feature, this property
3915 has no visible effect. When simulated small capital glyphs are used, for
3916 scripts that lack uppercase and lowercase letters, ‘<a
3917 href="#small-caps"><code class=property>small-caps</code></a>’, ‘<a
3918 href="#all-small-caps"><code class=property>all-small-caps</code></a>’,
3919 ‘<a href="#petite-caps"><code class=property>petite-caps</code></a>’,
3920 ‘<a href="#all-petite-caps"><code
3921 class=property>all-petite-caps</code></a>’ and ‘<a
3922 href="#unicase"><code class=property>unicase</code></a>’ have no visible
3923 effect.
3925 <p>When casing transforms are used to simulate small capitals, the casing
3926 transformations should match those used for the <span
3927 class=property>‘<code class=property>text-transform</code>’</span>
3928 property.
3930 <p>As a last resort, unscaled uppercase letter glyphs in a normal font may
3931 replace glyphs in a small-caps font so that the text appears in all
3932 uppercase letters.
3934 <div class=figure style="padding: 0; margin: auto;"><img alt="using
3935 all-small-caps in acronym-laden text" class=hires
3936 src=acronym-laden-text.png width=596px>
3937 <p class=caption>Using small capitals to improve readability in
3938 acronym-laden text
3939 </div>
3941 <div class=example>
3942 <p>Quotes rendered italicised, with small-caps on the first line:</p>
3944 <pre>blockquote { font-style: italic; }
3945 blockquote:first-line { font-variant: small-caps; }
3947 <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>
3948 </pre>
3949 </div>
3950 <!-- prop: font-variant-numeric -->
3952 <h3 id=font-variant-numeric-prop><span class=secno>6.7 </span>Numerical
3953 formatting: the <a
3954 href="#propdef-font-variant-numeric">font-variant-numeric</a> property</h3>
3956 <table class=propdef id=namefont-variant-numericvaluenormal-ltnu>
3957 <tbody>
3958 <tr>
3959 <td>Name:
3961 <td><dfn id=propdef-font-variant-numeric>font-variant-numeric</dfn>
3963 <tr>
3964 <td>Value:
3966 <td>normal | [ <numeric-figure-values> ||
3967 <numeric-spacing-values> || <numeric-fraction-values> ||
3968 ordinal || slashed-zero ]
3970 <tr>
3971 <td>Initial:
3973 <td>normal
3975 <tr>
3976 <td>Applies to:
3978 <td>all elements
3980 <tr>
3981 <td>Inherited:
3983 <td>yes
3985 <tr>
3986 <td>Percentages:
3988 <td>N/A
3990 <tr>
3991 <td>Media:
3993 <td>visual
3995 <tr>
3996 <td>Computed value:
3998 <td>as specified
4000 <tr>
4001 <td>Animatable:
4003 <td>no
4004 </table>
4006 <p>Specifies control over numerical forms.
4008 <pre
4009 class=prod><dfn id=ltnumeric-figure-valuesgt><var><numeric-figure-values></var></dfn> = [ lining-nums | oldstyle-nums ]</pre>
4011 <pre
4012 class=prod><dfn id=ltnumeric-spacing-valuesgt><var><numeric-spacing-values></var></dfn> = [ proportional-nums | tabular-nums ]</pre>
4014 <pre
4015 class=prod><dfn id=ltnumeric-fraction-valuesgt><var><numeric-fraction-values></var></dfn> = [ diagonal-fractions | stacked-fractions ]</pre>
4017 <p>Individual values have the following meanings:
4019 <dl>
4020 <dt><dfn id=normal0>normal</dfn>
4022 <dd>None of the features listed below are enabled.
4024 <dt><dfn id=lining-nums>lining-nums</dfn>
4026 <dd>Enables display of lining numerals (OpenType feature: <span
4027 class=tag>lnum</span>).
4029 <dt><dfn id=oldstyle-nums>oldstyle-nums</dfn>
4031 <dd>Enables display of old-style numerals (OpenType feature: <span
4032 class=tag>onum</span>).
4034 <dt><dfn id=proportional-nums>proportional-nums</dfn>
4036 <dd>Enables display of proportional numerals (OpenType feature: <span
4037 class=tag>pnum</span>).
4039 <dt><dfn id=tabular-nums>tabular-nums</dfn>
4041 <dd>Enables display of tabular numerals (OpenType feature: <span
4042 class=tag>tnum</span>).
4043 </dl>
4045 <p>The example below shows how these different properties can be combined
4046 to influence the rendering of tabular data with fonts that support these
4047 features. Within normal paragraph text, proportional numbers are used
4048 while tabular numbers are used so that columns of numbers line up
4049 properly:
4051 <div class=figure style="padding: 0; margin: auto;"><img alt="combining
4052 number styles" src=numberstyles.png>
4053 <p class=caption>Using number styles
4054 </div>
4056 <dl>
4057 <dt><dfn id=diagonal-fractions>diagonal-fractions</dfn>
4059 <dd>Enables display of lining diagonal fractions (OpenType feature: <span
4060 class=tag>frac</span>).
4061 </dl>
4063 <div class=featex><img alt="diagonal fraction example" src=frac.png></div>
4065 <dl>
4066 <dt><dfn id=stacked-fractions>stacked-fractions</dfn>
4068 <dd>Enables display of lining stacked fractions (OpenType feature: <span
4069 class=tag>afrc</span>).
4070 </dl>
4072 <div class=featex><img alt="stacked fraction example" src=afrc.png></div>
4074 <dl>
4075 <dt><dfn id=ordinal>ordinal</dfn>
4077 <dd>Enables display of forms used with ordinal numbers (OpenType feature:
4078 <span class=tag>ordn</span>).
4080 <dt><dfn id=slashed-zero>slashed-zero</dfn>
4082 <dd>Enables display of slashed zeros (OpenType feature: <span
4083 class=tag>zero</span>).
4084 </dl>
4086 <div class=featex><img alt="slashed zero example" src=zero.png></div>
4088 <div class=example id=steak-marinade>
4089 <p>A simple flank steak marinade recipe, rendered with automatic fractions
4090 and old-style numerals:</p>
4092 <pre>.amount { font-variant-numeric: oldstyle-nums diagonal-fractions; }
4094 <h4>Steak marinade:</h4>
4095 <ul>
4096 <li><span class="amount">2</span> tbsp olive oil</li>
4097 <li><span class="amount">1</span> tbsp lemon juice</li>
4098 <li><span class="amount">1</span> tbsp soy sauce</li>
4099 <li><span class="amount">1 1/2</span> tbsp dry minced onion</li>
4100 <li><span class="amount">2 1/2</span> tsp italian seasoning</li>
4101 <li>Salt &amp; pepper</li>
4102 </ul>
4104 <p>Mix the meat with the marinade and let it sit covered in the refrigerator
4105 for a few hours or overnight.</p>
4106 </pre>
4107 </div>
4108 <!-- prop: font-variant-alternates -->
4110 <h3 id=font-variant-alternates-prop><span class=secno>6.8 </span>Alternates
4111 and swashes: the <a
4112 href="#propdef-font-variant-alternates">font-variant-alternates</a>
4113 property</h3>
4115 <table class=propdef id=namefont-variant-alternatesvaluenormal-s>
4116 <tbody>
4117 <tr>
4118 <td>Name:
4120 <td><dfn
4121 id=propdef-font-variant-alternates>font-variant-alternates</dfn>
4123 <tr>
4124 <td>Value:
4126 <td>normal | [ stylistic(<feature-value-name>) || historical-forms
4127 || styleset(<feature-value-name>#) ||
4128 character-variant(<feature-value-name>#) ||
4129 swash(<feature-value-name>) ||
4130 ornaments(<feature-value-name>) ||
4131 annotation(<feature-value-name>) ]
4133 <tr>
4134 <td>Initial:
4136 <td>normal
4138 <tr>
4139 <td>Applies to:
4141 <td>all elements
4143 <tr>
4144 <td>Inherited:
4146 <td>yes
4148 <tr>
4149 <td>Percentages:
4151 <td>N/A
4153 <tr>
4154 <td>Media:
4156 <td>visual
4158 <tr>
4159 <td>Computed value:
4161 <td>as specified
4163 <tr>
4164 <td>Animatable:
4166 <td>no
4167 </table>
4169 <p>For any given character, fonts can provide a variety of alternate glyphs
4170 in addition to the default glyph for that character. This property
4171 provides control over the selection of these alternate glyphs.
4173 <p>In cases where multiple alternates are possible, authors define a
4174 <code><feature-value-name></code> using the
4175 <code>@font-feature-values</code> rule described below to indicate the
4176 specific alternate to be used. The nature of these alternates is font
4177 specific, so the rule defines values for a specific font family or set of
4178 families. When a particular value has not been defined for a given family,
4179 the named value is treated as if the feature had omitted from the style
4180 rule. If a given value is outside the range supported by a given font, the
4181 value is ignored. These values never apply to generic font families, nor
4182 to families selected as part of system font fallback. Values that behave
4183 this way are marked as <em>font specific</em>.
4185 <p>Individual values have the following meanings:
4187 <dl>
4188 <dt><dfn id=normal1>normal</dfn>
4190 <dd>None of the features listed below are enabled.
4192 <dt><dfn id=stylisticltfeature-value-namegt
4193 title=stylistic>stylistic(<feature-value-name>)</dfn>
4195 <dd>Enables display of stylistic alternates (<em>font specific</em>,
4196 OpenType feature: <span class=tag>salt
4197 <feature-value-name></span>).
4198 </dl>
4200 <div class=featex><img alt="stylistic alternate example" src=salt.png></div>
4202 <dl>
4203 <dt><dfn id=historical-forms>historical-forms</dfn>
4205 <dd>Enables display of historical forms (OpenType feature: <span
4206 class=tag>hist</span>).
4207 </dl>
4209 <div class=featex><img alt="historical form example" src=hist.png></div>
4211 <dl>
4212 <dt><dfn id=stylesetltfeature-value-namegt
4213 title=styleset>styleset(<feature-value-name>#)</dfn>
4215 <dd>Enables display with stylistic sets (<em>font specific</em>, OpenType
4216 feature: <span class=tag>ss<feature-index></span> OpenType
4217 currently defines <span class=tag>ss01</span> through <span
4218 class=tag>ss20</span>).
4219 </dl>
4221 <div class=featex><img alt="styleset example" src=ssnn.png></div>
4223 <dl>
4224 <dt><dfn id=character-variantltfeature-value-namegt
4225 title=character-variant>character-variant(<feature-value-name>#)</dfn>
4228 <dd>Enables display of specific character variants (<em>font
4229 specific</em>, OpenType feature: <span
4230 class=tag>cv<feature-index></span> OpenType currently defines <span
4231 class=tag>cv01</span> through <span class=tag>cv99</span>).
4233 <dt><dfn id=swashltfeature-value-namegt
4234 title=swash>swash(<feature-value-name>)</dfn>
4236 <dd>Enables display of swash glyphs (<em>font specific</em>, OpenType
4237 feature: <span class=tag>swsh <feature-index>, cswh
4238 <feature-index></span>).
4239 </dl>
4241 <div class=featex><img alt="swash example" src=swsh.png></div>
4243 <dl>
4244 <dt><dfn id=ornamentsltfeature-value-namegt
4245 title=ornaments>ornaments(<feature-value-name>)</dfn>
4247 <dd>Enables replacement of default glyphs with ornaments, if provided in
4248 the font (<em>font specific</em>, OpenType feature: <span class=tag>ornm
4249 <feature-index></span>). Some fonts may offer ornament glyphs as
4250 alternates for a wide collection of characters; however, displaying
4251 arbitrary characters (e.g., alphanumerics) as ornaments is poor practice
4252 as it distorts the semantics of the data. Font designers are encouraged
4253 to encode all ornaments (except those explicitly encoded in the Unicode
4254 Dingbats blocks, etc.) as alternates for the bullet character (U+2022) to
4255 allow authors to select the desired glyph using
4256 <feature-value-name>.
4257 </dl>
4259 <div class=featex><img alt="ornaments example" src=ornm.png></div>
4261 <dl>
4262 <dt><dfn id=annotationltfeature-value-namegt
4263 title=annotation>annotation(<feature-value-name>)</dfn>
4265 <dd>Enables display of alternate annotation forms (<em>font specific</em>,
4266 OpenType feature: <span class=tag>nalt <feature-index></span>).
4267 </dl>
4269 <div class=featex><img alt="alternate annotation form example"
4270 src=nalt.png></div>
4272 <h3 id=font-feature-values><span class=secno>6.9 </span>Defining font
4273 specific alternates: the <code>@font-feature-values</code> rule</h3>
4275 <p>Several of the possible values of ‘<a
4276 href="#propdef-font-variant-alternates"><code
4277 class=property>font-variant-alternates</code></a>’ listed above are
4278 labeled as "font specific". For these features fonts may define not just a
4279 single glyph but a set of alternate glyphs with an index to select a given
4280 alternate. Since these are font family specific, the
4281 <code>@font-feature-values</code> rule is used to define named-values for
4282 these indices for a given family.
4284 <p>In the case of the swash Q in the example shown above, the swash could
4285 be specified using these style rules:
4287 <pre>
4289 @font-feature-values Jupiter Sans {
4290 @swash {
4291 delicate: 1;
4292 flowing: 2;
4293 }
4294 }
4296 h2 { font-family: Jupiter Sans, sans-serif; }
4298 /* show the second swash variant in h2 headings */
4299 h2:first-letter { font-variant-alternates: swash(flowing); }
4301 <h2>Quick</h2></pre>
4303 <p>When Jupiter Sans is present, the second alternate swash alternate will
4304 be displayed. When not present, no swash character will be shown, since
4305 the specific named-value "flowing" is only defined for the Jupiter Sans
4306 family. The @-mark indicates the name of the property value for which a
4307 named-value can be used. The name "flowing" is chosen by the author, the
4308 values specified within a given font's data.
4310 <p>In terms of the grammar, this specification defines the following
4311 productions:
4313 <pre><dfn id=fontfeaturevaluesrule>font_feature_values_rule</dfn>
4314 : FONT_FEATURE_VALUES_SYM S* font_family_name_list S*
4315 '{' S* feature_value_block? [ S* feature_value_block? ]* '}' S*
4316 ;
4318 <dfn id=fontfamilynamelist>font_family_name_list</dfn>
4319 : font_family_name [ S* ',' S* font_family_name ]*
4320 ;
4322 <dfn id=fontfamilyname>font_family_name</dfn>
4323 : STRING | [ IDENT [ S* IDENT ]* ]
4324 ;
4326 <dfn id=featurevalueblock>feature_value_block</dfn>
4327 : feature_type S*
4328 '{' S* feature_value_definition? [ S* ';' S* feature_value_definition? ]* '}' S*
4329 ;
4331 <dfn id=featuretype>feature_type</dfn>:
4332 ATKEYWORD
4333 ;
4335 <dfn id=featurevaluedefinition>feature_value_definition</dfn>
4336 : IDENT S* ':' S* NUMBER [ S* NUMBER ]*
4337 ;
4338 </pre>
4340 <p>The following new token is introduced:
4342 <pre>@{F}{O}{N}{T}{-}{F}{E}{A}{T}{U}{R}{E}{-}{V}{A}{L}{U}{E}{S} {return FONT_FEATURE_VALUES_SYM;}
4343 </pre>
4345 <p>Feature value blocks are treated <a
4346 href="http://www.w3.org/TR/CSS2/syndata.html#at-rules">similar to
4347 at-rules</a>, they consist of everything up to the next block or
4348 semi-colon, whichever comes first.
4350 <p>Font feature values rules define a set of values for a specific font
4351 feature as used for a given set of families. Effectively, they define a
4352 mapping of ⟨family, feature, ident⟩ → ⟨values⟩ where
4353 ⟨values⟩ are the indices used for specific features defined for a
4354 given font.
4356 <p>The font family list uses the same syntax as that used for the ‘<a
4357 href="#descdef-font-family"><code class=property>font-family</code></a>’
4358 property. Within feature value blocks, the feature type is ‘<code
4359 class=css>@</code>’ followed by the name of the font-specific property
4360 value (e.g. <a
4361 href="#swashltfeature-value-namegt"><code>@swash</code></a>). The feature
4362 type must match, using an ASCII case-insensitive comparison, one of the
4363 <em>font specific</em> values of the <a
4364 href="#propdef-font-variant-alternates"><code>font-variant-alternates</code></a>
4365 property. The values associated with a given idenitifier are limited to
4366 integer values 0 or greater.
4368 <p>If syntax errors occur within the font family list, the entire rule must
4369 be ignored. When syntax errors occur within a feature value definition,
4370 such as invalid identifiers or values, the entire feature value definition
4371 must be omitted, similar to the way syntax errors in style declarations
4372 are handled. When the <code><feature-type></code> is invalid, the
4373 entire associated feature value block must be ignored.
4375 <pre>@font-feature-values Bongo {
4376 @swash { ornate: 1; }
4377 annotation { boxed: 4; } /* should be @annotation! */
4378 @swash { double-loops: 1; flowing: -1; } /* negative value */
4379 @ornaments ; /* incomplete definition */
4380 @styleset { double-W: 14; sharp-terminals: 16 1 } /* missing ; */
4381 <a href="http://www.angryalien.com/0504/shiningbunnies.html" style="text-decoration: none;">redrum</a> /* random editing mistake */
4382 }</pre>
4384 <p>The example above is equivalent to:
4386 <pre>@font-feature-values Bongo {
4387 @swash { ornate: 1; }
4388 @swash { double-loops: 1; }
4389 @styleset { double-W: 14; sharp-terminals: 16 1; }
4390 }</pre>
4392 <p>If multiple <code>@font-feature-values</code> rules are defined for a
4393 given family, the resulting values defined are the union of these rules.
4394 This allows a set of named-values to be defined for a given font family
4395 globally for a site and specific additions made per-page. If the same
4396 <feature-value-name> is defined mulitple times for a given
4397 font-variant value, the last defined value is used.
4399 <pre>
4400 site.css:
4402 @font-feature-values Mercury Serif {
4403 @styleset {
4404 stacked-g: 3; /* "two-storey" versions of g, a */
4405 stacked-a: 4;
4406 }
4407 }
4409 page.css:
4411 @font-feature-values Mercury Serif {
4412 @styleset {
4413 geometric-m: 7; /* alternate version of m */
4414 }
4415 }
4417 body {
4418 font-family: Mercury Serif, serif;
4420 /* enable both the use of stacked g and alternate m */
4421 font-variant-alternates: styleset(stacked-g, geometric-m);
4422 }</pre>
4424 <p>Only named font families are allowed for <font-family>, rules that
4425 include generic or system fonts in the list of font families are
4426 considered syntax errors and the contents of the rules are ignored.
4427 However, if a user agent defines a generic font to be a specific named
4428 font (e.g. Helvetica), the settings associated with that family name will
4429 be used.
4431 <p>For <font-variant-property-value>, only font specific property value
4432 names supported by the ‘<a href="#propdef-font-variant"><code
4433 class=property>font-variant</code></a>’ property are recognized,
4434 definitions for other value names cause a syntax error and are ignored.
4435 Each property value that is font specific is clearly marked as such.
4436 Feature value names follow the rules of CSS user identifiers and are
4437 case-sensitive. They are unique only for a given set of font families and
4438 font-variant property value; the same identifier used with a different
4439 font-variant property value is treated as a separate and distinct value.
4441 <p>Using a commonly named value allows authors to use a single style rule
4442 to cover a set of fonts for which the underlying selector is different for
4443 each font. If either font in the example below is found, a circled number
4444 glyph will be used:
4446 <pre>@font-feature-values Taisho Gothic {
4447 @annotation { boxed: 1; circled: 4; }
4448 }
4450 @font-feature-values Otaru Kisa {
4451 @annotation { circled: 1; black-boxed: 3; }
4452 }
4454 h3.title {
4455 /* circled form defined for both fonts */
4456 font-family: Taisho Gothic, Otaru Kisa;
4457 font-variant: annotation(circled);
4458 }</pre>
4460 <p>Most font specific font-variant property values take a single value
4461 (e.g. swash). The character-variant property value allows two values and
4462 styleset allows an unlimited number. If a larger number of values are
4463 assigned to a given name, a syntax error occurs and the entire
4464 <font-feature-values-declaration> is ignored.
4466 <p>For the styleset property value, multiple values indicate the style sets
4467 to be enabled. Values between 1 and 99 enable OpenType features <span
4468 class=tag>ss01</span> through <span class=tag>ss99</span>. However, the
4469 OpenType standard only officially defines <span class=tag>ss01</span>
4470 through <span class=tag>ss20</span>. Values greater than 99 or equal to 0
4471 are ignored but do not generate a syntax error when parsed.
4473 <pre>@font-feature-values Mars Serif {
4474 @styleset {
4475 alt-g: 1; /* implies ss01 = 1 */
4476 curly-quotes: 3; /* implies ss03 = 1 */
4477 code: 4 5; /* implies ss04 = 1, ss05 = 1 */
4478 }
4480 @styleset {
4481 dumb: 125; /* >99, ignored */
4482 }
4484 @swash {
4485 swishy: 3 5; /* more than 1 value for swash, syntax error */
4486 }
4487 }
4489 p.codeblock {
4490 /* implies ss03 = 1, ss04 = 1, ss05 = 1 */
4491 font-variant-alternates: styleset(curly-quotes, code);
4492 }</pre>
4494 <p>For character-variant, a single value between 1 and 99 indicates the
4495 enabling of OpenType feature <span class=tag>cv01</span> through <span
4496 class=tag>cv99</span>. For OpenType fonts, values greater than 99 or equal
4497 to 0 are ignored but do not generate a syntax error when parsed. When two
4498 values are listed, the first value indicates the feature used and the
4499 second the value passed for that feature. When two value names imply
4500 different settings for the same underlying feature the last setting is
4501 used.
4503 <pre>@font-feature-values MM Greek {
4504 @character-variant { alpha-2: 1 2; } /* implies cv01 = 2 */
4505 @character-variant { beta-3: 2 3; } /* implies cv02 = 3 */
4506 @character-variant { epsilon: 5 3 6; } /* more than 2 values, syntax error, ignored */
4507 @character-variant { gamma: 12; } /* implies cv12 = 1 */
4508 @character-variant { zeta: 20 3; } /* implies cv20 = 3 */
4509 @character-variant { zeta-2: 20 2; } /* implies cv20 = 2 */
4510 @character-variant { silly: 105; } /* >99, ignored */
4511 @character-variant { dumb: 323 3; } /* >99, ignored */
4512 }
4514 #title {
4515 /* use the third alternate beta, first alternate gamma */
4516 font-variant-alternates: character-variant(beta-3, gamma);
4517 }
4519 p {
4520 /* zeta-2 follows zeta, implies cv20 = 2 */
4521 font-variant-alternates: character-variant(zeta, zeta-2);
4522 }
4524 .special {
4525 /* zeta follows zeta-2, implies cv20 = 3 */
4526 font-variant-alternates: character-variant(zeta-2, zeta);
4527 }</pre>
4529 <p>See the <a href="#om-fontfeaturevalues">object model reference
4530 section</a> for a description of the interfaces used to modify these rules
4531 via the CSS Object Model.
4533 <div class=figure><img alt="Matching text on Byzantine seals using
4534 character variants" src=byzantineseal.png>
4535 <p class=caption>Byzantine seal text displayed with character variants
4536 </div>
4538 <div class=example>
4539 <p>In the figure above, the text in red is rendered using a font
4540 containing character variants that mimic the character forms found on a
4541 Byzantine seal from the 8th century A.D. Two lines below is the same text
4542 displayed in a font without variants. Note the two variants for U and N
4543 used on the seal.</p>
4545 <pre>@font-feature-values Athena Ruby {
4546 @character-variant {
4547 leo-B: 2 1;
4548 leo-M: 13 3;
4549 leo-alt-N: 14 1;
4550 leo-N: 14 2;
4551 leo-T: 20 1;
4552 leo-U: 21 2;
4553 leo-alt-U: 21 4;
4554 }
4555 }
4557 p {
4558 font-variant: discretionary-ligatures,
4559 character-variant(leo-B, leo-M, leo-N, leo-T, leo-U);
4560 }
4562 span.alt-N {
4563 font-variant-alternates: character-variant(leo-alt-N);
4564 }
4566 span.alt-U {
4567 font-variant-alternates: character-variant(leo-alt-U);
4568 }
4570 <p>ENO....UP͞RSTU<span class="alt-U">U</span>͞<span class="alt-U">U</span>ΚΑΙTỤẠG̣IUPNS</p>
4572 <p>LEON|ΚΑΙCONSTA|NTI<span class="alt-N">N</span>OS..|STOIBAṢ.|LIṢROM|AIO<span class="alt-N">N</span></p>
4573 </pre>
4574 </div>
4576 <h3 id=font-variant-east-asian-prop><span class=secno>6.10 </span>East
4577 Asian text rendering: the <a
4578 href="#propdef-font-variant-east-asian">font-variant-east-asian</a>
4579 property</h3>
4581 <table class=propdef id=namefont-variant-east-asianvaluenormal-l>
4582 <tbody>
4583 <tr>
4584 <td>Name:
4586 <td><dfn
4587 id=propdef-font-variant-east-asian>font-variant-east-asian</dfn>
4589 <tr>
4590 <td>Value:
4592 <td>normal | [ <east-asian-variant-values> ||
4593 <east-asian-width-values> || ruby ]
4595 <tr>
4596 <td>Initial:
4598 <td>normal
4600 <tr>
4601 <td>Applies to:
4603 <td>all elements
4605 <tr>
4606 <td>Inherited:
4608 <td>yes
4610 <tr>
4611 <td>Percentages:
4613 <td>N/A
4615 <tr>
4616 <td>Media:
4618 <td>visual
4620 <tr>
4621 <td>Computed value:
4623 <td>as specified
4625 <tr>
4626 <td>Animatable:
4628 <td>no
4629 </table>
4631 <p>Allows control of glyph substitution and sizing in East Asian text.
4633 <pre
4634 class=prod><dfn id=lteast-asian-variant-valuesgt><var><east-asian-variant-values></var></dfn> = [ jis78 | jis83 | jis90 | jis04 | simplified | traditional ]</pre>
4636 <pre
4637 class=prod><dfn id=lteast-asian-width-valuesgt><var><east-asian-width-values></var></dfn> = [ full-width | proportional-width ]</pre>
4639 <p>Individual values have the following meanings:
4641 <dl>
4642 <dt><dfn id=normal2>normal</dfn>
4644 <dd>None of the features listed below are enabled.
4646 <dt><dfn id=jis78>jis78</dfn>
4648 <dd>Enables rendering of JIS78 forms (OpenType feature: <span
4649 class=tag>jp78</span>).
4650 </dl>
4652 <div class=featex><img alt="JIS78 form example" src=jp78.png></div>
4654 <dl>
4655 <dt><dfn id=jis83>jis83</dfn>
4657 <dd>Enables rendering of JIS83 forms (OpenType feature: <span
4658 class=tag>jp83</span>).
4660 <dt><dfn id=jis90>jis90</dfn>
4662 <dd>Enables rendering of JIS90 forms (OpenType feature: <span
4663 class=tag>jp90</span>).
4665 <dt><dfn id=jis04>jis04</dfn>
4667 <dd>Enables rendering of JIS2004 forms (OpenType feature: <span
4668 class=tag>jp04</span>).
4669 <p>The various JIS variants reflect the glyph forms defined in different
4670 Japanese national standards. Fonts generally include glyphs defined by
4671 the most recent national standard but it's sometimes necessary to use
4672 older variants, to match signage for example.</p>
4674 <dt><dfn id=simplified>simplified</dfn>
4676 <dd>Enables rendering of simplified forms (OpenType feature: <span
4677 class=tag>smpl</span>).
4678 <p>The ‘<a href="#simplified"><code
4679 class=property>simplified</code></a>’ and ‘<a
4680 href="#traditional"><code class=property>traditional</code></a>’
4681 values allow control over the glyph forms for characters which have been
4682 simplified over time but for which the older, traditional form is still
4683 used in some contexts. The exact set of characters and glyph forms will
4684 vary to some degree by context for which a given font was designed.</p>
4686 <dt><dfn id=traditional>traditional</dfn>
4688 <dd>Enables rendering of traditional forms (OpenType feature: <span
4689 class=tag>trad</span>).
4690 </dl>
4692 <div class=featex><img alt="tradtional form example" src=trad.png></div>
4694 <dl>
4695 <dt><dfn id=full-width>full-width</dfn>
4697 <dd>Enables rendering of full-width variants (OpenType feature: <span
4698 class=tag>fwid</span>).
4700 <dt><dfn id=proportional-width>proportional-width</dfn>
4702 <dd>Enables rendering of proportionally-spaced variants (OpenType feature:
4703 <span class=tag>pwid</span>).
4704 </dl>
4706 <div class=featex><img alt="proportionally spaced Japanese example"
4707 src=pwid.png></div>
4709 <dl>
4710 <dt><dfn id=ruby>ruby</dfn>
4712 <dd>Enables display of ruby variant glyphs (OpenType feature: <span
4713 class=tag>ruby</span>). Since ruby text is generally smaller than the
4714 associated body text, font designers can design special glyphs for use
4715 with ruby that are more readable than scaled down versions of the default
4716 glyphs. Only glyph selection is affected, there is no associated font
4717 scaling or other change that affects line layout. The red ruby text below
4718 is shown with default glyphs (top) and with ruby variant glyphs (bottom).
4719 Note the slight difference in stroke thickness.
4720 </dl>
4722 <div class=featex><img alt="ruby variant example" src=rubyshinkansen.png></div>
4724 <h3 id=font-variant-prop><span class=secno>6.11 </span>Overall shorthand
4725 for font rendering: the <a href="#propdef-font-variant">font-variant</a>
4726 property</h3>
4728 <table class=propdef id=namefont-variantvaluenormal-none-ltcommo>
4729 <tbody>
4730 <tr>
4731 <td>Name:
4733 <td><dfn id=propdef-font-variant>font-variant</dfn>
4735 <tr>
4736 <td>Value:
4738 <td>normal | none | [ <common-lig-values> ||
4739 <discretionary-lig-values> || <historical-lig-values> ||
4740 <contextual-alt-values> || stylistic(<feature-value-name>)
4741 || historical-forms || styleset(<feature-value-name>#) ||
4742 character-variant(<feature-value-name>#) ||
4743 swash(<feature-value-name>) ||
4744 ornaments(<feature-value-name>) ||
4745 annotation(<feature-value-name>) || [ small-caps | all-small-caps
4746 | petite-caps | all-petite-caps | unicase | titling-caps ] ||
4747 <numeric-figure-values> || <numeric-spacing-values> ||
4748 <numeric-fraction-values> || ordinal || slashed-zero ||
4749 <east-asian-variant-values> || <east-asian-width-values> ||
4750 ruby ]
4752 <tr>
4753 <td>Initial:
4755 <td>normal
4757 <tr>
4758 <td>Applies to:
4760 <td>all elements
4762 <tr>
4763 <td>Inherited:
4765 <td>yes
4767 <tr>
4768 <td>Percentages:
4770 <td>see individual properties
4772 <tr>
4773 <td>Media:
4775 <td>visual
4777 <tr>
4778 <td>Computed value:
4780 <td>see individual properties
4782 <tr>
4783 <td>Animatable:
4785 <td>see individual properties
4786 </table>
4788 <p>The value ‘<a href="#normal2"><code
4789 class=property>normal</code></a>’ resets all other font feature
4790 properties to their inital value. The ‘<code
4791 class=property>none</code>’ value sets ‘<a
4792 href="#propdef-font-variant-ligatures"><code
4793 class=property>font-variant-ligatures</code></a>’ to ‘<code
4794 class=property>none</code>’ and resets all other font feature properties
4795 to their initial value. Like other shorthands, using ‘<a
4796 href="#propdef-font-variant"><code
4797 class=property>font-variant</code></a>’ resets unspecified font-variant
4798 subproperties to their initial values. It does not reset the values of
4799 either ‘<a href="#propdef-font-language-override"><code
4800 class=property>font-language-override</code></a>’ or ‘<a
4801 href="#propdef-font-feature-settings"><code
4802 class=property>font-feature-settings</code></a>’.
4804 <h3 id=font-feature-settings-prop><span class=secno>6.12 </span>Low-level
4805 font feature settings control: the <a
4806 href="#propdef-font-feature-settings">font-feature-settings</a> property</h3>
4808 <table class=propdef id=namefont-feature-settingsvaluenormal-ltf>
4809 <tbody>
4810 <tr>
4811 <td>Name:
4813 <td><dfn id=propdef-font-feature-settings>font-feature-settings</dfn>
4815 <tr>
4816 <td>Value:
4818 <td>normal | <feature-tag-value>#
4820 <tr>
4821 <td>Initial:
4823 <td>normal
4825 <tr>
4826 <td>Applies to:
4828 <td>all elements
4830 <tr>
4831 <td>Inherited:
4833 <td>yes
4835 <tr>
4836 <td>Percentages:
4838 <td>N/A
4840 <tr>
4841 <td>Media:
4843 <td>visual
4845 <tr>
4846 <td>Computed value:
4848 <td>as specified
4850 <tr>
4851 <td>Animatable:
4853 <td>no
4854 </table>
4856 <p>This property provides low-level control over OpenType font features. It
4857 is intended as a way of providing access to font features that are not
4858 widely used but are needed for a particular use case. A value of ‘<a
4859 href="#normal2"><code class=property>normal</code></a>’ means that no
4860 change in glyph selection or positioning occurs due to this property.
4862 <p>
4864 <pre>/* enable small caps and use second swash alternate */
4865 font-feature-settings: "smcp", "swsh" 2;</pre>
4867 <p>Feature tag values have the following syntax:
4869 <pre
4870 class=prod><dfn id=ltfeature-tag-valuegt><var><feature-tag-value></var></dfn> = <string> [ <integer> | on | off ]?</pre>
4872 <p>The <string> is a case-sensitive OpenType feature tag. As
4873 specified in the OpenType specification, feature tags contain four ASCII
4874 characters. Tag strings longer or shorter than four characters, or
4875 containing characters outside the U+20–7E codepoint range are invalid.
4876 User agents must not use a feature tag created by truncating or padding
4877 the string to four characters. Feature tags need only match a feature tag
4878 defined in the font, they are not limited to explicitly registered
4879 OpenType features. Fonts defining custom feature tags should follow the <a
4880 href="http://www.microsoft.com/typography/otspec/featuretags.htm">tag name
4881 rules</a> defined in the OpenType specification <a
4882 href="#OPENTYPE-FEATURES"
4883 rel=biblioentry>[OPENTYPE-FEATURES]<!--{{!OPENTYPE-FEATURES}}--></a>.
4884 Feature tags not present in the font are ignored; a user agent must not
4885 attempt to synthesize fallback behavior based on these feature tags.
4887 <p>This means that explicitly disabling the <span class=tag>kern</span>
4888 feature will not affect the application of kerning data found in the
4889 ‘<code class=property>kern</code>’ table (as opposed to kerning data
4890 associated with the <span class=tag>kern</span> feature in the ‘<code
4891 class=property>GPOS</code>’ table). Authors should use the ‘<a
4892 href="#propdef-font-kerning"><code
4893 class=property>font-kerning</code></a>’ property to explictly enable or
4894 disable kerning since this property affects both types of kerning.
4896 <p>If present, a value indicates an index used for glyph selection. An
4897 <integer> value must be 0 or greater. A value of 0 indicates that
4898 the feature is disabled. For boolean features, a value of 1 enables the
4899 feature. For non-boolean features, a value of 1 or greater enables the
4900 feature and indicates the feature selection index. A value of ‘<code
4901 class=property>on</code>’ is synonymous with 1 and ‘<code
4902 class=property>off</code>’ is synonymous with 0. If the value is
4903 omitted, a value of 1 is assumed.
4905 <pre>
4906 font-feature-settings: "dlig" 1; /* dlig=1 enable discretionary ligatures */
4907 font-feature-settings: "smcp" on; /* smcp=1 enable small caps */
4908 font-feature-settings: 'c2sc'; /* c2sc=1 enable caps to small caps */
4909 font-feature-settings: "liga" off; /* liga=0 no common ligatures */
4910 font-feature-settings: "tnum", 'hist'; /* tnum=1, hist=1 enable tabular numbers and historical forms */
4911 font-feature-settings: "tnum" "hist"; /* invalid, need a comma-delimited list */
4912 font-feature-settings: "palin" off; /* good idea but invalid tagname */
4913 font-feature-settings: "PKRN"; /* PKRN=1 enable custom feature */
4914 font-feature-settings: dlig; /* invalid, tag must be a string */
4915 </pre>
4917 <p>Authors should generally use ‘<a href="#propdef-font-variant"><code
4918 class=property>font-variant</code></a>’ and its related subproperties
4919 whenever possible and only use this property for special cases where its
4920 use is the only way of accessing a particular infrequently used font
4921 feature.
4923 <p>Although specifically defined for OpenType feature tags, feature tags
4924 for other modern font formats that support font features may be added in
4925 the future. Where possible, features defined for other font formats should
4926 attempt to follow the pattern of registered OpenType tags.
4928 <div class=example>
4929 <p>The Japanese text below will be rendered with half-width kana
4930 characters:</p>
4932 <pre lang=ja>
4933 body { font-feature-settings: "hwid"; /* Half-width OpenType feature */ }
4935 <p>毎日<a href="http://images.google.com/images?q=%E3%82%AB%E3%83%AC%E3%83%BC" style="text-decoration: none;">カレー</a>食べてるのに、飽きない</p>
4936 </pre>
4937 </div>
4939 <h3 id=font-language-override-prop><span class=secno>6.13 </span>Font
4940 language override: the <a
4941 href="#propdef-font-language-override">font-language-override</a> property</h3>
4943 <table class=propdef id=namefont-language-overridevaluenormal-lt>
4944 <tbody>
4945 <tr>
4946 <td>Name:
4948 <td><dfn id=propdef-font-language-override>font-language-override</dfn>
4950 <tr>
4951 <td>Value:
4953 <td>normal | <string>
4955 <tr>
4956 <td>Initial:
4958 <td>normal
4960 <tr>
4961 <td>Applies to:
4963 <td>all elements
4965 <tr>
4966 <td>Inherited:
4968 <td>yes
4970 <tr>
4971 <td>Percentages:
4973 <td>N/A
4975 <tr>
4976 <td>Media:
4978 <td>visual
4980 <tr>
4981 <td>Computed value:
4983 <td>as specified
4985 <tr>
4986 <td>Animatable:
4988 <td>no
4989 </table>
4991 <p>The value of ‘<a href="#normal2"><code
4992 class=property>normal</code></a>’ implies that when rendering with
4993 OpenType fonts the language of the document is used to infer the OpenType
4994 language system, used to select language specific features when rendering.
4995 The value of the <string> is a single three-letter OpenType <a
4996 href="http://www.microsoft.com/typography/otspec/languagetags.htm">language
4997 system tag</a>, defined in the layout tag registry of the OpenType
4998 specification.
5000 <div class=example>
5001 <p>The <a href="http://www.un.org/en/documents/udhr/index.shtml">Universal
5002 Declaration of Human Rights</a> has been translated into a wide variety
5003 of languages. In Turkish, Article 9 of this document might be marked up
5004 as below:</p>
5006 <pre lang=tr><body lang="tr">
5008 <h4>Madde 9</h4>
5009 <p>Hiç kimse keyfi olarak tutuklanamaz, alıkonulanamaz veya sürülemez.</p>
5010 </pre>
5012 <p>Here the user agent uses the value of the ‘<code
5013 class=property>lang</code>’ attribute when rendering text and
5014 appropriately renders this text without ‘<code
5015 class=property>fi</code>’ ligatures. There is no need to use the ‘<a
5016 href="#propdef-font-language-override"><code
5017 class=property>font-language-override</code></a>’ property.</p>
5019 <p>However, a given font may lack support for a specific language. In this
5020 situation authors may need to use the typographic conventions of a
5021 related language that are supported by that font:</p>
5023 <pre lang=mk><body lang="mk"> <!-- Macedonian lang code -->
5025 body { font-language-override: "SRB"; /* Serbian OpenType language tag */ }
5027 <h4>Члeн 9</h4>
5028 <p>Никoj чoвeк нeмa дa бидe пoдлoжeн нa прoизвoлнo aпсeњe, притвoр или прoгoнувaњe.</p>
5030 </pre>
5032 <p>The Macedonian text here will be rendered using Serbian typographic
5033 conventions, with the assumption that the font specified supports
5034 Serbian.</p>
5035 </div>
5037 <p><a id=rendering-considerations></a>
5039 <h2 id=font-feature-resolution><span class=secno>7 </span>Font Feature
5040 Resolution</h2>
5042 <p>As described in the previous section, font features can be enabled in a
5043 variety of ways, either via the use of ‘<a
5044 href="#propdef-font-variant"><code
5045 class=property>font-variant</code></a>’ or ‘<a
5046 href="#propdef-font-feature-settings"><code
5047 class=property>font-feature-settings</code></a>’ in a style rule or
5048 within an <code>@font-face</code> rule. The resolution order for the union
5049 of these settings is defined below. Features defined via CSS properties
5050 are applied on top of layout engine default features.
5052 <h3 id=default-features><span class=secno>7.1 </span>Default features</h3>
5054 <p>For OpenType fonts, user agents must enable the default features defined
5055 in the OpenType documentation for a given script and writing mode.
5056 Required ligatures, common ligatures and contextual forms must be enabled
5057 by default (OpenType features: <span class=tag>rlig, liga, clig,
5058 calt</span>), along with localized forms (OpenType feature: <span
5059 class=tag>locl</span>), and features required for proper display of
5060 composed characters and marks (OpenType features: <span class=tag>ccmp,
5061 mark, mkmk</span>). These features must always be enabled, even when the
5062 value of the ‘<a href="#propdef-font-variant"><code
5063 class=property>font-variant</code></a>’ and ‘<a
5064 href="#propdef-font-feature-settings"><code
5065 class=property>font-feature-settings</code></a>’ properties is ‘<a
5066 href="#normal2"><code class=property>normal</code></a>’. Individual
5067 features are only disabled when explicitly overridden by the author, as
5068 when ‘<a href="#propdef-font-variant-ligatures"><code
5069 class=property>font-variant-ligatures</code></a>’ is set to ‘<a
5070 href="#no-common-ligatures"><code
5071 class=property>no-common-ligatures</code></a>’. For handling complex
5072 scripts such as <a
5073 href="http://www.microsoft.com/typography/otfntdev/arabicot/features.aspx">Arabic</a>,
5074 <a
5075 href="http://www.microsoft.com/typography/otfntdev/mongolot/features.htm">Mongolian</a>
5076 or <a
5077 href="http://www.microsoft.com/typography/otfntdev/devanot/features.aspx">Devanagari</a>
5078 additional features are required. For upright text within vertical text
5079 runs, vertical alternates (OpenType feature: <span class=tag>vert</span>)
5080 must be enabled.
5082 <h3 id=feature-precedence><span class=secno>7.2 </span>Feature precedence</h3>
5084 <p>General and font specific font feature property settings are resolved in
5085 the order below, in ascending precedence order. This ordering is used to
5086 construct a combined list of font features that affect a given text run.
5088 <ol>
5089 <li>Font features enabled by default, including features required for a
5090 given script.
5092 <li>If the font is defined via an <code>@font-face</code> rule, the font
5093 features implied by the font-variant descriptor in the
5094 <code>@font-face</code> rule.
5096 <li>If the font is defined via an <code>@font-face</code> rule, the font
5097 features implied by the font-feature-settings descriptor in the
5098 <code>@font-face</code> rule.
5100 <li>Feature settings determined by properties other than ‘<a
5101 href="#propdef-font-variant"><code
5102 class=property>font-variant</code></a>’ or ‘<a
5103 href="#propdef-font-feature-settings"><code
5104 class=property>font-feature-settings</code></a>’. For example, setting
5105 a non-default value for the ‘<code
5106 class=property>letter-spacing</code>’ property disables ligatures.
5108 <li>Font features implied by the value of the ‘<a
5109 href="#propdef-font-variant"><code
5110 class=property>font-variant</code></a>’ property, the related
5111 font-variant subproperties and any other CSS property that may use
5112 OpenType features (e.g. the ‘<a href="#propdef-font-kerning"><code
5113 class=property>font-kerning</code></a>’ property).
5115 <li>Font features implied by the value of ‘<a
5116 href="#propdef-font-feature-settings"><code
5117 class=property>font-feature-settings</code></a>’ property.
5118 </ol>
5120 <p>This ordering allows authors to set up a general set of defaults for
5121 fonts within their <code>@font-face</code> rules, then override them with
5122 property settings for specific elements. General property settings
5123 override the settings in <code>@font-face</code> rules and low-level font
5124 feature settings override ‘<a href="#propdef-font-variant"><code
5125 class=property>font-variant</code></a>’ property settings.
5127 <p>For situations where the combined list of font feature settings contains
5128 more than one value for the same feature, the last value is used. When a
5129 font lacks support for a given underlying font feature, text is simply
5130 rendered as if that font feature was not enabled; font fallback does not
5131 occur and no attempt is made to synthesize the feature except where
5132 explicitly noted for specific properties.
5134 <h3 id=feature-precedence-examples><span class=secno>7.3 </span>Feature
5135 precedence examples</h3>
5137 <div class=example>
5138 <p>With the styles below, numbers are rendered proportionally when used
5139 within a paragraph but are shown in tabular form within tables of prices:</p>
5141 <pre>body {
5142 font-variant-numeric: proportional-nums;
5143 }
5145 table.prices td {
5146 font-variant-numeric: tabular-nums;
5147 }
5148 </pre>
5149 </div>
5151 <div class=example>
5152 <p>When the font-variant descriptor is used within an
5153 <code>@font-face</code> rule, it only applies to the font defined by that
5154 rule.</p>
5156 <pre>@font-face {
5157 font-family: MainText;
5158 src: url(http://example.com/font.ttf);
5159 font-variant: oldstyle-nums proportional-nums styleset(1,3);
5160 }
5162 body {
5163 font-family: MainText, Helvetica;
5164 }
5166 table.prices td {
5167 font-variant-numeric: tabular-nums;
5168 }
5169 </pre>
5171 <p>In this case, old-style numerals will be used throughout but only where
5172 the font "MainText" is used. Just as in the previous example, tabular
5173 values will be used in price tables since ‘<a
5174 href="#tabular-nums"><code class=property>tabular-nums</code></a>’
5175 appears in a general style rule and its use is mutually exclusive with
5176 ‘<a href="#proportional-nums"><code
5177 class=property>proportional-nums</code></a>’. Stylistic alternate sets
5178 will only be used where MainText is used.</p>
5179 </div>
5181 <div class=example>
5182 <p>The <code>@font-face</code> rule can also be used to access font
5183 features in locally available fonts via the use of local() in the ‘<a
5184 href="#descdef-src"><code class=property>src</code></a>’ descriptor of
5185 the <code>@font-face</code> definition:</p>
5187 <pre>@font-face {
5188 font-family: BodyText;
5189 src: local("HiraMaruPro-W4");
5190 font-variant: proportional-width;
5191 font-feature-settings: "ital"; /* Latin italics within CJK text feature */
5192 }
5194 body { font-family: BodyText, serif; }
5195 </pre>
5197 <p>If available, a Japanese font "Hiragino Maru Gothic" will be used. When
5198 text rendering occurs, Japanese kana will be proportionally spaced and
5199 Latin text will be italicised. Text rendered with the fallback serif font
5200 will use default rendering properties.</p>
5201 </div>
5203 <div class=example>
5204 <p>In the example below, discretionary ligatures are enabled only for a
5205 downloadable font but are disabled within spans of class "special":</p>
5207 <pre>@font-face {
5208 font-family: main;
5209 src: url(fonts/ffmeta.woff) format("woff");
5210 font-variant: discretionary-ligatures;
5211 }
5213 body { font-family: main, Helvetica; }
5214 span.special { font-variant-ligatures: no-discretionary-ligatures; }
5215 </pre>
5217 <p>Adding an discretionary style rule with the <code>@font-face</code>
5218 above:</p>
5220 <pre>body { font-family: main, Helvetica; }
5221 span { font-feature-settings: "dlig"; }
5222 span.special { font-variant-ligatures: no-discretionary-ligatures; }
5223 </pre>
5225 <p>Within spans of class "special", discretionary ligatures <em>will</em>
5226 be rendered. This is because both the ‘<a
5227 href="#propdef-font-feature-settings"><code
5228 class=property>font-feature-settings</code></a>’ and ‘<a
5229 href="#propdef-font-variant-ligatures"><code
5230 class=property>font-variant-ligatures</code></a>’ properties apply to
5231 these spans. Although the ‘<code class=css>no-discretionary
5232 ligatures</code>’ setting of ‘<a
5233 href="#propdef-font-variant-ligatures"><code
5234 class=property>font-variant-ligatures</code></a>’ effectively disables
5235 the OpenType <span class=tag>dlig</span> feature, because the ‘<a
5236 href="#propdef-font-feature-settings"><code
5237 class=property>font-feature-settings</code></a>’ is resolved after
5238 that, the ‘<code class=property>dlig</code>’ value reenables
5239 discretionary ligatures.</p>
5240 </div>
5242 <h2 id=object-model><span class=secno>8 </span>Object Model</h2>
5244 <p>The contents of <code>@font-face</code> and
5245 <code>@font-feature-values</code> rules can be accessed via the following
5246 extensions to the CSS Object Model.
5248 <h3 id=om-fontface><span class=secno>8.1 </span>The <a
5249 href="#cssfontfacerule"><code>CSSFontFaceRule</code></a> interface</h3>
5251 <p>The <dfn id=cssfontfacerule>CSSFontFaceRule</dfn> interface represents a
5252 <code>@font-face</code> rule.
5254 <pre class=idl>
5255 interface CSSFontFaceRule : CSSRule {
5256 attribute DOMString family;
5257 attribute DOMString src;
5258 attribute DOMString style;
5259 attribute DOMString weight;
5260 attribute DOMString stretch;
5261 attribute DOMString unicodeRange;
5262 attribute DOMString variant;
5263 attribute DOMString featureSettings;
5264 }</pre>
5266 <p>The DOM Level 2 Style specification <a href="#DOM-LEVEL-2-STYLE"
5267 rel=biblioentry>[DOM-LEVEL-2-STYLE]<!--{{DOM-LEVEL-2-STYLE}}--></a>
5268 defined a different variant of this rule. This definition supercedes that
5269 one.
5271 <h3 id=om-fontfeaturevalues><span class=secno>8.2 </span>The <a
5272 href="#cssfontfeaturevaluesrule"><code>CSSFontFeatureValuesRule</code></a>
5273 interface</h3>
5275 <p>The <code>CSSRule</code> interface is extended as follows:
5277 <pre class=idl>partial interface CSSRule {
5278 const unsigned short FONT_FEATURE_VALUES_RULE = 14;
5279 }</pre>
5281 <p>The <dfn id=cssfontfeaturevaluesrule>CSSFontFeatureValuesRule</dfn>
5282 interface represents a <code>@font-feature-values</code> rule.
5284 <pre class=idl>interface CSSFontFeatureValuesRule : CSSRule {
5285 readonly attribute DOMString familyList;
5286 readonly attribute DOMString valueText;
5287 };</pre>
5289 <dl class=idl-attributes>
5290 <dt><var>familyList</var> of type <code>DOMString</code>, readonly
5292 <dd>The list of one or more font families for which a given set of feature
5293 values is defined.
5295 <dt><var>valueText</var> of type <code>DOMString</code>, readonly
5297 <dd>Serialized set of feature values.
5298 </dl>
5300 <h2 class=no-num id=platform-props-to-css>Appendix A: Mapping platform font
5301 properties to CSS properties</h2>
5303 <p><em>This appendix is included as background for some of the problems and
5304 situations that are described in other sections. It should be viewed as
5305 informative only.</em>
5307 <p>Font properties in CSS are designed to be independent of the underlying
5308 font formats used; they can be used to specify bitmap fonts, Type1 fonts,
5309 SVG fonts in addition to the common TrueType and OpenType fonts. But there
5310 are facets of the TrueType and OpenType formats that often cause confusion
5311 for authors and present challenges to implementers on different platforms.
5313 <p>Originally developed at Apple, TrueType was designed as an outline font
5314 format for both screen and print. Microsoft joined Apple in developing the
5315 TrueType format and both platforms have supported TrueType fonts since
5316 then. Font data in the TrueType format consists of a set of tables
5317 distinguished with common four-letter tag names, each containing a
5318 specific type of data. For example, naming information, including
5319 copyright and license information, is stored in the ‘<code
5320 class=property>name</code>’ table. The <a
5321 href="#character-map"><em>character map</em></a> (‘<code
5322 class=property>cmap</code>’) table contains a mapping of character
5323 encodings to glyphs. Apple later added additional tables for supporting
5324 enhanced typographic functionality; these are now called Apple Advanced
5325 Typography, or AAT, fonts. Microsoft and Adobe developed a separate set of
5326 tables for advanced typography and called their format OpenType <a
5327 href="#OPENTYPE" rel=biblioentry>[OPENTYPE]<!--{{!OPENTYPE}}--></a>.
5329 <p>In many cases the font data used under Microsoft Windows or Linux is
5330 slightly different from the data used under Apple's Mac OS X because the
5331 TrueType format allowed for explicit variation across platforms. This
5332 includes font metrics, names and <a href="#character-map"><em>character
5333 map</em></a> data.
5335 <p>Specifically, font family name data is handled differently across
5336 platforms. For TrueType and OpenType fonts these names are contained in
5337 the ‘<code class=property>name</code>’ table, in name records with
5338 name ID 1. Mulitple names can be stored for different locales but
5339 Microsoft recommends fonts always include at least a US English version of
5340 the name. On Windows, Microsoft made the decision for backwards
5341 compatibility to limit this family name to a maximum of four faces; for
5342 larger groupings the "preferred family" (name ID 16) or "WWS family" (name
5343 ID 21) can be used. Other platforms such as OSX don't have this
5344 limitation, the family name is used to define all possible groupings.
5346 <p>Other name table data provides names used to uniquely identify a
5347 specific face within a family. The full font name (name ID 4) and the
5348 Postscript name (name ID 6) describe a single face uniquely. The bold face
5349 of the Gill Sans family has a fullname of "Gill Sans Bold" and a
5350 Postscript name of "GillSans-Bold". There can be multiple localized
5351 versions of the fullname for a given face but the Postscript name is
5352 always a unique name made from a limited set of ASCII characters.
5354 <p>On various platforms, different names are used to search for a font. For
5355 example, with the Windows GDI CreateIndirectFont API, either a family or
5356 fullname can be used to lookup a face while on Mac OS X the
5357 CTFontCreateWithName API call is used to lookup a given face using the
5358 fullname and Postscript name. Under Linux, the fontconfig API allows fonts
5359 to be searched using any of these names. In situations where platform
5360 API's automatically substitute other font choices, it may be necessary to
5361 verify a returned font matches a given name.
5363 <p>The weight of a given face can be determined via the usWeightClass field
5364 of the OS/2 table or inferred from the style name (name ID 2). Likewise,
5365 the width can be determined via the usWidthClass of the OS/2 table or
5366 inferred from the style name. For historical reasons related to synthetic
5367 bolding at weights 200 or lower with the Windows GDI API, font designers
5368 have sometimes skewed values in the OS/2 table to avoid these weights.
5370 <p>Rendering complex scripts that use contextual shaping such as Thai,
5371 Arabic and Devanagari requires features present only in OpenType or AAT
5372 fonts. Currently, complex script rendering is supported on Windows and
5373 Linux using OpenType font features while both OpenType and AAT font
5374 features are used under Mac OS X.
5376 <h2 class=no-num id=ch-ch-ch-changes>Changes</h2>
5378 <h3 class=no-num id=recent-changes> Changes from the <a
5379 href="http://www.w3.org/TR/2013/WD-css3-fonts-20130212/">February 2013
5380 CSS3 Fonts Working Draft</a></h3>
5382 <p>Major changes include:
5384 <ul>
5385 <li>Moved font load events into a separate <a
5386 href="http://dev.w3.org/csswg/css3-font-load-events/">spec</a>
5388 <li>Tightened error handling rules for <code>@font-feature-values</code>
5389 rules
5391 <li>Added grammar productions for <code>@font-face</code> and
5392 <code>@font-feature-values</code> rules
5394 <li>Tightened definition of synthetic oblique
5395 </ul>
5397 <h2 class=no-num id=acknowledgments>Acknowledgments</h2>
5399 <p>I'd like to thank Tal Leming, Jonathan Kew and Christopher Slye for all
5400 their help and feedback. John Hudson was kind enough to take the time to
5401 explain the subtleties of OpenType language tags and provided the example
5402 of character variant usage for displaying text on Byzantine seals. Ken
5403 Lunde and Eric Muller provided valuable feedback on CJK OpenType features
5404 and Unicode variation selectors. The idea for supporting font features by
5405 using font-variant subproperties originated with Håkon Wium Lie, Adam
5406 Twardoch and Tal Leming. Elika Etemad supplied some of the initial design
5407 ideas for the <code>@font-feature-values</code> rule. Thanks also to House
5408 Industries for allowing the use of Ed Interlock in the discretionary
5409 ligatures example.
5411 <p>A special thanks to Robert Bringhurst for the sublime mind expansion
5412 that is <em>The Elements of Typographic Style</em>.
5414 <h2 class=no-num id=conformance> Conformance</h2>
5416 <h3 class=no-num id=conventions> Document Conventions</h3>
5418 <p>Conformance requirements are expressed with a combination of descriptive
5419 assertions and RFC 2119 terminology. The key words “MUST”, “MUST
5420 NOT”, “REQUIRED”, “SHALL”, “SHALL NOT”, “SHOULD”,
5421 “SHOULD NOT”, “RECOMMENDED”, “MAY”, and “OPTIONAL” in the
5422 normative parts of this document are to be interpreted as described in RFC
5423 2119. However, for readability, these words do not appear in all uppercase
5424 letters in this specification.
5426 <p>All of the text of this specification is normative except sections
5427 explicitly marked as non-normative, examples, and notes. <a
5428 href="#RFC2119" rel=biblioentry>[RFC2119]<!--{{!RFC2119}}--></a>
5430 <p>Examples in this specification are introduced with the words “for
5431 example” or are set apart from the normative text with
5432 <code>class="example"</code>, like this:
5434 <div class=example>
5435 <p>This is an example of an informative example.
5436 </div>
5438 <p>Informative notes begin with the word “Note” and are set apart from
5439 the normative text with <code>class="note"</code>, like this:
5441 <p class=note>Note, this is an informative note.
5443 <h3 class=no-num id=conformance-classes> Conformance Classes</h3>
5445 <p>Conformance to CSS Fonts Level 3 Module is defined for three conformance
5446 classes:
5448 <dl>
5449 <dt><dfn id=style-sheet title="style sheet!!as conformance class">style
5450 sheet</dfn>
5452 <dd>A <a href="http://www.w3.org/TR/CSS21/conform.html#style-sheet">CSS
5453 style sheet</a>.
5455 <dt><dfn id=renderer>renderer</dfn>
5457 <dd>A <a href="http://www.w3.org/TR/CSS21/conform.html#user-agent">UA</a>
5458 that interprets the semantics of a style sheet and renders documents that
5459 use them.
5461 <dt><dfn id=authoring-tool>authoring tool</dfn>
5463 <dd>A <a href="http://www.w3.org/TR/CSS21/conform.html#user-agent">UA</a>
5464 that writes a style sheet.
5465 </dl>
5467 <p>A style sheet is conformant to CSS Fonts Level 3 Module if all of its
5468 declarations that use properties defined in this module have values that
5469 are valid according to the generic CSS grammar and the individual grammars
5470 of each property as given in this module.
5472 <p>A renderer is conformant to CSS Fonts Level 3 Module if, in addition to
5473 interpreting the style sheet as defined by the appropriate specifications,
5474 it supports all the features defined by CSS Fonts Level 3 Module by
5475 parsing them correctly and rendering the document accordingly. However,
5476 the inability of a UA to correctly render a document due to limitations of
5477 the device does not make the UA non-conformant. (For example, a UA is not
5478 required to render color on a monochrome monitor.)
5480 <p>An authoring tool is conformant to CSS Fonts Level 3 Module if it writes
5481 style sheets that are syntactically correct according to the generic CSS
5482 grammar and the individual grammars of each feature in this module, and
5483 meet all other conformance requirements of style sheets as described in
5484 this module.
5486 <h3 class=no-num id=partial> Partial Implementations</h3>
5488 <p>So that authors can exploit the forward-compatible parsing rules to
5489 assign fallback values, CSS renderers <strong>must</strong> treat as
5490 invalid (and <a
5491 href="http://www.w3.org/TR/CSS21/conform.html#ignore">ignore as
5492 appropriate</a>) any at-rules, properties, property values, keywords, and
5493 other syntactic constructs for which they have no usable level of support.
5494 In particular, user agents <strong>must not</strong> selectively ignore
5495 unsupported component values and honor supported values in a single
5496 multi-value property declaration: if any value is considered invalid (as
5497 unsupported values must be), CSS requires that the entire declaration be
5498 ignored.
5500 <h3 class=no-num id=experimental> Experimental Implementations</h3>
5502 <p>To avoid clashes with future CSS features, the CSS2.1 specification
5503 reserves a <a
5504 href="http://www.w3.org/TR/CSS21/syndata.html#vendor-keywords">prefixed
5505 syntax</a> for proprietary and experimental extensions to CSS.
5507 <p>Prior to a specification reaching the Candidate Recommendation stage in
5508 the W3C process, all implementations of a CSS feature are considered
5509 experimental. The CSS Working Group recommends that implementations use a
5510 vendor-prefixed syntax for such features, including those in W3C Working
5511 Drafts. This avoids incompatibilities with future changes in the draft.
5513 <h3 class=no-num id=testing> Non-Experimental Implementations</h3>
5515 <p>Once a specification reaches the Candidate Recommendation stage,
5516 non-experimental implementations are possible, and implementors should
5517 release an unprefixed implementation of any CR-level feature they can
5518 demonstrate to be correctly implemented according to spec.
5520 <p>To establish and maintain the interoperability of CSS across
5521 implementations, the CSS Working Group requests that non-experimental CSS
5522 renderers submit an implementation report (and, if necessary, the
5523 testcases used for that implementation report) to the W3C before releasing
5524 an unprefixed implementation of any CSS features. Testcases submitted to
5525 W3C are subject to review and correction by the CSS Working Group.
5527 <p>Further information on submitting testcases and implementation reports
5528 can be found from on the CSS Working Group's website at <a
5529 href="http://www.w3.org/Style/CSS/Test/">http://www.w3.org/Style/CSS/Test/</a>.
5530 Questions should be directed to the <a
5531 href="http://lists.w3.org/Archives/Public/public-css-testsuite">public-css-testsuite@w3.org</a>
5532 mailing list.
5534 <h2 class=no-num id=references>References</h2>
5536 <h3 class=no-num id=normative-references>Normative References</h3>
5537 <!--begin-normative-->
5538 <!-- Sorted by label -->
5540 <dl class=bibliography>
5541 <dd style="display: none"><!-- keeps the doc valid if the DL is empty -->
5542 <!---->
5544 <dt id=CHARMOD>[CHARMOD]
5546 <dd>Martin J. Dürst; et al. <a
5547 href="http://www.w3.org/TR/2005/REC-charmod-20050215/"><cite>Character
5548 Model for the World Wide Web 1.0: Fundamentals.</cite></a> 15 February
5549 2005. W3C Recommendation. URL: <a
5550 href="http://www.w3.org/TR/2005/REC-charmod-20050215/">http://www.w3.org/TR/2005/REC-charmod-20050215/</a>
5551 </dd>
5552 <!---->
5554 <dt id=CORS>[CORS]
5556 <dd>Anne van Kesteren. <a
5557 href="http://www.w3.org/TR/2013/CR-cors-20130129/"><cite>Cross-Origin
5558 Resource Sharing.</cite></a> 29 January 2013. W3C Candidate
5559 Recommendation. (Work in progress.) URL: <a
5560 href="http://www.w3.org/TR/2013/CR-cors-20130129/">http://www.w3.org/TR/2013/CR-cors-20130129/</a>
5561 </dd>
5562 <!---->
5564 <dt id=CSS21>[CSS21]
5566 <dd>Bert Bos; et al. <a
5567 href="http://www.w3.org/TR/2011/REC-CSS2-20110607"><cite>Cascading Style
5568 Sheets Level 2 Revision 1 (CSS 2.1) Specification.</cite></a> 7 June
5569 2011. W3C Recommendation. URL: <a
5570 href="http://www.w3.org/TR/2011/REC-CSS2-20110607">http://www.w3.org/TR/2011/REC-CSS2-20110607</a>
5571 </dd>
5572 <!---->
5574 <dt id=CSS3VAL>[CSS3VAL]
5576 <dd>Håkon Wium Lie; Tab Atkins; Elika J. Etemad. <a
5577 href="http://www.w3.org/TR/2012/CR-css3-values-20120828/"><cite>CSS
5578 Values and Units Module Level 3.</cite></a> 28 August 2012. W3C Candidate
5579 Recommendation. (Work in progress.) URL: <a
5580 href="http://www.w3.org/TR/2012/CR-css3-values-20120828/">http://www.w3.org/TR/2012/CR-css3-values-20120828/</a>
5581 </dd>
5582 <!---->
5584 <dt id=HTML5>[HTML5]
5586 <dd>Ian Hickson. <a
5587 href="http://www.w3.org/TR/2012/CR-html5-20121217/"><cite>HTML5.</cite></a>
5588 17 December 2012. W3C Candidate Recommendation. (Work in progress.) URL:
5589 <a
5590 href="http://www.w3.org/TR/2012/CR-html5-20121217/">http://www.w3.org/TR/2012/CR-html5-20121217/</a>
5591 </dd>
5592 <!---->
5594 <dt id=OPEN-FONT-FORMAT>[OPEN-FONT-FORMAT]
5596 <dd><a
5597 href="http://standards.iso.org/ittf/PubliclyAvailableStandards/c052136_ISO_IEC_14496-22_2009(E).zip"><cite>Information
5598 technology — Coding of audio-visual objects — Part 22: Open Font
5599 Format.</cite></a> International Organization for Standardization.
5600 ISO/IEC 14496-22:2009. URL: <a
5601 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>
5602 </dd>
5603 <!---->
5605 <dt id=OPENTYPE>[OPENTYPE]
5607 <dd><a
5608 href="http://www.microsoft.com/typography/otspec/default.htm"><cite>OpenType
5609 specification.</cite></a> Microsoft. URL: <a
5610 href="http://www.microsoft.com/typography/otspec/default.htm">http://www.microsoft.com/typography/otspec/default.htm</a>
5611 </dd>
5612 <!---->
5614 <dt id=OPENTYPE-FEATURES>[OPENTYPE-FEATURES]
5616 <dd><a
5617 href="http://www.microsoft.com/typography/otspec/featurelist.htm"><cite>OpenType
5618 feature registry.</cite></a> Microsoft. URL: <a
5619 href="http://www.microsoft.com/typography/otspec/featurelist.htm">http://www.microsoft.com/typography/otspec/featurelist.htm</a>
5620 </dd>
5621 <!---->
5623 <dt id=RFC2119>[RFC2119]
5625 <dd>S. Bradner. <a href="http://www.ietf.org/rfc/rfc2119.txt"><cite>Key
5626 words for use in RFCs to Indicate Requirement Levels.</cite></a> Internet
5627 RFC 2119. URL: <a
5628 href="http://www.ietf.org/rfc/rfc2119.txt">http://www.ietf.org/rfc/rfc2119.txt</a>
5629 </dd>
5630 <!---->
5632 <dt id=UAX15>[UAX15]
5634 <dd>Mark Davis; Ken Whistler. <a
5635 href="http://www.unicode.org/reports/tr15/"><cite>Unicode Normalization
5636 Forms.</cite></a> 31 August 2012. Unicode Standard Annex #15. URL: <a
5637 href="http://www.unicode.org/reports/tr15/">http://www.unicode.org/reports/tr15/</a>
5638 </dd>
5639 <!---->
5641 <dt id=UAX29>[UAX29]
5643 <dd>Mark Davis. <a
5644 href="http://www.unicode.org/reports/tr29/"><cite>Unicode Text
5645 Segmentation.</cite></a> 12 September 2012. Unicode Standard Annex #29.
5646 URL: <a
5647 href="http://www.unicode.org/reports/tr29/">http://www.unicode.org/reports/tr29/</a>
5648 </dd>
5649 <!---->
5651 <dt id=UNICODE6>[UNICODE6]
5653 <dd>The Unicode Consortium. <a
5654 href="http://www.unicode.org/versions/Unicode6.2.0/"><cite>The Unicode
5655 Standard, Version 6.2.0.</cite></a> Defined by: The Unicode Standard,
5656 Version 6.2.0 URL: <a
5657 href="http://www.unicode.org/versions/Unicode6.2.0/">http://www.unicode.org/versions/Unicode6.2.0/</a>
5658 </dd>
5659 <!---->
5660 </dl>
5661 <!--end-normative-->
5662 <!--{{!CSS21}}-->
5663 <!--{{!CSS3VAL}}-->
5664 <!--{{!OPENTYPE}}-->
5665 <!--{{!OPENTYPE-FEATURES}}-->
5666 <!--{{!OPEN-FONT-FORMAT}}-->
5667 <!--{{!UNICODE6}}-->
5668 <!--{{!UAX15}}-->
5669 <!--{{!UAX29}}-->
5670 <!--{{!CORS}}-->
5671 <!--{{!HTML5}}-->
5672 <!--{{!CHARMOD}}-->
5674 <h3 class=no-num id=other-references>Other References</h3>
5675 <!--begin-informative-->
5676 <!-- Sorted by label -->
5678 <dl class=bibliography>
5679 <dd style="display: none"><!-- keeps the doc valid if the DL is empty -->
5680 <!---->
5682 <dt id=AAT-FEATURES>[AAT-FEATURES]
5684 <dd><a href="http://developer.apple.com/fonts/registry/"><cite>Apple
5685 Advanced Typography font feature registry.</cite></a> Apple. URL: <a
5686 href="http://developer.apple.com/fonts/registry/">http://developer.apple.com/fonts/registry/</a>
5687 </dd>
5688 <!---->
5690 <dt id=ARABIC-TYPO>[ARABIC-TYPO]
5692 <dd>Huda Smitshuijzen AbiFares. <cite>Arabic Typography: A Comprehensive
5693 Sourcebook.</cite> Saqi Books. 2001. ISBN 0-86356-347-3.</dd>
5694 <!---->
5696 <dt id=CHARMOD-NORM>[CHARMOD-NORM]
5698 <dd>François Yergeau; et al. <a
5699 href="http://www.w3.org/TR/2012/WD-charmod-norm-20120501/"><cite>Character
5700 Model for the World Wide Web 1.0: Normalization.</cite></a> 1 May 2012.
5701 W3C Working Draft. (Work in progress.) URL: <a
5702 href="http://www.w3.org/TR/2012/WD-charmod-norm-20120501/">http://www.w3.org/TR/2012/WD-charmod-norm-20120501/</a>
5703 </dd>
5704 <!---->
5706 <dt id=CJKV-INFO-PROCESSING>[CJKV-INFO-PROCESSING]
5708 <dd>Ken Lunde. <cite>CJKV Information Processing, Second Edition.</cite>
5709 O'Reilly Media, Inc. 2009. ISBN 0-596-51447-1.</dd>
5710 <!---->
5712 <dt id=CSS3-CONDITIONAL>[CSS3-CONDITIONAL]
5714 <dd>L. David Baron. <a
5715 href="http://www.w3.org/TR/2012/WD-css3-conditional-20121213/"><cite>CSS
5716 Conditional Rules Module Level 3.</cite></a> 13 December 2012. W3C
5717 Working Draft. (Work in progress.) URL: <a
5718 href="http://www.w3.org/TR/2012/WD-css3-conditional-20121213/">http://www.w3.org/TR/2012/WD-css3-conditional-20121213/</a>
5719 </dd>
5720 <!---->
5722 <dt id=CSS3TEXT>[CSS3TEXT]
5724 <dd>Elika J. Etemad; Koji Ishii. <a
5725 href="http://www.w3.org/TR/2012/WD-css3-text-20121113/"><cite>CSS Text
5726 Module Level 3.</cite></a> 13 November 2012. W3C Working Draft. (Work in
5727 progress.) URL: <a
5728 href="http://www.w3.org/TR/2012/WD-css3-text-20121113/">http://www.w3.org/TR/2012/WD-css3-text-20121113/</a>
5729 </dd>
5730 <!---->
5732 <dt id=DIGITAL-TYPOGRAPHY>[DIGITAL-TYPOGRAPHY]
5734 <dd>Richard Rubinstein. <cite>Digital Typography, An Introduction to Type
5735 and Composition for Computer System Design.</cite> Addison-Wesley. 1988.
5736 ISBN 0-201-17633-5.</dd>
5737 <!---->
5739 <dt id=DOM-LEVEL-2-STYLE>[DOM-LEVEL-2-STYLE]
5741 <dd>Chris Wilson; Philippe Le Hégaret; Vidur Apparao. <a
5742 href="http://www.w3.org/TR/2000/REC-DOM-Level-2-Style-20001113/"><cite>Document
5743 Object Model (DOM) Level 2 Style Specification.</cite></a> 13 November
5744 2000. W3C Recommendation. URL: <a
5745 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>
5746 </dd>
5747 <!---->
5749 <dt id=ELEMTYPO>[ELEMTYPO]
5751 <dd>Robert Bringhurst. <cite>The Elements of Typographic Style, Version
5752 4.</cite> Hartley & Marks. 2013. ISBN 0-88179-212-8.</dd>
5753 <!---->
5755 <dt id=LANGCULTTYPE>[LANGCULTTYPE]
5757 <dd>John D. Berry, Ed. <cite>Language Culture Type.</cite> Graphis. 2001.
5758 ISBN 1-932026-01-0.</dd>
5759 <!---->
5761 <dt id=OPENTYPE-FONT-GUIDE>[OPENTYPE-FONT-GUIDE]
5763 <dd><a
5764 href="https://www.fontfont.com/staticcontent/downloads/FF_OT_User_Guide.pdf"><cite>OpenType
5765 User Guide.</cite></a> FontShop International. URL: <a
5766 href="https://www.fontfont.com/staticcontent/downloads/FF_OT_User_Guide.pdf">https://www.fontfont.com/staticcontent/downloads/FF_OT_User_Guide.pdf</a>
5767 </dd>
5768 <!---->
5770 <dt id=RASTER-TRAGEDY>[RASTER-TRAGEDY]
5772 <dd>Beat Stamm. <a href="http://www.rastertragedy.com/"><cite>The Raster
5773 Tragedy at Low-Resolution Revisited.</cite></a> 7 December 2011. URL: <a
5774 href="http://www.rastertragedy.com/">http://www.rastertragedy.com/</a></dd>
5775 <!---->
5777 <dt id=WINDOWS-GLYPH-PROC>[WINDOWS-GLYPH-PROC]
5779 <dd>John Hudson. <a
5780 href="http://www.microsoft.com/typography/developers/opentype/default.htm"><cite>Windows
5781 Glyph Processing.</cite></a> Microsoft Typogrraphy. URL: <a
5782 href="http://www.microsoft.com/typography/developers/opentype/default.htm">http://www.microsoft.com/typography/developers/opentype/default.htm</a>
5783 </dd>
5784 <!---->
5785 </dl>
5786 <!--end-informative-->
5787 <!--{{ARABIC-TYPO}}-->
5788 <!--{{CJKV-INFO-PROCESSING}}-->
5789 <!--{{DIGITAL-TYPOGRAPHY}}-->
5790 <!--{{DOM-LEVEL-2-STYLE}}-->
5791 <!--{{ELEMTYPO}}-->
5792 <!--{{LANGCULTTYPE}}-->
5793 <!--{{OPENTYPE-FONT-GUIDE}}-->
5794 <!--{{RASTER-TRAGEDY}}-->
5795 <!--{{WINDOWS-GLYPH-PROC}}-->
5796 <!--{{CHARMOD-NORM}}-->
5797 <!--{{AAT-FEATURES}}-->
5798 <!--{{CSS3-CONDITIONAL}}-->
5799 <!--{{CSS3TEXT}}-->
5801 <h2 class=no-num id=index>Index</h2>
5802 <!--begin-index-->
5804 <ul class=indexlist>
5805 <li><absolute-size>, <a href="#ltabsolute-sizegt"
5806 title="<absolute-size>"><strong>3.5</strong></a>
5808 <li><var><common-lig-values></var>, <a href="#ltcommon-lig-values"
5809 title="<common-lig-values>"><strong>6.4</strong></a>
5811 <li><var><contextual-alt-values></var>, <a
5812 href="#ltcontextual-alt-valuesgt"
5813 title="<contextual-alt-values>"><strong>6.4</strong></a>
5815 <li><var><discretionary-lig-values></var>, <a
5816 href="#ltdiscretionary-lig-values"
5817 title="<discretionary-lig-values>"><strong>6.4</strong></a>
5819 <li><var><east-asian-variant-values></var>, <a
5820 href="#lteast-asian-variant-valuesgt"
5821 title="<east-asian-variant-values>"><strong>6.10</strong></a>
5823 <li><var><east-asian-width-values></var>, <a
5824 href="#lteast-asian-width-valuesgt"
5825 title="<east-asian-width-values>"><strong>6.10</strong></a>
5827 <li><var><feature-tag-value></var>, <a href="#ltfeature-tag-valuegt"
5828 title="<feature-tag-value>"><strong>6.12</strong></a>
5830 <li><font-face-name>, <a href="#ltfont-face-namegt"
5831 title="<font-face-name>"><strong>4.3</strong></a>
5833 <li><var><font-variant-css21></var>, <a
5834 href="#ltfont-variant-css21gt"
5835 title="<font-variant-css21>"><strong>3.7</strong></a>
5837 <li><var><historical-lig-values></var>, <a
5838 href="#lthistorical-lig-values"
5839 title="<historical-lig-values>"><strong>6.4</strong></a>
5841 <li><length>, <a href="#ltlengthgt" title="<length>">3.5</a>
5843 <li><number>, <a href="#ltnumbergt" title="<number>">3.6</a>
5845 <li><var><numeric-figure-values></var>, <a
5846 href="#ltnumeric-figure-valuesgt"
5847 title="<numeric-figure-values>"><strong>6.7</strong></a>
5849 <li><var><numeric-fraction-values></var>, <a
5850 href="#ltnumeric-fraction-valuesgt"
5851 title="<numeric-fraction-values>"><strong>6.7</strong></a>
5853 <li><var><numeric-spacing-values></var>, <a
5854 href="#ltnumeric-spacing-valuesgt"
5855 title="<numeric-spacing-values>"><strong>6.7</strong></a>
5857 <li><percentage>, <a href="#ltpercentagegt-"
5858 title="<percentage>">3.5</a>
5860 <li><relative-size>, <a href="#ltrelative-sizegt"
5861 title="<relative-size>"><strong>3.5</strong></a>
5863 <li><urange>, <a href="#lturangegt"
5864 title="<urange>"><strong>4.5</strong></a>
5866 <li>@font-face, <a href="#font-face" title="@font-face">4.1</a>, <a
5867 href="#font-face0" title="@font-face">4.3</a>
5869 <li>all-petite-caps, <a href="#all-petite-caps"
5870 title=all-petite-caps><strong>6.6</strong></a>
5872 <li>all-small-caps, <a href="#all-small-caps"
5873 title=all-small-caps><strong>6.6</strong></a>
5875 <li>annotation, <a href="#annotationltfeature-value-namegt"
5876 title=annotation><strong>6.8</strong></a>
5878 <li>aspect value, <a href="#aspect-value0" title="aspect
5879 value"><strong>3.6</strong></a>
5881 <li>authoring tool, <a href="#authoring-tool" title="authoring
5882 tool"><strong>#</strong></a>
5884 <li>character map, <a href="#character-map" title="character
5885 map"><strong>5.2</strong></a>
5887 <li>character-variant, <a href="#character-variantltfeature-value-namegt"
5888 title=character-variant><strong>6.8</strong></a>
5890 <li>common-ligatures, <a href="#common-ligatures"
5891 title=common-ligatures><strong>6.4</strong></a>
5893 <li>contextual, <a href="#contextual"
5894 title=contextual><strong>6.4</strong></a>
5896 <li>CSSFontFaceRule, <a href="#cssfontfacerule"
5897 title=CSSFontFaceRule><strong>8.1</strong></a>
5899 <li>CSSFontFeatureValuesRule, <a href="#cssfontfeaturevaluesrule"
5900 title=CSSFontFeatureValuesRule><strong>8.2</strong></a>
5902 <li>cursive, definition of, <a href="#cursive0" title="cursive, definition
5903 of"><strong>#</strong></a>
5905 <li>default face, <a href="#default-face" title="default
5906 face"><strong>5.2</strong></a>
5908 <li>descriptor_declaration, <a href="#descriptordeclaration"
5909 title="descriptor_declaration"><strong>4.1</strong></a>
5911 <li>diagonal-fractions, <a href="#diagonal-fractions"
5912 title=diagonal-fractions><strong>6.7</strong></a>
5914 <li>discretionary-ligatures, <a href="#discretionary-ligatures"
5915 title=discretionary-ligatures><strong>6.4</strong></a>
5917 <li>fantasy, definition of, <a href="#fantasy0" title="fantasy, definition
5918 of"><strong>#</strong></a>
5920 <li>feature_type, <a href="#featuretype"
5921 title="feature_type"><strong>6.9</strong></a>
5923 <li>feature_value_block, <a href="#featurevalueblock"
5924 title="feature_value_block"><strong>6.9</strong></a>
5926 <li>feature_value_definition, <a href="#featurevaluedefinition"
5927 title="feature_value_definition"><strong>6.9</strong></a>
5929 <li>font, <a href="#propdef-font" title=font><strong>3.7</strong></a>
5931 <li>font-family, <a href="#descdef-font-family"
5932 title=font-family><strong>4.2</strong></a>, <a
5933 href="#propdef-font-family" title=font-family><strong>3.1</strong></a>
5935 <li>font-feature-settings, <a href="#propdef-font-feature-settings"
5936 title=font-feature-settings><strong>6.12</strong></a>
5938 <li>font-feature-settings (descriptor), <a
5939 href="#descdef-font-feature-settings" title="font-feature-settings
5940 (descriptor)"><strong>4.6</strong></a>
5942 <li>font-kerning, <a href="#propdef-font-kerning"
5943 title=font-kerning><strong>6.3</strong></a>
5945 <li>font-language-override, <a href="#propdef-font-language-override"
5946 title=font-language-override><strong>6.13</strong></a>
5948 <li>font-size, <a href="#propdef-font-size"
5949 title=font-size><strong>3.5</strong></a>
5951 <li>font-size-adjust, <a href="#propdef-font-size-adjust"
5952 title=font-size-adjust><strong>3.6</strong></a>
5954 <li>font-stretch, <a href="#propdef-font-stretch"
5955 title=font-stretch><strong>3.3</strong></a>
5957 <li>font-stretch (descriptor), <a href="#descdef-font-stretch"
5958 title="font-stretch (descriptor)"><strong>4.4</strong></a>
5960 <li>font-style, <a href="#propdef-font-style"
5961 title=font-style><strong>3.4</strong></a>
5963 <li>font-style (descriptor), <a href="#descdef-font-style"
5964 title="font-style (descriptor)"><strong>4.4</strong></a>
5966 <li>font-synthesis, <a href="#propdef-font-synthesis"
5967 title=font-synthesis><strong>3.8</strong></a>
5969 <li>font-variant, <a href="#propdef-font-variant"
5970 title=font-variant><strong>6.11</strong></a>
5972 <li>font-variant (descriptor), <a href="#descdef-font-variant"
5973 title="font-variant (descriptor)"><strong>4.6</strong></a>
5975 <li>font-variant-alternates, <a href="#propdef-font-variant-alternates"
5976 title=font-variant-alternates><strong>6.8</strong></a>
5978 <li>font-variant-caps, <a href="#propdef-font-variant-caps"
5979 title=font-variant-caps><strong>6.6</strong></a>
5981 <li>font-variant-east-asian, <a href="#propdef-font-variant-east-asian"
5982 title=font-variant-east-asian><strong>6.10</strong></a>
5984 <li>font-variant-ligatures, <a href="#propdef-font-variant-ligatures"
5985 title=font-variant-ligatures><strong>6.4</strong></a>
5987 <li>font-variant-numeric, <a href="#propdef-font-variant-numeric"
5988 title=font-variant-numeric><strong>6.7</strong></a>
5990 <li>font-variant-position, <a href="#propdef-font-variant-position"
5991 title=font-variant-position><strong>6.5</strong></a>
5993 <li>font-weight, <a href="#propdef-font-weight"
5994 title=font-weight><strong>3.2</strong></a>
5996 <li>font-weight (descriptor), <a href="#descdef-font-weight"
5997 title="font-weight (descriptor)"><strong>4.4</strong></a>
5999 <li>font_face_rule, <a href="#fontfacerule"
6000 title="font_face_rule"><strong>4.1</strong></a>
6002 <li>font_family_name, <a href="#fontfamilyname"
6003 title="font_family_name"><strong>6.9</strong></a>
6005 <li>font_family_name_list, <a href="#fontfamilynamelist"
6006 title="font_family_name_list"><strong>6.9</strong></a>
6008 <li>font_feature_values_rule, <a href="#fontfeaturevaluesrule"
6009 title="font_feature_values_rule"><strong>6.9</strong></a>
6011 <li>full-width, <a href="#full-width"
6012 title=full-width><strong>6.10</strong></a>
6014 <li>historical-forms, <a href="#historical-forms"
6015 title=historical-forms><strong>6.8</strong></a>
6017 <li>historical-ligatures, <a href="#historical-ligatures"
6018 title=historical-ligatures><strong>6.4</strong></a>
6020 <li>jis04, <a href="#jis04" title=jis04><strong>6.10</strong></a>
6022 <li>jis78, <a href="#jis78" title=jis78><strong>6.10</strong></a>
6024 <li>jis83, <a href="#jis83" title=jis83><strong>6.10</strong></a>
6026 <li>jis90, <a href="#jis90" title=jis90><strong>6.10</strong></a>
6028 <li>lining-nums, <a href="#lining-nums"
6029 title=lining-nums><strong>6.7</strong></a>
6031 <li>monospace, definition of, <a href="#monospace0" title="monospace,
6032 definition of"><strong>#</strong></a>
6034 <li>no-common-ligatures, <a href="#no-common-ligatures"
6035 title=no-common-ligatures><strong>6.4</strong></a>
6037 <li>no-contextual, <a href="#no-contextual"
6038 title=no-contextual><strong>6.4</strong></a>
6040 <li>no-discretionary-ligatures, <a href="#no-discretionary-ligatures"
6041 title=no-discretionary-ligatures><strong>6.4</strong></a>
6043 <li>no-historical-ligatures, <a href="#no-historical-ligatures"
6044 title=no-historical-ligatures><strong>6.4</strong></a>
6046 <li>normal, <a href="#normal" title=normal><strong>6.6</strong></a>, <a
6047 href="#normal0" title=normal><strong>6.7</strong></a>, <a href="#normal1"
6048 title=normal><strong>6.8</strong></a>, <a href="#normal2"
6049 title=normal><strong>6.10</strong></a>
6051 <li>oldstyle-nums, <a href="#oldstyle-nums"
6052 title=oldstyle-nums><strong>6.7</strong></a>
6054 <li>ordinal, <a href="#ordinal" title=ordinal><strong>6.7</strong></a>
6056 <li>ornaments, <a href="#ornamentsltfeature-value-namegt"
6057 title=ornaments><strong>6.8</strong></a>
6059 <li>petite-caps, <a href="#petite-caps"
6060 title=petite-caps><strong>6.6</strong></a>
6062 <li>proportional-nums, <a href="#proportional-nums"
6063 title=proportional-nums><strong>6.7</strong></a>
6065 <li>proportional-width, <a href="#proportional-width"
6066 title=proportional-width><strong>6.10</strong></a>
6068 <li>renderer, <a href="#renderer" title=renderer><strong>#</strong></a>
6070 <li>ruby, <a href="#ruby" title=ruby><strong>6.10</strong></a>
6072 <li>sans-serif, definition of, <a href="#sans-serif0" title="sans-serif,
6073 definition of"><strong>#</strong></a>
6075 <li>serif, definition of, <a href="#serif0" title="serif, definition
6076 of"><strong>#</strong></a>
6078 <li>simplified, <a href="#simplified"
6079 title=simplified><strong>6.10</strong></a>
6081 <li>slashed-zero, <a href="#slashed-zero"
6082 title=slashed-zero><strong>6.7</strong></a>
6084 <li>small-caps, <a href="#small-caps"
6085 title=small-caps><strong>6.6</strong></a>
6087 <li>src, <a href="#descdef-src" title=src><strong>4.3</strong></a>
6089 <li>stacked-fractions, <a href="#stacked-fractions"
6090 title=stacked-fractions><strong>6.7</strong></a>
6092 <li>style sheet
6093 <ul>
6094 <li>as conformance class, <a href="#style-sheet" title="style sheet, as
6095 conformance class"><strong>#</strong></a>
6096 </ul>
6098 <li>styleset, <a href="#stylesetltfeature-value-namegt"
6099 title=styleset><strong>6.8</strong></a>
6101 <li>stylistic, <a href="#stylisticltfeature-value-namegt"
6102 title=stylistic><strong>6.8</strong></a>
6104 <li>swash, <a href="#swashltfeature-value-namegt"
6105 title=swash><strong>6.8</strong></a>
6107 <li>tabular-nums, <a href="#tabular-nums"
6108 title=tabular-nums><strong>6.7</strong></a>
6110 <li>titling-caps, <a href="#titling-caps"
6111 title=titling-caps><strong>6.6</strong></a>
6113 <li>traditional, <a href="#traditional"
6114 title=traditional><strong>6.10</strong></a>
6116 <li>unicase, <a href="#unicase" title=unicase><strong>6.6</strong></a>
6118 <li>unicode-range, <a href="#descdef-unicode-range"
6119 title=unicode-range><strong>4.5</strong></a>
6121 <li>weight, <a href="#weight" title=weight><strong>2</strong></a>
6123 <li>width, <a href="#width" title=width><strong>2</strong></a>
6124 </ul>
6125 <!--end-index-->
6127 <h2 class=no-num id=property-index>Property index</h2>
6128 <!--begin-properties-->
6130 <table class=proptable>
6131 <thead>
6132 <tr>
6133 <th>Property
6135 <th>Values
6137 <th>Initial
6139 <th>Applies to
6141 <th>Inh.
6143 <th>Percentages
6145 <th>Media
6147 <tbody>
6148 <tr>
6149 <th><a class=property href="#propdef-font">font</a>
6151 <td>[ [ <‘font-style’> || <font-variant-css21> ||
6152 <‘font-weight’> || <‘font-stretch’> ]?
6153 <‘font-size’> [ / <‘line-height’> ]?
6154 <‘font-family’> ] | caption | icon | menu | message-box |
6155 small-caption | status-bar
6157 <td>see individual properties
6159 <td>all elements
6161 <td>yes
6163 <td>see individual properties
6165 <td>visual
6167 <tr>
6168 <th><a class=property href="#descdef-font-family">font-family</a>
6170 <td>[ <family-name> | <generic-family> ]#
6172 <td>depends on user agent
6174 <td>all elements
6176 <td>yes
6178 <td>N/A
6180 <td>visual
6182 <tr>
6183 <th><a class=property
6184 href="#propdef-font-feature-settings">font-feature-settings</a>
6186 <td>normal | <feature-tag-value>#
6188 <td>normal
6190 <td>all elements
6192 <td>yes
6194 <td>N/A
6196 <td>visual
6198 <tr>
6199 <th><a class=property href="#propdef-font-kerning">font-kerning</a>
6201 <td>auto | normal | none
6203 <td>auto
6205 <td>all elements
6207 <td>yes
6209 <td>N/A
6211 <td>visual
6213 <tr>
6214 <th><a class=property
6215 href="#propdef-font-language-override">font-language-override</a>
6217 <td>normal | <string>
6219 <td>normal
6221 <td>all elements
6223 <td>yes
6225 <td>N/A
6227 <td>visual
6229 <tr>
6230 <th><a class=property href="#propdef-font-size">font-size</a>
6232 <td><absolute-size> | <relative-size> | <length> |
6233 <percentage>
6235 <td>medium
6237 <td>all elements
6239 <td>yes
6241 <td>refer to parent element's font size
6243 <td>visual
6245 <tr>
6246 <th><a class=property
6247 href="#propdef-font-size-adjust">font-size-adjust</a>
6249 <td>none | auto | <number>
6251 <td>none
6253 <td>all elements
6255 <td>yes
6257 <td>N/A
6259 <td>visual
6261 <tr>
6262 <th><a class=property href="#propdef-font-stretch">font-stretch</a>
6264 <td>normal | ultra-condensed | extra-condensed | condensed |
6265 semi-condensed | semi-expanded | expanded | extra-expanded |
6266 ultra-expanded
6268 <td>normal
6270 <td>all elements
6272 <td>yes
6274 <td>N/A
6276 <td>visual
6278 <tr>
6279 <th><a class=property href="#propdef-font-style">font-style</a>
6281 <td>normal | italic | oblique
6283 <td>normal
6285 <td>all elements
6287 <td>yes
6289 <td>N/A
6291 <td>visual
6293 <tr>
6294 <th><a class=property href="#propdef-font-synthesis">font-synthesis</a>
6296 <td>none | [ weight || style ]
6298 <td>weight style
6300 <td>all elements
6302 <td>yes
6304 <td>N/A
6306 <td>visual
6308 <tr>
6309 <th><a class=property href="#propdef-font-variant">font-variant</a>
6311 <td>normal | none | [ <common-lig-values> ||
6312 <discretionary-lig-values> || <historical-lig-values> ||
6313 <contextual-alt-values> || stylistic(<feature-value-name>)
6314 || historical-forms || styleset(<feature-value-name>#) ||
6315 character-variant(<feature-value-name>#) ||
6316 swash(<feature-value-name>) ||
6317 ornaments(<feature-value-name>) ||
6318 annotation(<feature-value-name>) || [ small-caps | all-small-caps
6319 | petite-caps | all-petite-caps | unicase | titling-caps ] ||
6320 <numeric-figure-values> || <numeric-spacing-values> ||
6321 <numeric-fraction-values> || ordinal || slashed-zero ||
6322 <east-asian-variant-values> || <east-asian-width-values> ||
6323 ruby ]
6325 <td>normal
6327 <td>all elements
6329 <td>yes
6331 <td>see individual properties
6333 <td>visual
6335 <tr>
6336 <th><a class=property
6337 href="#propdef-font-variant-alternates">font-variant-alternates</a>
6339 <td>normal | [ stylistic(<feature-value-name>) || historical-forms
6340 || styleset(<feature-value-name>#) ||
6341 character-variant(<feature-value-name>#) ||
6342 swash(<feature-value-name>) ||
6343 ornaments(<feature-value-name>) ||
6344 annotation(<feature-value-name>) ]
6346 <td>normal
6348 <td>all elements
6350 <td>yes
6352 <td>N/A
6354 <td>visual
6356 <tr>
6357 <th><a class=property
6358 href="#propdef-font-variant-caps">font-variant-caps</a>
6360 <td>normal | small-caps | all-small-caps | petite-caps | all-petite-caps
6361 | unicase | titling-caps
6363 <td>normal
6365 <td>all elements
6367 <td>yes
6369 <td>N/A
6371 <td>visual
6373 <tr>
6374 <th><a class=property
6375 href="#propdef-font-variant-east-asian">font-variant-east-asian</a>
6377 <td>normal | [ <east-asian-variant-values> ||
6378 <east-asian-width-values> || ruby ]
6380 <td>normal
6382 <td>all elements
6384 <td>yes
6386 <td>N/A
6388 <td>visual
6390 <tr>
6391 <th><a class=property
6392 href="#propdef-font-variant-ligatures">font-variant-ligatures</a>
6394 <td>normal | none | [ <common-lig-values> ||
6395 <discretionary-lig-values> || <historical-lig-values> ||
6396 <contextual-alt-values> ]
6398 <td>normal
6400 <td>all elements
6402 <td>yes
6404 <td>N/A
6406 <td>visual
6408 <tr>
6409 <th><a class=property
6410 href="#propdef-font-variant-numeric">font-variant-numeric</a>
6412 <td>normal | [ <numeric-figure-values> ||
6413 <numeric-spacing-values> || <numeric-fraction-values> ||
6414 ordinal || slashed-zero ]
6416 <td>normal
6418 <td>all elements
6420 <td>yes
6422 <td>N/A
6424 <td>visual
6426 <tr>
6427 <th><a class=property
6428 href="#propdef-font-variant-position">font-variant-position</a>
6430 <td>normal | sub | super
6432 <td>normal
6434 <td>all elements
6436 <td>yes
6438 <td>N/A
6440 <td>visual
6442 <tr>
6443 <th><a class=property href="#propdef-font-weight">font-weight</a>
6445 <td>normal | bold | bolder | lighter | 100 | 200 | 300 | 400 | 500 | 600
6446 | 700 | 800 | 900
6448 <td>normal
6450 <td>all elements
6452 <td>yes
6454 <td>N/A
6456 <td>visual
6457 </table>
6458 <!--end-properties-->
6459 <!--begin-descriptors-->
6461 <table class=proptable>
6462 <thead>
6463 <tr>
6464 <th>Descriptor
6466 <th>Value
6468 <th>Initial
6470 <th>Percentages
6472 <th>Media
6474 <tbody>
6475 <tr>
6476 <th><a class=property href="#descdef-font-family">font-family</a>
6478 <td><family-name>
6480 <td>N/A
6482 <tr>
6483 <th><a class=property
6484 href="#propdef-font-feature-settings">font-feature-settings</a>
6486 <td>normal | <feature-tag-value>#
6488 <td>normal
6490 <tr>
6491 <th><a class=property href="#propdef-font-stretch">font-stretch</a>
6493 <td>normal | ultra-condensed | extra-condensed | condensed |
6494 semi-condensed | semi-expanded | expanded | extra-expanded |
6495 ultra-expanded
6497 <td>normal
6499 <tr>
6500 <th><a class=property href="#propdef-font-style">font-style</a>
6502 <td>normal | italic | oblique
6504 <td>normal
6506 <tr>
6507 <th><a class=property href="#propdef-font-variant">font-variant</a>
6509 <td>normal | [ <common-lig-values> ||
6510 <discretionary-lig-values> || <historical-lig-values> ||
6511 <contextual-alt-values> || stylistic(<feature-value-name>)
6512 || historical-forms || styleset(<feature-value-name>#) ||
6513 character-variant(<feature-value-name>#) ||
6514 swash(<feature-value-name>) ||
6515 ornaments(<feature-value-name>) ||
6516 annotation(<feature-value-name>) || [ small-caps | all-small-caps
6517 | petite-caps | all-petite-caps | unicase | titling-caps ] ||
6518 <numeric-figure-values> || <numeric-spacing-values> ||
6519 <numeric-fraction-values> || ordinal || slashed-zero ||
6520 <east-asian-variant-values> || <east-asian-width-values> ||
6521 ruby ]
6523 <td>normal
6525 <tr>
6526 <th><a class=property href="#propdef-font-weight">font-weight</a>
6528 <td>normal | bold | 100 | 200 | 300 | 400 | 500 | 600 | 700 | 800 | 900
6530 <td>normal
6532 <tr>
6533 <th><a class=property href="#descdef-src">src</a>
6535 <td>[ <uri> [format(<string>#)]? | <font-face-name> ]#
6537 <td>N/A
6539 <tr>
6540 <th><a class=property href="#descdef-unicode-range">unicode-range</a>
6542 <td><urange>#
6544 <td>U+0-10FFFF
6545 </table>
6546 <!--end-descriptors-->
6547 <script type="text/javascript">
6548 window.onload = function () {
6549 if (!("devicePixelRatio" in window && window.devicePixelRatio > 1)) return;
6550 var i, hiresElements = document.getElementsByClassName("hires");
6551 for (i = 0; i < hiresElements.length; i++) {
6552 var h = hiresElements[i];
6553 if (h.tagName != "IMG") continue;
6554 var src = h.getAttribute("src");
6555 var src2x = src.replace(/\.\w+$/, function(m) { return "@2x" + m; });
6556 h.src = src2x;
6557 }
6558 }
6559 </script>
6560 </html>
6561 <!-- Keep this comment at the end of the file
6562 Local variables:
6563 mode: sgml
6564 sgml-declaration:"~/SGML/HTML4.decl"
6565 sgml-default-doctype-name:"html"
6566 sgml-minimize-attributes:t
6567 sgml-nofill-elements:("pre" "style" "br")
6568 sgml-live-element-indicator:t
6569 sgml-omittag:nil
6570 sgml-shorttag:nil
6571 sgml-namecase-general:t
6572 sgml-general-insert-case:lower
6573 sgml-always-quote-attributes:t
6574 sgml-indent-step:nil
6575 sgml-indent-data:t
6576 sgml-parent-document:nil
6577 sgml-exposed-tags:nil
6578 sgml-local-catalogs:nil
6579 sgml-local-ecat-files:nil
6580 End:
6581 -->
6582 <!--
6584 to do:
6586 - wording of OpenType family name handling
6587 - handling combining sequences in the font matching algorithm
6588 - fix-up fi ligature example
6590 -->