<pre class='metadata'>
Title: CSS Fonts Module Level 4
Shortname: css-fonts
Level: 4
Status: ED
Prepare for TR: no
Work Status: Revising
Group: CSSWG
ED: https://drafts.csswg.org/css-fonts-4/
TR: https://www.w3.org/TR/css-fonts-4/
Previous Version: https://www.w3.org/TR/2024/WD-css-fonts-4-20240201/
Former Editor: John Daggett, Invited Expert, https://twitter.com/nattokirai, w3cid 41498
Former Editor: Myles C. Maxfield, Formerly of Apple Inc., mmaxfield@apple.com, w3cid 77180
Editor: Chris Lilley, W3C, http://svgees.us, w3cid 1438
Abstract: This specification defines modifications to the existing <a href="https://drafts.csswg.org/css-fonts-3/">CSS Fonts 3</a> specification along with additional features for font feature control, font variations, and chromatic (color) fonts.
At Risk: Synthesis of the 'font-variant-position' property
At Risk: The 'font-language-override!!property' property
At Risk: The 'font-language-override!!descriptor' descriptor
Ignored Terms: <named-palette-color>, cssText
Ignored Vars: res
Complain About: missing-example-ids true
Default Highlight: css
WPT Path Prefix: css/css-fonts/
WPT Display: closed
</pre>

<pre class="link-defaults">
spec:css-color-4; type:property; text:color
spec:css-color-5; type:type; text:<color>
spec:css-values; type:value; text:ex
spec:css22; type:value; for:/; text:block
spec:html; type:element; text:font
spec:fetch; type:dfn; for:/;
	text:fetch
	text:request
spec:css-env-1; type:function; text:env()
</pre>

<pre class=biblio>
	{
		"GRAPHITE": {
			"href": "https://graphite.sil.org/graphite_techAbout.html",
			"title": "Graphite technical overview",
			"publisher": "SIL",
			"date": "2012"
		},
		"PFE-report": {
			"href": "https://www.w3.org/TR/PFE-evaluation/",
			"authors": [
				"Chris Lilley"
				],
			"status": "Note",
			"publisher": "W3C",
			"title": "Progressive Font Enrichment: Evaluation Report",
			"date": "15 October 2020"
			}
	}
</pre>

<style>
	/* work-around for https://github.com/tabatkins/bikeshed/issues/1799 */
	div.example {
		overflow: visible;
	}
	div.example>a.self-link::before {
		content: "¶";
	}
</style>


<h2 id="introduction">
Introduction</h2>

This specification includes and expands on
the basic font features described in  the CSS3 Fonts specification ([[CSS-FONTS-3]]).


<!--
██     ██    ███    ██       ██     ██ ████████  ██████
██     ██   ██ ██   ██       ██     ██ ██       ██    ██
██     ██  ██   ██  ██       ██     ██ ██       ██
██     ██ ██     ██ ██       ██     ██ ██████    ██████
 ██   ██  █████████ ██       ██     ██ ██             ██
  ██ ██   ██     ██ ██       ██     ██ ██       ██    ██
   ███    ██     ██ ████████  ███████  ████████  ██████
-->

<h3 id="values">
Value Definitions</h3>

	This specification follows the <a href="https://www.w3.org/TR/CSS2/about.html#property-defs">CSS property definition conventions</a> from [[!CSS2]]
	using the <a href="https://www.w3.org/TR/css-values-3/#value-defs">value definition syntax</a> from [[!CSS-VALUES-3]].
	Value types not defined in this specification are defined in CSS Values &amp; Units [[!CSS-VALUES-3]].
	Combination with other CSS modules may expand the definitions of these value types.

	In addition to the property-specific values listed in their definitions,
	all properties defined in this specification
	also accept the <a>CSS-wide keywords</a> as their property value.
	For readability they have not been repeated explicitly.

<h2 id="basic-font-props">
Basic Font Properties</h2>

	The particular font face used to render a character is determined by
	the font family and other font properties that apply to a given element.
	This structure allows settings to be varied independently of each
	other.

<!--
████████  ███████  ██    ██ ████████         ████████    ███    ██     ██ ████ ██       ██    ██
██       ██     ██ ███   ██    ██            ██         ██ ██   ███   ███  ██  ██        ██  ██
██       ██     ██ ████  ██    ██            ██        ██   ██  ████ ████  ██  ██         ████
██████   ██     ██ ██ ██ ██    ██    ███████ ██████   ██     ██ ██ ███ ██  ██  ██          ██
██       ██     ██ ██  ████    ██            ██       █████████ ██     ██  ██  ██          ██
██       ██     ██ ██   ███    ██            ██       ██     ██ ██     ██  ██  ██          ██
██        ███████  ██    ██    ██            ██       ██     ██ ██     ██ ████ ████████    ██
-->

<h3 id="font-family-prop">
Font family: the 'font-family!!property' property</h3>

	<pre class="propdef">
	Name: font-family
	Value: [ <<font-family-name>> | <<generic-font-family>> ]#
	Initial: depends on user agent
	Applies to: all elements and text
	Inherited: yes
	Percentages: n/a
	Computed value: list, each item a string and/or <<generic-font-family>> keywords
	Animation type: discrete
	</pre>

	<wpt>
		font-family-name-000.xht
		font-family-name-001.xht
		font-family-name-002.xht
		font-family-name-003.xht
		font-family-name-004.xht
		font-family-name-005.xht
		font-family-name-006.xht
		font-family-name-007.xht
		font-family-name-008.xht
		font-family-name-009.xht
		font-family-name-010.xht
		font-family-name-011.xht
		font-family-name-012.xht
		font-family-name-013.xht
		font-family-name-014.xht
		font-family-name-015.xht
		font-family-name-016.xht
		font-family-name-017.xht
		font-family-name-018.xht
		font-family-name-019.xht
		font-family-name-020.xht
		font-family-name-021.xht
		font-family-name-022.xht
		font-family-name-023.xht
		font-family-name-024.xht
		font-family-name-025.html
		generic-family-keywords-003.html
		standard-font-family-10.html
		standard-font-family-11.html
		standard-font-family-12.html
		standard-font-family-13.html
		standard-font-family-14.html
		standard-font-family-15.html
		standard-font-family-16.html
		standard-font-family-17.html
		standard-font-family-18.html
		standard-font-family-19.html
		standard-font-family-2.html
		standard-font-family-20.html
		standard-font-family-3.html
		standard-font-family-4.html
		standard-font-family-5.html
		standard-font-family-6.html
		standard-font-family-7.html
		standard-font-family-8.html
		standard-font-family-9.html
		standard-font-family.html
		test_font_family_parsing.html
		animations/system-fonts.html
		parsing/font-family-computed.html
		parsing/font-family-invalid.html
		parsing/font-family-valid.html
	</wpt>

	This property specifies a prioritized list of font family names or generic family names.
	A font family defines a set of faces that vary in weight, width or slope.
	CSS uses the combination of a family name with other font properties to select an individual face.
	Using this selection mechanism,
	rather than selecting a face via the style name as is often done in design applications,
	allows some degree of regularity in textual display when fallback occurs.

	Component values are a comma-separated list indicating alternatives.
	A user agent iterates through the list of family names
	until it matches an available font
	that contains a glyph for the character to be rendered.
	(See [[#cluster-matching]].)
	This allows for differences in available fonts across platforms and
	for differences in the range of characters supported by individual fonts.

	<div class="example" id="ex-font-list">
		<pre>
		body {
			font-family: Helvetica, Verdana, sans-serif;
		}
		</pre>

		If Helvetica is available, it will be used when rendering.
		If neither Helvetica nor Verdana is present,
		then the generic font-family ''sans-serif'' font will be used.
	</div>

	There are three types of font family names, two of which may be used with this property:

	<dl>
	    <dt><dfn id="font-family-name-value"><<font-family-name>></dfn>
	    <dd>
	        The name of a font family, such as Helvetica or Verdana in the previous example.

			This might be a locally-instaled font, or might be a web font.

	    <dt><<generic-font-family>>
	    <dd>
	        Each <<generic-font-family>> keyword represents
	        a generic font choice,
	        and behaves as a potential alias for one or more locally-installed fonts
	        belonging to the specified generic font category.
	        A <<generic-font-family>> can thus be used as a fallback
	        for when an author's more specific font choices are not available.

			There are three types of generic family:

			1.	Generics which apply to all Unicode characters
				and will <em>always</em> match a locally installed font.
				For example, ''monospace''.

			2.	Generics which apply to all Unicode characters
				but may not match to a locally installed font
				on some systems.
				For example, ''ui-rounded''.

			3.	Generics which are writing-system specific,
				only apply to a subset of Unicode characters,
				and may not match to a locally installed font
				on some systems.
				For example, ''generic(fangsong)''.

			Authors are encouraged to append a generic font family as a last alternative
			for improved robustness,
			and to use a more specific generic font family, if applicable,
			to prefer a specific style even if the individual named font family is not available.

	        Note that <<generic-font-family>> keywords cannot be quoted
	        (otherwise they are interpreted as a <<font-family-name>>).

			The set of generic family keywords is defined in [[#generic-font-families]].

		<dt><dfn id="system-font-family-name-value"><<system-font-family-name>></dfn>
		<dd>
			A locally installed system font, whose use is subject to certain constraints.
			In particular, it may not be used with the ''font-family'' property,
			but can be used with the ''font'' shorthand.

			The following values refer to system fonts:

			<dl dfn-type=value dfn-for=font>
				<dt><dfn>caption</dfn>
				<dd>The font used for captioned controls (e.g., buttons, drop-downs, etc.).
				<dt><dfn>icon</dfn>
				<dd>The font used to label icons.
				<dt><dfn>menu</dfn>
				<dd>The font used in menus (e.g., dropdown menus and menu lists).
				<dt><dfn>message-box</dfn>
				<dd>The font used in dialog boxes.
				<dt><dfn>small-caption</dfn>
				<dd>The font used for labeling small controls.
				<dt><dfn>status-bar</dfn>
				<dd>The font used in window status bars.
			</dl>

			<wpt>
				system-fonts-serialization.tentative.html
			</wpt>
		</dd>

	</dl>

<h4 id="font-family-name-syntax">
Syntax of <<font-family-name>>
</h4>

	<pre class=prod><l><<font-family-name>></l> = <<string>> | <<custom-ident>>+</pre>

	Font family names other than generic families or system font families
	must either be given quoted as <<string>>s,
	or unquoted as a sequence of one or more <<custom-ident>>.

	Note: This means most punctuation characters and digits at the start of
	each token must be escaped in unquoted font family names.

	<div class="example invalid" id="ex-no-unquoted-punctuation">
		To illustrate this, the following declarations are invalid:

		<pre>
		font-family: Red/Black, sans-serif;
		font-family: "Lucida" Grande, sans-serif;
		font-family: Ahem!, sans-serif;
		font-family: test@foo, sans-serif;
		font-family: #POUND, sans-serif;
		font-family: Hawaii 5-0, sans-serif;
		</pre>
	</div>

	Any identifier
	which could be misinterpreted
	as a pre-defined keyword in the font-family value definition,
	or the [=CSS-wide keywords=],
	is not allowed.

	Note: this means that if you really have a font
	whose name
	is the same as one of the <<generic-font-family>> names,
	or the system font names,
	or the [=CSS-wide keywords=],
	it <em>must</em> be quoted.

	<div class="example" id="ex-valid-unusual-generic-like">
		To illustrate this,
		the following unusual font family names are valid
		because they are quoted:

		<pre>
			font-family: "sans-serif", sans-serif;
			font-family: "default", sans-serif;
			font-family: "initial", sans-serif;
			font-family: "inherit", sans-serif;
		</pre>
	</div>

	If a sequence of identifiers is given as a <<font-family-name>>,
	the computed value is the name
	converted to a string
	by joining all the identifiers in the sequence by single spaces.

	To avoid mistakes in escaping,
	it is recommended to quote font family names
	that contain white space, digits,
	or punctuation characters other than hyphens:

	<div class="example" id="ex-best-quote">
		Quoting font families prevents escaping mistakes.

		<pre>
		body { font-family: "New Century Schoolbook", serif }

		&lt;body style="font-family: '21st Century', fantasy">
		</pre>
	</div>

	Font family <em>names</em> that happen to be the same as
	a 'font-family!!property' keyword value
	(e.g. <a>CSS-wide keywords</a> such as ''inherit'', or
	<<generic-font-family>> keywords such as ''serif'')
	must be quoted to prevent confusion
	with the keywords of the same names.
	UAs must not consider these keywords as matching the <<font-family-name>> type.

<h4 id="generic-family-name-syntax">
Syntax of <<generic-font-family>>
</h4>

<pre class=prod>
	<dfn><<generic-font-family>></dfn> = <<generic-font-script-specific>>| <<generic-font-complete>> | <<generic-font-incomplete>>
	<dfn><<generic-font-script-specific>></dfn> = <l>''generic(fangsong)''</l> | <l>''generic(kai)''</l> | <l>''generic(khmer-mul)''</l> |  <l>''generic(nastaliq)''</l>
	<dfn><<generic-font-complete>></dfn> = <l>''serif''</l> | <l>''sans-serif''</l> | <l>''system-ui''</l> | <l>''cursive''</l> | <l>''fantasy''</l> | <l>''font-family/math''</l> | <l>''monospace''</l>
	<dfn><<generic-font-incomplete>></dfn> = <l>''ui-serif''</l> | <l>''ui-sans-serif''</l> | <l>''ui-monospace''</l> | <l>''ui-rounded''</l>
</pre>

	To make the syntax less succeptible to clashes, more recently defined generic font families are identified using a functional syntax.

	<div class="example" id="ex-generic-functional">
		<pre>
		body { font-family: "Adobe Fangsong Std R", generic(fangsong), serif}
		</pre>

		The first choice in this example is a specific, named font, in Fang Song (仿宋) style.
		The family name is enclosed in quotes as it contains space characters.
		The second is a recently added script-specific generic font; it is unicode-range specific
		and so may not match to an actual installed font on some systems;
		but if it exists it will be an example of the requested style.
		The third is a universal generic font, which is guaranteed to match on all systems.
	</div>

<h4 id="system">
Syntax of <<system-font-family-name>>
</h4>

	<pre class="prod">
		<l><<system-font-family-name>></l> = <l>''caption''</l> | <l>''icon''</l> | <l>''menu''</l> | <l>''message-box''</l> | <l>''small-caption''</l> | <l>''status-bar''</l>
	</pre>

<h4 id="font-families">
Relationship Between Faces and Families
</h4>

	A font family name only specifies a name given to a set of font faces;
	it does not specify an individual face.

	<div class="example" id="ex-futura-matches">
		For example, given the availability of the fonts below,
		Futura would match but Futura Medium would not:
		<figure>
			<img alt="family and face names" src="images/familyvsfacename.png" width="597" height="151">
			<figcaption>Family and individual face names</figcaption>
		</figure>
	</div>

	Note: The CSS definition of font attributes used for selection
	are explicitly not intended to define a font taxonomy.
	A type designer's idea of a family can often extend
	to a set of faces that vary along axes other than just
	the standard axes of
	weight ('font-weight!!property'),
	width ('font-width!!property'),
	and slant ('font-style!!property').
	A family can vary along axes that are unique to that family.
	The CSS font selection mechanism merely
	provides a way to determine the “closest” match
	when substitution is necessary.

	Note: The precise way a set of fonts are grouped into font families
	varies depending upon the platform font management APIs.
	For example, the Windows GDI API only allows four faces to be grouped into a family,
	while the DirectWrite API,
	Core Text API,
	and other platforms support
	font families with a variety of weights, widths, and slopes
	(see [[#platform-props-to-css]] for more details).

	See [[#localized-name-matching]] below for information on how
	font-family names are matched.

<h4 id="generic-font-families">
Generic font families</h4>

	A generic font family is a font family which has a standard name (as defined by CSS), but which is an alias for an existing installed font family present on the system.
	However, a single generic font family may be a [=composite face=]
	combining different typefaces based on such things as
	the Unicode range of the character,
	the <a>content language</a> of the containing element,
	user preferences, system settings, etc.
	Different generic font families may map to the same used font.

	<wpt>
		generic-family-keywords-001.html
		generic-family-keywords-002.html
	</wpt>

	Note: Generic font families are intended to be widely implemented on many platforms, unlike arbitrary <<font-family-name>>s which are usually platform-specific names. They are expected to map to different fonts on different platforms. Authors may specify these generic family names if they desire their text to follow a particular design on many platforms, and are not particular about which specific font is chosen on those platforms.

	User agents should provide reasonable default choices for the generic font families,
	that express the characteristics of each family as well as possible,
	within the limits allowed by the underlying technology.
	User agents are encouraged to allow users to select alternative faces for the generic font families.

	<dl dfn-for="font-family,<generic-font-family>" dfn-type=value>
	    <dt id="serif-def"><dfn>serif</dfn>
	    <dd>
	        Serif fonts represent
	        glyphs that have finishing strokes,
	        flared or tapering ends,
	        or have actual serifed endings (including slab serifs).
	        Serif fonts are typically proportionately-spaced.
	        They often display a greater variation between thick and thin strokes
	        than fonts from the ''sans-serif'' generic font family.

			Note: ''serif'' and ''sans-serif''
			only apply to a small handful of writing scripts.
			Their use as generic font families in CSS is historical,
			and reflects the Latin-centric nature
			of early Web development.
			Better and more widely applicable names would have been,
			for example, "modulated" and "monoline".
			However, for reasons of Web compatibility,
			these names cannot be changed.

			CSS uses the term "serif" to apply to a font for any script,
			although other names might be more familiar for particular scripts,
			such as Mincho (Japanese),
			Sung or Song (Chinese),
			Batang (Korean).
			For Arabic, the Naskh style would correspond to ''serif''.

			''serif'' must always map to at least one matched font face.

			Note: No guarantee is placed on the character coverage of that font
			face. Therefore, the font ''serif'' is mapped to may not end up being
			used for all content.

			<figure>
				<img alt="sample serif fonts" src="images/serifexamples.png" width="586" height="110">
				<figcaption>Sample serif fonts</figcaption>
			</figure>

		<dt id="sans-serif-def"><dfn>sans-serif</dfn>
		<dd>
			Glyphs in sans-serif fonts,
			as the term is used in CSS,
			are generally low contrast
			(vertical and horizontal stems have the close to the same thickness)
			and have stroke endings that are plain
			(without any flaring, cross stroke, or other ornamentation).
			Sans-serif fonts are typically proportionately-spaced.
			They often have little variation between thick and thin strokes,
			compared to fonts from the ''serif'' family.
			CSS uses the term "sans-serif" to apply to a font for any script,
			although other names might be more familiar for particular scripts,
			such as Gothic (Japanese),
			Hei (Chinese),
			or Gulim (Korean).

			''sans-serif'' must always map to at least one matched font face.

			Note: No guarantee is placed on the character coverage of that font
			face. Therefore, the font ''sans-serif'' is mapped to may not end up being
			used for all content.

			<figure>
				<img alt="sample sans-serif fonts" src="images/sansserifexamples.png" width="621" height="117">
				<figcaption>Sample sans-serif fonts</figcaption>
			</figure>

		<dt id="cursive-def"><dfn>cursive</dfn>
		<dd>
			Glyphs in cursive fonts generally use a script style,
			and the result looks more like handwritten pen or brush writing than printed letterwork.
			CSS uses the term "cursive" to apply to a font for any script,
			although other names such as Chancery, Brush, Swing and Script are also used in font names.

			<figure>
				<img alt="sample cursive fonts" src="images/cursiveexamples.png" width="493" height="150">
				<figcaption>Sample cursive fonts</figcaption>
			</figure>

		<dt id="fantasy-def"><dfn>fantasy</dfn>
		<dd>
			Fantasy fonts are primarily decorative or expressive fonts
			that contain decorative or expressive representations of characters.
			These do not include Pi or Picture fonts which do not represent actual characters.

			<figure>
				<img alt="sample fantasy fonts" src="images/fantasyexamples.png" width="763" height="114">
				<figcaption>Sample fantasy fonts</figcaption>
			</figure>

		<dt id="monospace-def"><dfn>monospace</dfn>
		<dd>
			The sole criterion of a monospace font is that all glyphs have the same fixed width.
			This is often used to render samples of computer code.

			''monospace'' must always map to at least one matched font face.

			Note: No guarantee is placed on the character coverage of that font
			face. Therefore, the font ''monospace'' is mapped to may not end up being
			used for all content.

			<figure>
				<img alt="sample monospace fonts" src="images/monospaceexamples.png" width="608" height="102">
				<figcaption>Sample monospace fonts</figcaption>
			</figure>

		<dt id="system-ui-def"><dfn>system-ui</dfn>
		<dd>
			This generic font family lets text render with the default user interface font
			(which, as with all [[#generic-font-families]], may be a composite font)
			on the platform on which the UA is running.
			A cross-platform UA should use different fonts on its different supported platforms.
			The purpose of ''system-ui'' is to allow web content
			to integrate with the look and feel of the native OS.
			This is useful for hybrid, web or cross-platform applications.

			<wpt>
				system-ui-ar.html
				system-ui-ja-vs-zh.html
				system-ui-ja.html
				system-ui-mixed.html
				system-ui-ur-vs-ar.html
				system-ui-ur.html
				system-ui-zh.html
				system-ui.html
			</wpt>

			The precise font(s) used will depend on factors such as 
			platform support, platform language, locale settings, 
			user preferences, Unicode coverage and the content language.
			UA may optionally choose to use the text rendering engine provided by the platform when using
			''system-ui'' to match the appearance of the default user interface more closely.

			<div class="example" id="ex-system-ui-opaque">
				As with other generic font families,
				the substitution of specific installed fonts for ''system-ui''
				does not affect the computed style.

				<pre>
				&lt;div id="system-text" style="font-family: system-ui"&gt;&lt;/div&gt;
				...
				window.getComputedStyle(document.getElementById("system-text")).getPropertyValue("font-family");
				</pre>

				The script above should not have any knowledge of how ''system-ui''
				is expanded to include a collection of system user interface fonts.
				In particular, the above script should yield a result of "system-ui" on every platform.
			</div>

			Note: ''system-ui'' is highly dependent on the platform environment as multiple factors may 
			affect the default user interface font, and may have verying level of text rendering support.
			This may cause the displayed typeface to be undesirable for some end users 
			(e.g. Simplified Chinese users might get a monospaced serif font on older version of Windows; 
			''lang'' attribute might not affect displayed font in cases like ''lang="uk"'' in Russian locale
			or ''lang="ja"'' in Chinese locale). 
			Some operating system vendors does not offer means to customise ''system-ui'', 
			unlike UAs that generally allow users to customise the generic ''sans-serif'' or ''serif'' font family.
			As the name implies, ''system-ui'' is intended for use with UI elements in web application, and not for large paragraphs of text or articles.

		<dt id="math-def"><dfn for=font-family>math</dfn>
		<dd>
			This font family is intended for use with mathematical expressions.

			<!-- largely from https://docs.microsoft.com/en-us/typography/opentype/spec/math -->

			Such fonts may include additional data
			(for example, the OpenType MATH table)
			to help with the hierarchical process of equation layout.
			In particular, they may contain
			stylistic and stretching glyph variants
			useful in setting mathematical equations.

		<dt id="generic(fangsong)-def"><dfn>generic(fangsong)</dfn>
		<dd>
			This font family is used for Fang Song (仿宋) typefaces in Chinese.
			Fang Song is a relaxed, intermediate form
			between Song (''serif'') and Kai (''generic(kai)'').
			Typically, the horizontal lines are tilted,
			the endpoint flourishes are smaller,
			and there is less variation in stroke width,
			compared to a Song style.
			Fang Song is often used for official Chinese Government documents.

			Note: ''generic(fangsong)'' might not map to any locally installed font,
			but if it does, that font will be in Fang Song style.

			<figure>
				<img style="width:75vw" alt="" src="images/fangsong.svg" width="800" height="380">
				<figcaption>Chinese text displayed with sample fang song fonts</figcaption>
			</figure>

		<dt id="generic(kai)-def"><dfn>generic(kai)</dfn>
		<dd>
			This font family is used in
			Simplified &amp; Traditional Chinese.
			A major typeface, which provides calligraphic styles for Chinese text.
			It shows notable handwriting features.
			Kai is commonly used in official documents and textbooks.
			Most official documents in Taiwan use Kai in full text.
			Kai can also be combined with other typefaces
			to be used in text that needs to be differentiated
			from the rest of the content,
			for example, headlines, references, quotations, and dialogs.

			Note: ''generic(kai)'' might not map to any locally installed font,
			but if it does, that font will be in Kai style.

			<figure>
				<img style="width:75vw" alt="" src="images/kaiti.svg" width="800" height="380">
				<figcaption>Chinese text displayed with sample kai fonts</figcaption>
			</figure>
		</dd>

		<dt id="generic(khmer-mul)-def"><dfn>generic(khmer-mul)</dfn>
		<dd>
			This font family is used in
			the Khmer language (used in Cambodia),
			for titles and headings,
			or to emphasise important names or nouns.
			Compared to the upright (âksâr chôr) style,
			which is used for regular text,
			âksâr mul is characterized by 
			heavier, more rounded letter shapes, 
			and may include more ligated forms.

			Despite the visually heavier style,
			the font weight for regular text in 
			''generic(khmer-mul)'' is unchanged (400).

			Note: ''generic(khmer-mul)'' might not map to
			any locally installed font,
			but if it does, that font will be in âksâr mul style.

			<figure>
				<img style="width:30vw" alt="" src="images/vi-tu-comparison.png" width="512" height="625">
				<figcaption>Cambodian text displayed in:
					(top) âksâr chôr style, set in Khmer OS Battambang;
					(center) âksâr mul style, set in Khmer OS Moul v6, with no ligatures;
					(bottom) âksâr mul style, set in Khmer OS Moul v4, with two ligatures. All fonts by Dan Hong.
				</figcaption>
			</figure>
		</dd>

		<dt id="generic(nastaliq)-def"><dfn>generic(nastaliq)</dfn>
		<dd>
			This font family is the standard way of writing Urdu and Kashmiri,
			and is also often a preferred style for Persian and other language text,
			especially in literary genres such as poetry.
			Key features include a sloping baseline for joined letters,
			and overall complex shaping and positioning for base letters and diacritics alike.
			There are also distinctive shapes for many glyphs and ligatures.
			It is important not to fall back to a naskh style
			for languages such as Urdu and Kashmiri.

			Note: ''generic(nastaliq)'' might not map to any locally installed font,
			but if it does, that font will be in Nastaliq style.

			<figure>
				<img style="width:25vw" alt="السلام علیکم" src="images/urdu-nastaliq.svg" width="600" height="346">
				<figcaption>Urdu text displayed with a sample nastaliq font (Noto Nastaliq Urdu)</figcaption>
			</figure>

			<figure>
				<img style="width:25vw" alt="السلام علیکم" src="images/urdu-naskh.svg" width="600" height="346">
				<figcaption>Urdu text displayed with a fallback naskh font (Scheherazade New)</figcaption>
			</figure>

		<dt id="ui-serif-def"><dfn>ui-serif</dfn>
		<dd>
			This font family is used for the serif variant of the system's
			user interface. The purpose of ''ui-serif'' is to allow web
			content to integrate with the look and feel of the native OS.

			Note: ''ui-serif'' is not expected to map to any font on platforms
			without an appropriate system font.

			Note: see notes on ''system-ui'' for potential issues.

			<div class="example" id="ex-sample-ui-serif">
				<figure>
					<img alt="sample ui-serif font" src="images/ui-serif.png" width="743" height="185">
					<figcaption>Sample ui-serif font on macOS Catalina and iOS 13: New York</figcaption>
				</figure>
			</div>

		<dt id="ui-sans-serif-def"><dfn>ui-sans-serif</dfn>
		<dd>
			This font family is used for the sans-serif variant of the system's
			user interface. The purpose of ''ui-sans-serif'' is to allow web
			content to integrate with the look and feel of the native OS.

			Note: ''ui-sans-serif'' is not expected to map to any font on platforms
			without an appropriate system font.

			Note: see notes on ''system-ui'' for potential issues.

			<div class="example" id="ex-sample-ui-sans">
				<figure>
					<img alt="sample ui-sans-serif font" src="images/ui-sans-serif.png" width="743" height="149">
					<figcaption>Sample ui-sans-serif font on macOS Catalina and iOS 13: San Francisco</figcaption>
				</figure>
			</div>

		<dt id="ui-monospace-def"><dfn>ui-monospace</dfn>
		<dd>
			This font family is used for the monospaced variant of the
			system's user interface. The purpose of ''ui-monospace'' is to
			allow web content to integrate with the look and feel of the
			native OS.

			Note: ''ui-monospace'' is not expected to map to any font on platforms
			without an appropriate system font.

			Note: see notes on ''system-ui'' for potential issues.

			<div class="example" id="ex-sample-ui-mono">
				<figure>
					<img alt="sample ui-monospace font" src="images/ui-monospace.png" width="743" height="145">
					<figcaption>Sample ui-monospace font on macOS Catalina and iOS 13: SF Mono</figcaption>
				</figure>
			</div>

		<dt id="ui-rounded-def"><dfn>ui-rounded</dfn>
		<dd>
			This font family is used for the rounded variant of the system's
			user interface. The purpose of ''ui-rounded'' is to allow web
			content to integrate with the look and feel of the native OS.

			Note: ''ui-rounded'' is not expected to map to any font on platforms
			without an appropriate system font.

			Note: see notes on ''system-ui'' for potential issues.

			<div class="example" id="ex-sample-ui-rounded">
				<figure>
					<img alt="sample ui-rounded font" src="images/ui-rounded.png" width="743" height="180">
					<figcaption>Sample ui-rounded font on macOS Catalina and iOS 13: SF Rounded</figcaption>
				</figure>
			</div>
	</dl>

<!--
████████  ███████  ██    ██ ████████         ██      ██ ████████ ████  ██████   ██     ██ ████████
██       ██     ██ ███   ██    ██            ██  ██  ██ ██        ██  ██    ██  ██     ██    ██
██       ██     ██ ████  ██    ██            ██  ██  ██ ██        ██  ██        ██     ██    ██
██████   ██     ██ ██ ██ ██    ██    ███████ ██  ██  ██ ██████    ██  ██   ████ █████████    ██
██       ██     ██ ██  ████    ██            ██  ██  ██ ██        ██  ██    ██  ██     ██    ██
██       ██     ██ ██   ███    ██            ██  ██  ██ ██        ██  ██    ██  ██     ██    ██
██        ███████  ██    ██    ██             ███  ███  ████████ ████  ██████   ██     ██    ██
-->

<h3 id="font-weight-prop">Font weight: the 'font-weight!!property' property</h3>

	<pre class="propdef">
	Name: font-weight
	Value: <<font-weight-absolute>> | bolder | lighter
	Initial: normal
	Applies to: all elements and text
	Inherited: yes
	Percentages: n/a
	Computed value: a number, see below
	Animation type: by computed value type
	</pre>

	<wpt>
		font-weight-bolder-001.xht
		font-weight-lighter-001.xht
		font-weight-normal-001.xht
		font-weight-sign-function.html
		test-synthetic-bold.html
		synthetic-bold-space-width.html
		animations/font-weight-composition.html
		parsing/font-weight-computed.html
		parsing/font-weight-invalid.html
		parsing/font-weight-valid.html
		variations/font-parse-numeric-stretch-style-weight.html
		variations/font-weight-interpolation.html
		variations/font-weight-lighter-bolder.html
		variations/font-weight-matching-installed-fonts.html
		variations/font-weight-matching.html
		variations/font-weight-metrics.html
		variations/font-weight-parsing.html
	</wpt>

	The 'font-weight!!property' property specifies the weight of glyphs in the font,
	their degree of blackness, or stroke thickness.

	This property accepts values of the following:

	<pre class="prod"><dfn id="font-weight-absolute-values">&lt;font-weight-absolute&gt;</dfn> = [ normal | bold | <<number [1,1000]>> ]</pre>

	Values have the following meanings:

	<dl dfn-for=font-weight dfn-type=value>
		<dt id="font-weight-numeric-values"><dfn><<number [1,1000]>></dfn>
		<dd>
			Each number indicates a weight that is at least as dark as its predecessor.
			Only values greater than or equal to 1, and less than or equal to 1000, are valid,
			and all other values are <a>invalid</a>.
			Numeric values typically correspond to the commonly used weight names below.

			<ul>
				<li>100 - Thin
				<li>200 - Extra Light (Ultra Light)
				<li>300 - Light
				<li>400 - Normal
				<li>500 - Medium
				<li>600 - Semi Bold (Demi Bold)
				<li>700 - Bold
				<li>800 - Extra Bold (Ultra Bold)
				<li>900 - Black (Heavy)
			</ul>

			Note: A font might internally provide its own weight name mappings,
			but those mappings within the font are disregarded in CSS.

		<dt><dfn>normal</dfn>
		<dd>
			Same as ''400''.

		<dt><dfn>bold</dfn>
		<dd>
			Same as ''700''.

		<dt><dfn>bolder</dfn>
		<dd>
			Specifies a bolder weight than the inherited value.
			See [[#relative-weights]].

		<dt><dfn>lighter</dfn>
		<dd>
			Specifies a lighter weight than the inherited value.
			See [[#relative-weights]].
	</dl>

	Font formats that use a scale other than a nine-step scale
	should map their scale onto the CSS scale
	so that 400 roughly corresponds with a face that would be labeled as Regular, Book, Roman
	and 700 roughly matches a face that would be labeled as Bold.
	Alternately, weights may be inferred from style names
	that correspond roughly with the scale above.
	The scale is relative,
	so a face with a larger weight value must never appear lighter.
	If style names are used to infer weights,
	care should be taken to handle variations in style names across locales.

<h4 id="relative-weights">
Relative Weights</h4>

	Specified values of ''bolder'' and ''lighter'' indicate weights
	relative to the weight of the parent element.
	The computed weight is calculated based on the inherited 'font-weight!!property' value
	using the chart below.

	<table id="bolderlighter" class="data">
		<thead>
			<tr>
				<th>Inherited value (<var>w</var>)
				<th>bolder
				<th>lighter
		<tbody>
			<tr><th><var>w</var> &lt; 100<td>400<td>No change
			<tr><th>100 &le; <var>w</var> &lt; 350<td>400<td>100
			<tr><th>350 &le; <var>w</var> &lt; 550<td>700<td>100
			<tr><th>550 &le; <var>w</var> &lt; 750<td>900<td>400
			<tr><th>750 &le; <var>w</var> &lt; 900<td>900<td>700
			<tr><th>900 &le; <var>w</var><td>No change<td>700
	</table>

	Note: The table above is equivalent to selecting the next relative bolder or lighter face,
	given a font family containing normal and bold faces
	along with a thin and a heavy face.
	Authors who desire finer control over the exact weight values used for a given element
	can use numerical values instead of relative weights.

<h4 id="missing-weights">
Missing weights</h4>

	Quite often there are only a few weights available for a particular font family.
	When a weight is specified for which no face exists, a face with a nearby weight is used.
	In general, bold weights map to faces with heavier weights and light weights map to faces with lighter weights.
	(See the [[#font-matching-algorithm]] for a precise definition.)

	<div class="example" id="ex-nearby-weights">
		The examples here illustrate which face is used for different weights.
		Grey indicates that a face for the desired weight does not exist, so a face with a nearby weight is used.

		<figure>
			<img alt="weight mappings for a family with 400, 700 and 900 weights" src="images/optimaweights.png" width="697" height="127">
			<figcaption>Weight mappings for a font family with 400, 700 and 900 weight faces</figcaption>
		</figure>

		<figure>
			<img alt="weight mappings for a family with 300, 600 weights" src="images/hiraginoweights.png" width="692" height="123">
			<figcaption>Weight mappings for a font family with 300 and 600 weight faces</figcaption>
		</figure>
	</div>

	Most user agents model a font as having a particular weight
	which often corresponds to one of the numbers in the nine-step scale
	described <a href="#font-weight-numeric-values">above</a>.
	While this is true of most fonts, some fonts might be configurable so as to support a range of weights.
	In this situation, the user agent uses a face with a weight as close as possible to the weight requested
	(see [[#font-matching-algorithm]] for the precise algorithm).
	In particular, a user agent using a font which supports a range of weights
	should behave the same as if a font is present at each individual weight in the range.
	For TrueType / OpenType fonts that use variations,
	the <code>wght</code> variation is used to implement varying weights.
	Fractional weights are valid.

	Although the practice is not well-loved by typographers,
	bold faces are often synthesized by user agents for families that lack actual bold faces.
	For the purposes of font matching,
	these faces must be treated as if they exist within the family.
	Authors can explicitly avoid this behavior by using the 'font-synthesis' property.

<!--
████████  ███████  ██    ██ ████████         ██      ██ ████ ████████  ████████ ██     ██
██       ██     ██ ███   ██    ██            ██  ██  ██  ██  ██     ██    ██    ██     ██
██       ██     ██ ████  ██    ██            ██  ██  ██  ██  ██     ██    ██    ██     ██
██████   ██     ██ ██ ██ ██    ██    ███████ ██  ██  ██  ██  ██     ██    ██    █████████
██       ██     ██ ██  ████    ██            ██  ██  ██  ██  ██     ██    ██    ██     ██
██       ██     ██ ██   ███    ██            ██  ██  ██  ██  ██     ██    ██    ██     ██
██        ███████  ██    ██    ██             ███  ███  ████ ████████     ██    ██     ██
-->

<h3 id="font-width-prop">
Font width: the 'font-width!!property' property</h3>

	<pre class="propdef">
	Name: font-width
	Value: normal | <<percentage [0,∞]>> | ultra-condensed | extra-condensed | condensed | semi-condensed | semi-expanded | expanded | extra-expanded | ultra-expanded
	Initial: normal
	Applies to: all elements and text
	Inherited: yes
	Percentages: Not resolved
	Computed value: a percentage, see below
	Animation type: by computed value type
	</pre>

	<wpt>
		font-stretch-01.html
		font-stretch-02.html
		font-stretch-03.html
		font-stretch-04.html
		font-stretch-05.html
		font-stretch-06.html
		font-stretch-07.html
		font-stretch-08.html
		font-stretch-09.html
		font-stretch-10.html
		font-stretch-11.html
		font-stretch-12.html
		font-stretch-13.html
		font-stretch-14.html
		font-stretch-15.html
		font-stretch-16.html
		font-stretch-17.html
		font-stretch-18.html
		animations/font-stretch-interpolation.html
		parsing/font-width-computed.html
		parsing/font-width-invalid.html
		parsing/font-width-valid.html
		variations/font-parse-numeric-stretch-style-weight.html
		variations/font-stretch.html
	</wpt>

	The 'font-width!!property' property selects a normal,
	condensed, or expanded face from a font family.
	Values are specified either as percentages
	or as keywords which map to a percentage
	as defined in the following table:

	<table id="widthmappings" class="data">
		<thead>
			<tr>
				<th>Absolute keyword value
				<th>Numeric value
		<tbody dfn-for=font-width dfn-type=value>
			<tr><th><dfn>ultra-condensed</dfn> <td>50%
			<tr><th><dfn>extra-condensed</dfn> <td>62.5%
			<tr><th><dfn>condensed</dfn>   <td>75%
			<tr><th><dfn>semi-condensed</dfn>  <td>87.5%
			<tr><th><dfn>normal</dfn>  <td>100%
			<tr><th><dfn>semi-expanded</dfn>   <td>112.5%
			<tr><th><dfn>expanded</dfn>    <td>125%
			<tr><th><dfn>extra-expanded</dfn>  <td>150%
			<tr><th><dfn>ultra-expanded</dfn>  <td>200%
		</table>

	<dfn value for=font-width><<percentage [0,∞]>></dfn>
	values represent the fractional width of the glyphs,
	with 100% representing “normal” glyph widths
	(as defined by the font designer).
	Values less than 0% are <a>invalid</a>.

	When a face does not exist for a given width,
	values less than 100% map to a narrower face if one exists, otherwise a wider face.
	Conversely, values greater than or equal to 100% map to a wider face if one exists, otherwise a narrower face.
	Some fonts might support a range of width values;
	if the requested width value is not available in the font,
	the closest supported value is used, using the same mapping rules
	(see the [[#font-matching-algorithm]] for the precise algorithm).
	For TrueType / OpenType fonts that support variations,
	the <code>wdth</code> variation is used to implement varying widths.

	<div class="example" id="ex-font-width-matching">
		The figure below shows how nine font-width property settings
		affect font matching for a font family containing a variety of discrete widths.
		Grey indicates a width for which no face exists and a different width is substituted:

		<figure>
			<img alt="width mappings for a family with condensed, normal and expanded faces" src="images/universwidths.png" width="722" height="128">
			<figcaption>Width mappings for a font family with condensed, normal and expanded width faces</figcaption>
		</figure>
	</div>

	{{getComputedStyle()}} always serializes its value as a <<percentage>>, regardless of how the value was specified by the author, or whether or not a keyword happens to map to the value.

	<h4 id="font-stretch-prop">
		Font width: the 'font-stretch!!property' legacy name alias</h4>

	For historical reasons,
	a <dfn property>font-stretch</dfn> property exists
	which is a [=legacy name alias=]
	and functions in the identical way to
	the 'font-width!!property'.

	<div class="example" id="ex-font-stretch-set">
		For example, here the legacy 'font-stretch!!property' is used
		on level one headings.

		<pre>
		h1 {font-stretch: condensed; }
		</pre>

		The specified value of the 'font-width!!property'
		on those headings
		becomes set to ''condensed'''.
	</div>

	<div class="example" id="ex-font-width-set">
		For example, here the 'font-width!!property' is used
		on level one headings.

		<pre>
		h1 {font-width: condensed; }
		</pre>

		The specified value of the 'font-stretch!!property'
		on those headings
		becomes set to ''condensed''.
	</div>

	<wpt>
		font-stretch-01.html
		font-stretch-02.html
		font-stretch-03.html
		font-stretch-04.html
		font-stretch-05.html
		font-stretch-06.html
		font-stretch-07.html
		font-stretch-08.html
		font-stretch-09.html
		font-stretch-10.html
		font-stretch-11.html
		font-stretch-12.html
		font-stretch-13.html
		font-stretch-14.html
		font-stretch-15.html
		font-stretch-16.html
		font-stretch-17.html
		font-stretch-18.html
		font-stretch-interpolation-math-functions.html
		animations/font-stretch-interpolation.html
		parsing/font-width-computed.html
		parsing/font-width-invalid.html
		parsing/font-width-valid.html
		variations/font-parse-numeric-stretch-style-weight.html
		variations/font-stretch.html
	</wpt>

	User agents must not synthesize condensed or expanded faces
	for font families which lack such faces
	and which do not have a width variation axis.
	In particular, user agents must not geometrically stretch such faces.

<!--
████████  ███████  ██    ██ ████████          ██████  ████████ ██    ██ ██       ████████
██       ██     ██ ███   ██    ██            ██    ██    ██     ██  ██  ██       ██
██       ██     ██ ████  ██    ██            ██          ██      ████   ██       ██
██████   ██     ██ ██ ██ ██    ██    ███████  ██████     ██       ██    ██       ██████
██       ██     ██ ██  ████    ██                  ██    ██       ██    ██       ██
██       ██     ██ ██   ███    ██            ██    ██    ██       ██    ██       ██
██        ███████  ██    ██    ██             ██████     ██       ██    ████████ ████████
-->

<h3 id="font-style-prop">
Font style: the 'font-style!!property' property</h3>

	<pre class="propdef">
	Name: font-style
	Value: normal | italic | left | right | oblique <<angle [-90deg,90deg]>>?
	Initial: normal
	Applies to: all elements and text
	Inherited: yes
	Percentages: n/a
	Computed value: the keyword specified, plus angle in degrees if specified
	Animation type: by computed value type; ''normal'' animates as ''oblique 0deg''
	<!-- https://github.com/w3c/csswg-drafts/issues/2505 -->
	</pre>

	<wpt>
		font-style-angle.html
		test-synthetic-italic-2.html
		test-synthetic-italic-3.html
		test-synthetic-italic.html
		animations/font-style-interpolation.html
		parsing/font-style-computed.html
		parsing/font-style-invalid.html
		parsing/font-style-valid.html
		variations/font-parse-numeric-stretch-style-weight.html
		variations/font-slant-1.html
		variations/font-slant-2a.html
		variations/font-slant-2b.html
		variations/font-slant-2c.html
		variations/font-slant-3.html
		variations/font-style-interpolation.html
		variations/font-style-parsing.html
		variations/slnt-backslant-variable.html
		variations/slnt-variable.html
		variations/variable-avar2-rvrn.html
		variations/variable-avar2-warp.html
		variations/variable-gpos-avar2.html
	</wpt>

	The 'font-style!!property' property allows italic or oblique faces to be selected.
	Italic forms are generally cursive in nature while oblique faces are typically sloped versions of the regular face.

	<div class="example" id="ex-faux-vs-italic">
		Compare the artificially sloped renderings of Palatino "a" and Baskerville "N" in grey
		with the actual italic versions:

		<figure>
			<img alt="artificial sloping vs. real italics" src="images/realvsfakeitalics.png" width="599" height="126">
			<figcaption>Artificial sloping versus real italics</figcaption>
		</figure>
	</div>

	Values have the following meanings:

	<dl dfn-for=font-style dfn-type=value>
		<dt><dfn>normal</dfn>
		<dd>
			Matches against a face that is classified as a normal face,
			one that is neither italic or obliqued.
			This represents an oblique value of "0".

		<dt><dfn>italic</dfn>
		<dd>
			Matches against a font that is labeled as an italic face,
			or an oblique face if one does not exist.
			The angle and direction of slant is unspecified.

		<dt><dfn>left</dfn></dt>
		<dd>
			Matches against a font that is labeled as an italic face,
			with a positive (clockwise) slant;
			or an oblique face with positive slant, if one does not exist.
		</dd>

		<dt><dfn>right</dfn></dt>
		<dd>
			Matches against a font that is labeled as an italic face,
			with a negative (counter-clockwise) slant;
			or an oblique face with negative slant, if one does not exist.
		</dd>

		<dt><dfn>oblique <<angle [-90deg,90deg]>>?</dfn>
		<dd>
			Controls matching against an oblique face.
			Positive angles represent a clockwise slant;
			negative angles represent a counter-clockwise slant.
			The lack of an <<angle>> represents ''14deg''.
			(Note that a font might internally provide its own mapping for "oblique",
			but the mapping within the font is disregarded.)
			Fractional and negative values are accepted; however,
			values less than -90deg or values greater than 90deg are <a>invalid</a>.
			If no oblique faces exist,
			<!-- https://github.com/w3c/csswg-drafts/issues/514#issuecomment-402010784 -->
			and 'font-synthesis-style' has the value auto,
			a synthetic oblique face will be generated.
	</dl>

	<figure>
		<img src="./images/contra-italic.png" width="800" height="204" alt="negative slant">
		<figcaption>An italic face with negative slant. 
			The font is Mf Autumn Breeze,
			by Misti Hammers.</figcaption>
	</figure>

	A font family might contain no italic or oblique faces,
	only an italic face and no oblique,
	only an oblique face and no italic,
	both an oblique and an italic,
	multiple oblique faces at various angles,
	or various combinations thereof.
	The font matching routine will select a font to use
	which is of the correct sign as the requested angle,
	and (if there are multiple such faces) closest to the requested angle.
	In general, for a requested angle greater or equal to 11deg,
	larger angles are preferred;
	otherwise, smaller angles are preferred.
	(See [[#font-matching-algorithm]].)
	For TrueType / OpenType fonts that use variations,
	the <code>slnt</code> variation is used to implement oblique values,
	and the <code>ital</code> variation with a value of 1 is used to implement the italic values.

	<!-- https://github.com/w3c/csswg-drafts/issues/3091 -->
	Note: the OpenType <code>slnt</code> axis is defined
	with a positive angle meaning a counter-clockwise slant,
	the opposite direction to CSS.
	The CSS implementation will take this into account
	when using variations
	to produce oblique faces.

	Issue: What direction should positive and negative obliques skew in vertical writing mode?
	How do we achieve skews in the opposite dimension
	(needed for vertical writing)?

	If no italic or oblique face is available,
	oblique faces may be synthesized by rendering non-obliqued faces
	with an artificial obliquing operation.
	The use of these artificially obliqued faces
	can be disabled using the 'font-synthesis' property.

	<!-- resolution on the "undefined" nature of synthetics: https://www.w3.org/2013/06/06-css-minutes.html#item03 -->

	Note: While oblique faces can be simulated by artificially sloping the glyphs of the regular face,
	this is not equivalent to a true oblique,
	in which optical stroke thicknesses are properly preserved despite the slant.
	It is always better to use an actual oblique font rather than rely on a synthetic version.

	For the purposes of font matching,
	User agents may treat ''italic'' as a synonym for ''oblique''.
	For user agents that treat these values distinctly,
	synthesis must not be performed for ''italic''.

	Note: Authors should also be aware that synthesized approaches might not be suitable
	for scripts like Cyrillic, where italic forms are very different in shape.
	It is always better to use an actual italic font rather than rely on a synthetic version.

	Note: Many scripts lack the tradition of mixing a cursive form within text rendered with a normal face.
	Chinese, Japanese and Korean fonts almost always lack italic or oblique faces.
	Fonts that support a mixture of scripts
	will sometimes omit specific scripts, such as Arabic,
	from the set of glyphs supported in the italic face.
	User agents should be careful about making <a>character map</a> assumptions across faces
	when implementing synthesis across fonts,
	as italic faces in a family can have different <a>character maps</a> than Roman faces.

<!--
████████  ███████  ██    ██ ████████          ██████  ████ ████████ ████████
██       ██     ██ ███   ██    ██            ██    ██  ██       ██  ██
██       ██     ██ ████  ██    ██            ██        ██      ██   ██
██████   ██     ██ ██ ██ ██    ██    ███████  ██████   ██     ██    ██████
██       ██     ██ ██  ████    ██                  ██  ██    ██     ██
██       ██     ██ ██   ███    ██            ██    ██  ██   ██      ██
██        ███████  ██    ██    ██             ██████  ████ ████████ ████████
-->

<h3 id="font-size-prop">
Font size: the 'font-size' property</h3>

	<pre class="propdef">
	Name: font-size
	Value: <<absolute-size>> | <<relative-size>> | <<length-percentage [0,∞]>> | ''font-size/math''
	Initial: medium
	Applies to: all elements and text
	Inherited: yes
	Percentages: refer to parent element's font size
	Computed value: an absolute length
	Animation type: by computed value type
	</pre>

	<wpt>
		font-size-relative-across-calc-ff-bug-001.html
		font-size-zero-1.html
		font-size-zero-2.html
		font-size-zero-3.html
		font-size-zero-ligatures.html
		font-size-xxx-large.html
		rem-in-monospace.html
		animations/font-size-composition.html
		animations/font-size-interpolation-001.html
		animations/font-size-interpolation-002.html
		animations/font-size-interpolation-003.html
		parsing/font-size-computed.html
		parsing/font-size-invalid.html
		parsing/font-size-valid.html
	</wpt>

	This property indicates the desired height of glyphs from the font.
	For scalable fonts, the font-size is a scale factor applied to the EM unit of the font.
	For non-scalable fonts, the font-size is converted into absolute units
	and matched against the declared font-size of the font,
	using the same absolute coordinate space for both of the matched values.

	Note: There is no requirement on how closely a glyph should fit its EM box.
	Individual fonts can have a different apparent visual size
	when rendered at the same 'font-size'.
	Additionally, glyphs might render arbitrarily far outside their EM box;
	and if they overflow their <a>containing block</a>
	can induce <a>ink overflow</a>.

	Values have the following meanings:

	<dl>
		<dt><dfn type><<absolute-size>></dfn>
		<dd>
			An <<absolute-size>> keyword refers to an entry in a table of font sizes
			computed and kept by the user agent.
			See [[#absolute-size-mapping]].

			Possible values are:

			<pre class=prod>[ xx-small | x-small | small | medium | large | x-large | xx-large | xxx-large ]</pre>

		<dt><dfn type><<relative-size>></dfn>
		<dd>
			A <<relative-size>> keyword is interpreted
			relative to the computed 'font-size' of the parent element
			and possibly the table of font sizes. Possible values are:

			<pre class=prod>[ larger | smaller ]</pre>

			If the parent element has a keyword font size in the absolute size keyword mapping table,
			''larger'' may compute the font size to the next entry in the table,
			and ''smaller'' may compute the font size to the previous entry in the table.
			For example, if the parent element has a font size of ''font-size:medium'',
			specifying a value of ''larger'' may make the font size of the child element ''font-size:large''.

			Instead of using next and previous items in the previous keyword table,
			User agents may instead use a simple ratio
			to increase or decrease the font size
			relative to the parent element.
			The specific ratio is unspecified,
			but should be around 1.2&ndash;1.5.
			This ratio may vary across different elements.

			Note: A sight-impaired user may request a user agent use a higher ratio than default,
			in order to aid readability.
			In addition, a user agent may choose to use different ratios
			when it detects paragraph text as opposed to title text.

		<dt><dfn value for=font-size><<length-percentage [0,∞]>></dfn>
		<dd>
			A length value specifies an absolute font size
			(independent of the user agent's font table).
			Negative lengths are invalid.

			A percentage value specifies an absolute font size relative
			to the parent element's computed 'font-size'.
			Negative percentages are invalid.

			Note: Use of percentage values or <a>font-relative lengths</a>
			such as ''em''s and ''rem''s
			leads to more robust and cascadable style sheets.
		<dt id="font-size-math"><dfn value for=font-size>math</dfn></dt>
		<dd>
			Special <a href="https://w3c.github.io/mathml-core/#the-math-script-level-property">
			mathematical scaling rules</a> must be applied
			when determining the computed value of the 'font-size'
			property.
		</dd>
	</dl>

	<div class="example" id="ex-specify-size">
		The following style sheet demonstrates
		various ways of specifying the font size.

		<pre>
		p { font-size: 12pt; }
		blockquote { font-size: larger }
		em { font-size: 150% }
		em { font-size: 1.5em }
		</pre>
	</div>

	Note: The used value of this property
	can differ from its computed value
	due to 'font-size-adjust'.
	However, child elements inherit the computed 'font-size' value,
	which is not affected by 'font-size-adjust'
	(otherwise, the effect of 'font-size-adjust' would compound).

	The actual value of this property can differ from the used value
	due to the unavailability of certain font sizes.


	<div class="example" id="ex-clamp-size">
		font-size can be clamped, for responsive typography.
		<pre>
		font-size: clamp(10px, ..., 36px);
		</pre>
	</div>
	<!-- https://github.com/w3c/csswg-drafts/issues/3739 -->

	<h4 id="absolute-size-mapping">
	Absolute Size Keyword Mapping Table</h4>

	The following table provides user agent guidelines for the absolute-size scaling factor
	and their mapping to HTML heading and absolute font-sizes.
	The ''font-size/medium'' value is used as the reference middle value.
	The user agent may fine-tune these values for different fonts or different types of display devices.

	<table class="data">
		<thead>
			<tr>
				<th>CSS absolute-size values
				<th>xx-small
				<th>x-small
				<th>small
				<th>medium
				<th>large
				<th>x-large
				<th>xx-large
				<th>xxx-large
		<tbody>
			<tr>
				<th>scaling factor
				<td>3/5
				<td>3/4
				<td>8/9
				<td>1
				<td>6/5
				<td>3/2
				<td>2/1
				<td>3/1
			<tr>
				<th>HTML headings
				<td>h6
				<td>&nbsp;
				<td>h5
				<td>h4
				<td>h3
				<td>h2
				<td>h1
				<td>&nbsp;
			<tr>
				<th>HTML <{font}> sizes
				<td>1
				<td>&nbsp;
				<td>2
				<td>3
				<td>4
				<td>5
				<td>6
				<td>7
	</table>

	Note: In CSS1, the suggested scaling factor between adjacent indexes was 1.5,
	which user experience proved to be too large.
	In CSS2, the suggested scaling factor for computer screen between adjacent indexes was 1.2
	which still created issues for the small sizes.
	The new scaling factor varies between each index to provide a better readability.

	To preserve readability, an UA applying these guidelines
	should nevertheless avoid creating font sizes
	of less than 9 device pixels per EM unit.

<!-- font-min size and font-max-size removed by CSSWG resolution
	https://github.com/w3c/csswg-drafts/issues/3739
-->

<!--
   ███    ████████        ██ ██     ██  ██████  ████████
  ██ ██   ██     ██       ██ ██     ██ ██    ██    ██
 ██   ██  ██     ██       ██ ██     ██ ██          ██
██     ██ ██     ██       ██ ██     ██  ██████     ██
█████████ ██     ██ ██    ██ ██     ██       ██    ██
██     ██ ██     ██ ██    ██ ██     ██ ██    ██    ██
██     ██ ████████   ██████   ███████   ██████     ██
-->

<h3 id="font-size-adjust-prop">
Relative sizing: the 'font-size-adjust' property</h3>

	<pre class="propdef">
	Name: font-size-adjust
	Value: none | <<number [0,∞]>>
	Initial: none
	Applies to: all elements and text
	Inherited: yes
	Percentages: N/A
	Computed value: a number or the keyword ''font-size-adjust/none''
	Animation type: by computed value type
	</pre>

	<wpt>
		font-size-adjust-001.html
		font-size-adjust-002.html
		font-size-adjust-003.xht
		font-size-adjust-005.xht
		font-size-adjust-006.xht
		font-size-adjust-007.xht
		font-size-adjust-008.xht
		font-size-adjust-009.html
		font-size-adjust-010.html
		font-size-adjust-011.html
		font-size-adjust-012.html
		font-size-adjust-013.html
		font-size-adjust-014.html
		font-size-adjust-interpolation-math-functions.html
		font-size-adjust-metrics-override.html
		font-size-adjust-order-001.html
		font-size-adjust-reload.html
		font-size-adjust-units-001.html
		font-size-adjust-zero-1.html
		font-size-adjust-zero-2.html
		size-adjust-03.html
		animations/font-size-adjust-composition.html
		animations/font-size-adjust-interpolation.html
		parsing/font-face-size-adjust.html
		parsing/font-size-adjust-computed.html
		parsing/font-size-adjust-invalid.html
		parsing/font-size-adjust-valid.html
	</wpt>

	For any given font size, the apparent size and effective legibility of text
	varies across fonts.
	For bicameral scripts such as Latin or Cyrillic that
	distinguish between upper and lowercase letters,
	the relative height of lowercase letters
	compared to their uppercase counterparts
	is a determining factor of legibility.
	This is commonly referred to as the <dfn>aspect value</dfn>
	and is equal to the x-height of a font
	divided by the font size.

	Note: For text which uses diacritics,
	too large an x-height will actually decrease legibility
	as the diacritics become cramped.

	In situations where font fallback occurs,
	fallback fonts might not share the same aspect value
	as the desired font family
	and will thus be less readable.
	The 'font-size-adjust' property is a way
	to preserve the readability of text when font fallback occurs.
	It does this by adjusting the font-size
	so that the x-height is the same
	regardless of the font used.

	<div class="example" id="ex-verdana-futura">
		The style defined below defines Verdana as the desired font family,
		but if Verdana is not available Futura or Times will be used.
		One paragraph also has font-size-adjust specified.

		<pre>
		p {
			font-family: Verdana, Futura, Times;
		}
		p.adj {
			font-size-adjust: 0.545;
		}

		&lt;p>Lorem ipsum dolor sit amet, ...&lt;/p>
		&lt;p class="adj">Lorem ipsum dolor sit amet, ...&lt;/p>
		</pre>

		Verdana has a relatively high aspect value of 0.545,
		meaning lowercase letters are relatively tall
		compared to uppercase letters,
		so at small sizes text appears legible.
		Times has a lower aspect value of 0.447,
		and so if fallback occurs,
		the text will be less legible at small sizes than Verdana
		unless font-size-adjust is also specified.
	</div>

	How text rendered in each of these fonts compares is shown below,
	the columns show text rendered in Verdana, Futura and Times.
	The same font-size value is used across cells
	within each row and red lines are included to show the differences in x-height.
	In the upper half, each row is rendered in the same font-size value.
	The same is true for the lower half,
	but in this half the 'font-size-adjust' property is also set
	to 0.545,
	so that the actual font size is adjusted
	to preserve the x-height of Verdana across each row.
	Note how small text remains relatively legible across each row in the lower half.

	<figure>
		<img alt="text with and without 'font-size-adjust'" src="images/fontsizeadjust.png" width="544" height="667">
		<figcaption>Text with and without the use of 'font-size-adjust'</figcaption>
	</figure>

	This property allows authors to specify an <a>aspect value</a> for an element
	that will effectively preserve the x-height of the first choice font,
	whether it is substituted or not.
	Values have the following meanings:

	<dl dfn-type=value dfn-for=font-size-adjust>
		<dt><dfn id="font-size-adjust-none-value">none</dfn>
		<dd>
			Do not preserve the font's x-height.

		<dt><dfn id="aspect-ratio-value"><<number [0,∞]>></dfn>

		<dd>
			Specifies the <a>aspect value</a> used in the calculation below
			to calculate the adjusted font size:

			<pre>c  =  ( a / a' ) s</pre>

			where:

			<pre>
			s  =  font-size value
			a  =  <a>aspect value</a> as specified by the 'font-size-adjust' property
			a' =  <a>aspect value</a> of actual font
			c  =  adjusted font-size to use
			</pre>

			Negative values are invalid.

			This value applies to any font that is selected
			but in typical usage it should be based on the <a>aspect value</a>
			of the first font in the font-family list.
			If this is specified accurately,
			the <code>(a/a')</code> term in the formula above
			is effectively 1 for the first font
			and no adjustment occurs.
			If the value is specified inaccurately,
			text rendered using the first font in the family list
			will display differently in older user agents
			that don't support 'font-size-adjust'.
	</dl>

	The value of 'font-size-adjust' affects the used value of 'font-size'
	but does not affect the computed value.
	It affects the size of relative units
	that are based on font metrics
	such as <code>ex</code> and <code>ch</code>
	but does not affect the size of <code>em</code> units.
	Since numeric values of 'line-height'
	refer to the computed size of 'font-size',
	'font-size-adjust' does not affect the used value of 'line-height'.

	Note: In CSS, authors often specify 'line-height'
	as a multiple of the 'font-size'.
	Since the 'font-size-adjust' property affects the used value of 'font-size',
	authors should take care setting the line height
	when 'font-size-adjust' is used.
	Setting the line height too tightly can result in
	overlapping lines of text in this situation.

	<div class="example" id="ex-calc-aspect">
		Authors can calculate the <a>aspect value</a> for a given font
		by comparing spans with the same content
		but different 'font-size-adjust' properties.
		If the same font-size is used, the spans will match
		when the 'font-size-adjust' value is accurate for the given font.

		Two spans with borders are used to determine the <a>aspect value</a> of a font.
		The 'font-size' is the same for both spans
		but the 'font-size-adjust' property is specified only for the right span.
		Starting with a value of 0.5,
		the aspect value can be adjusted
		until the borders around the two letters line up.

		<pre>
		p {
			font-family: Futura;
			font-size: 500px;
		}

		span {
			border: solid 1px red;
		}

		.adjust {
			font-size-adjust: 0.5;
		}

		&lt;p>&lt;span>b&lt;/span>&lt;span class="adjust">b&lt;/span>&lt;/p>
		</pre>

		<figure>
			<img alt="Futura with an aspect value of 0.5" src="images/beforefontsizeadjust.png" width="281" height="306">
			<figcaption>Futura with an <a>aspect value</a> of 0.5</figcaption>
		</figure>

		The box on the right is a bit bigger than the one on the left, so the <a>aspect value</a> of this font is something less than 0.5.
		Adjust the value until the boxes align.
	</div>

<!--
████████  ███████  ██    ██ ████████
██       ██     ██ ███   ██    ██
██       ██     ██ ████  ██    ██
██████   ██     ██ ██ ██ ██    ██
██       ██     ██ ██  ████    ██
██       ██     ██ ██   ███    ██
██        ███████  ██    ██    ██
-->

<h3 id="font-prop">
Shorthand font property: the 'font' property</h3>

	<pre class="propdef">
	Name: font
	Value: [ [ <<'font-style'>> ||
		<<font-variant-css2>> ||
		<<'font-weight'>> ||
		<<font-width-css3>> ]? <<'font-size'>> [ / <<'line-height'>> ]?
		<<'font-family'>># ] |
		<<system-font-family-name>>
	Initial: see individual properties
	Applies to: all elements and text
	Inherited: yes
	Percentages: see individual properties
	Computed value: see individual properties
	Animation type: see individual properties
	</pre>

	<wpt>
		inheritance.html
		font-shorthand-serialization-001.html
		font-shorthand-serialization-font-stretch.html
		font-shorthand-serialization-prevention.html
		font-shorthand-subproperties-reset.html
		quoted-generic-ignored.html
		parsing/font-computed.html
		parsing/font-invalid.html
		parsing/font-valid.html
		variations/font-shorthand.html
	</wpt>

	The syntax of this property is based on a traditional
	typographical shorthand notation
	to set multiple properties related to fonts.
	For historical and backwards-compatibility reasons,
	it is <em>almost</em> a shorthand property.

	The 'font!!property' property is,
	except as described below,
	a shorthand property for setting
	'font-style!!property', 'font-variant!!property',
	'font-weight!!property', 'font-width!!property',
	'font-size!!property', 'line-height', 'font-family!!property'
	at the same place in the stylesheet.

	Values for the 'font-variant!!property' property can also be included
	but only those supported in CSS 2.1;
	none of the 'font-variant!!property' values added in
	CSS Fonts Levels 3 or 4
	can be used in the
	'font!!property' shorthand:

	<pre class="prod"><dfn id="font-variant-css21-values"><<font-variant-css2>></dfn>
		= normal | small-caps</pre>

	Values for the 'font-width!!property' property can also be included
	but only those supported in CSS Fonts level 3,
	none of the 'font-width!!property' values added in this specification
	can be used in the 'font' shorthand:

	<pre class="prod"><dfn id="font-width-css3-values"><<font-width-css3>></dfn>
		= normal | ultra-condensed | extra-condensed | condensed |
		semi-condensed | semi-expanded | expanded | extra-expanded |
		ultra-expanded</pre>

	Therefore we have the following classification
	of font-related properties
	and their interaction with the 'font!!property' property:

	<dl>
		<dt>Set Explicitly</dt>
		<dd><p>These longhand properties may also be set using the 'font!!property' shorthand property:</p>
			<ul>
				<li>'font-family!!property'</li>
				<li>'font-size!!property'</li>
				<li>'font-width!!property'</li>
				<li>'font-stretch!!property' (css3)</li>
				<li>'font-style!!property'</li>
				<li>'font-variant-caps!!property' (css2)</li>
				<li>'font-weight!!property'</li>
				<li>'line-height'</li>
			</ul>
		</dd>
		<dt>Reset Implicitly</dt>
		<dd><p>These properties are a [=reset-only sub-property=] of the 'font!!property' property 
			and thus may not be set, but are reset to their initial values:</p>
			<ul>
				<li>'font-feature-settings!!property'</li>
				<li>'font-kerning!!property'</li>
				<li>'font-language-override!!property'</li>
				<li>'font-optical-sizing!!property'</li>
				<li>'font-size-adjust!!property'</li>
				<li>'font-variant-alternates!!property'</li>
				<li>'font-variant-caps!!property' (css3 and above)</li>
				<li>'font-variant-east-asian!!property'</li>
				<li>'font-variant-emoji!!property'</li>
				<li>'font-variant-ligatures!!property'</li>
				<li>'font-variant-numeric!!property'</li>
				<li>'font-variant-position!!property'</li>
				<li>'font-variation-settings!!property'</li>
			</ul>
		</dd>
		<dt>Cascaded Independently</dt>
		<dd><p>These (despite the property name starting with "font-")
			are not [=shorthand properties=] 
			and thus are neither set nor reset by the 'font!!property' property:</p>
			<ul>
				<li>'font-palette!!property'</li>
				<li>'font-synthesis-weight!!property'</li>
				<li>'font-synthesis-style!!property'</li>
				<li>'font-synthesis-small-caps!!property'</li>
			</ul>
		</dd>
	</dl>

	All subproperties of the 'font!!property' property
	in the Set Explicitly and Reset Implicitly groups
	are first reset
	to their initial values.

	Then, those properties the Set Explicitly group
	that are given explicit values
	in the 'font!!property' shorthand
	are set to those values.
	For a definition of allowed and initial values,
	see the individual longhand property definitions.

	<div class="example" id="ex-font-shorthand">
		<pre>
		p { font: 12pt/14pt sans-serif }
		p { font: 80% sans-serif }
		p { font: x-large/110% &quot;new century schoolbook&quot;, serif }
		p { font: bold italic large Palatino, serif }
		p { font: normal small-caps 120%/120% fantasy }
		p { font: condensed oblique 12pt &quot;Helvetica Neue&quot;, serif; }
		p { font: condensed oblique 25deg 753 12pt &quot;Helvetica Neue&quot;, serif; }
		</pre>

		In the second rule, the font size percentage value ("80%")
		refers to the computed 'font-size' of the parent element.
		In the third rule, the line height percentage ("110%")
		refers to the font size of the element itself.

		The first three rules do not specify
		the 'font-variant!!property' and
		'font-weight!!property' explicitly,
		so these properties
		receive their initial values (''font-variant/normal'').
		Notice that the font family name ''"new century schoolbook"'',
		which contains spaces,
		is enclosed in quotes.
		The fourth rule sets the 'font-weight!!property' to ''bold'',
		the 'font-style!!property' to ''italic'',
		and implicitly sets 'font-variant!!property' to ''font-variant/normal''.

		The fifth rule sets the 'font-variant!!property' (''small-caps''),
		the 'font-size!!property' (120% of the parent's font size),
		the 'line-height!!property' (120% of the font size) and
		the 'font-family!!property' (''fantasy'').
		It follows that the keyword <css>normal</css>
		applies to the two remaining properties:
		'font-style!!property' and 'font-weight!!property'.

		The sixth rule sets the 'font-style!!property',
		'font-width!!property',
		'font-size!!property', and
		'font-family!!property',
		the other font properties being set to their initial values.

		The seventh rule sets 'font-style!!property' to ''oblique 25deg'',
		'font-weight!!property' to ''753'', and
		'font-width!!property' to ''condensed''.
		Note that the ''25deg'' in this rule must be
		immediately following the "oblique" keyword.
	</div>

	Since the 'font-width!!property' property was not defined in CSS 2.1,
	when using 'font-width!!property' values within 'font' rules,
	authors should include a extra version compatible with older user agents:

	<pre>
		p {
			font: 80% sans-serif;   /* for older user agents */
			font: condensed 80% sans-serif;
		}
	</pre>

	System fonts can only be set as a whole;
	that is, the font family, size, weight, style, etc.
	are all set at the same time.
	These values can then be altered individually if desired.
	If no font with the indicated characteristics exists
	on a given platform,
	the user agent should either intelligently substitute
	(e.g., a smaller version of the ''caption'' font might be used
	for the ''small-caption'' font),
	or substitute a user agent default font.
	As for regular fonts,
	if, for a system font, any of the individual properties
	are not part of the operating system's available user preferences,
	those properties
	should be set to their initial values.

	That is why this property is "almost" a shorthand property:
	system fonts can only be specified with this property,
	not with 'font-family!!property' itself,
	so 'font!!property'
	allows authors to do more than the
	sum of its subproperties.
	However, the individual properties
	such as 'font-weight!!property'
	are still given values
	taken from the system font,
	which can be independently varied.

	Note that the keywords used for the system fonts listed above
	are only treated as keywords
	when they occur in the initial position,
	in other positions the same string is treated
	as part of the font family name:

	<pre>
		font: menu;        /* use the font settings for system menus */
		font: large menu;  /* use a font family named "menu" */
	</pre>

	<div class="example" id="ex-menu-font">
		<pre>
		button { font: 300 italic 1.3em/1.7em &quot;FB Armada&quot;, sans-serif }
		button p { font: menu }
		button p em { font-weight: bolder }
		</pre>

		If the font used for dropdown menus
		on a particular system
		happened to be, for example,
		9-point Charcoal, with a weight of 600,
		then P elements that were descendants of BUTTON
		would be displayed as if
		this rule were in effect:

		<pre>button p { font: 600 9pt Charcoal }</pre>

		Because the 'font!!property' shorthand
		resets to its initial value
		any property not explicitly given a value,
		this has the same effect as
		this declaration:

		<pre>
		button p {
			font-style: normal;
			font-variant: normal;
			font-weight: 600;
			font-size: 9pt;
			line-height: normal;
			font-family: Charcoal
		}
		</pre>
	</div>

<!--
████████  ███████  ██    ██ ████████          ██████  ██    ██ ██    ██ ████████ ██     ██ ████████  ██████  ████  ██████
██       ██     ██ ███   ██    ██            ██    ██  ██  ██  ███   ██    ██    ██     ██ ██       ██    ██  ██  ██    ██
██       ██     ██ ████  ██    ██            ██         ████   ████  ██    ██    ██     ██ ██       ██        ██  ██
██████   ██     ██ ██ ██ ██    ██    ███████  ██████     ██    ██ ██ ██    ██    █████████ ██████    ██████   ██   ██████
██       ██     ██ ██  ████    ██                  ██    ██    ██  ████    ██    ██     ██ ██             ██  ██        ██
██       ██     ██ ██   ███    ██            ██    ██    ██    ██   ███    ██    ██     ██ ██       ██    ██  ██  ██    ██
██        ███████  ██    ██    ██             ██████     ██    ██    ██    ██    ██     ██ ████████  ██████  ████  ██████
-->

<h3 id="font-synthesis-intro">
Controlling synthetic faces</h3>

	Synthetic font faces are a fallback strategy
	to provide an approximation to the requested font
	when a font family lacks a suitable face.

	<div class="example" id="ex-synthesis-types">
		For example, a user agent might:

		* synthesize a bold face by drawing a thin stroke around each glyph
		* synthesize small-caps, superscripts, or subscripts by
			rendering regular glyphs at a smaller size and positioning them appropriately
		* synthesize an oblique face by geometrical shearing of each glyph
	</div>

	Synthesis is a fallback strategy
	because the end result,
	while perhaps better than nothing at all,
	does not meet the level of quality
	of a face designed for the purpose.

	Variable fonts,
	where the font designer has provided
	one or more axes of variation
	do <em>not</em> count as font synthesis
	and their use is not affected by the 'font-synthesis' property.

<h4 id="font-synthesis-weight">
Controlling synthesized bold: The 'font-synthesis-weight' property</h4>

	<pre class="propdef">
	Name: font-synthesis-weight
	Value: auto | none
	Initial: auto
	Applies to: all elements and text
	Inherited: yes
	Percentages: N/A
	Computed value: specified keyword
	Media: visual
	Animation type: discrete
	</pre>

	<wpt>
		font-synthesis-weight-binary.html
		font-synthesis-weight-first-letter.html
		font-synthesis-weight-first-line.html
		font-synthesis-weight.html
		font-synthesis-weight-webfont-bold.html
		parsing/font-synthesis-weight-invalid.html
		parsing/font-synthesis-weight-valid.html
	</wpt>

	This property controls whether user agents are allowed
	to synthesize bold font faces
	when a font family lacks bold faces.

	<dl dfn-for=font-synthesis-weight dfn-type=value>
		<dt><dfn>auto</dfn>
		<dd>
			Synthesis of bold faces is allowed

		<dt><dfn>none</dfn>
		<dd>
			Synthesis of bold faces is not allowed
	</dl>

<h4 id="font-synthesis-style">
Controlling synthesized oblique: The 'font-synthesis-style' property</h4>

	<pre class="propdef">
	Name: font-synthesis-style
	Value: auto | none | oblique-only
	Initial: auto
	Applies to: all elements and text
	Inherited: yes
	Percentages: N/A
	Computed value: specified keyword
	Media: visual
	Animation type: discrete
	</pre>

	<wpt>
		font-synthesis-style-binary.html
		font-synthesis-style-first-letter.html
		font-synthesis-style-first-line.html
		font-synthesis-style.html
		parsing/font-synthesis-style-invalid.html
		parsing/font-synthesis-style-valid.html
	</wpt>

	This property controls whether user agents are allowed
	to synthesize oblique font faces
	when a font family lacks oblique faces.

	<dl dfn-for=font-synthesis-style dfn-type=value>
		<dt><dfn>auto</dfn>
		<dd>
			Synthesis of oblique faces is allowed

		<dt><dfn>none</dfn>
		<dd>
			Synthesis of oblique faces is not allowed

		<dt><dfn>oblique-only</dfn>
			<dd>
				Synthesis of oblique faces is allowed,
				but they must not be used as fallback
				if italic is specified
	</dl>

	<p id="vertical-oblique-synthesis">
		In vertical text,
		for positive oblique angles,
		the glyph is skewed
		such that the line-over edge shifts towards the line-right side
		while the line-under edge shifts towards the line-left side.
		For negative oblique angles,
		the glyph is skewed
		such that the line-over edge shifts towards the line-left side
		while the line-under edge shifts towards the line-right side.
		Skewing is about the center of the glyph.
	</p>

	<wpt>
		synthetic-oblique-out-of-capabilities-range.html
	</wpt>

	<!-- TODO make a more visually pleasing figure -->
	<figure>
		<img alt="synthetic oblique in vertical text" src="images/italics-vertical.png" width="78" height="213">
		<figcaption>Synthetic oblique in vertical text, positive oblique angle</figcaption>
	</figure>

<h4 id="font-synthesis-small-caps">
Controlling synthesized small caps: The 'font-synthesis-small-caps' property</h4>

	<pre class="propdef">
	Name: font-synthesis-small-caps
	Value: auto | none
	Initial: auto
	Applies to: all elements and text
	Inherited: yes
	Percentages: N/A
	Computed value: specified keyword
	Animation type: discrete
	</pre>

	<wpt>
		font-synthesis-small-caps-first-letter.html
		font-synthesis-small-caps-first-line.html
		font-synthesis-small-caps-not-applied.html
		font-synthesis-small-caps.html
		parsing/font-synthesis-small-caps-invalid.html
		parsing/font-synthesis-small-caps-valid.html
	</wpt>

	This property controls whether user agents are allowed
	to synthesize small caps font faces
	when a font family lacks small caps faces.

	<dl dfn-for=font-synthesis-small-caps dfn-type=value>
		<dt><dfn>auto</dfn>
		<dd>
			Synthesis of small caps faces is allowed

		<dt><dfn>none</dfn>
		<dd>
			Synthesis of small caps faces is not allowed
	</dl>

<h4 id="font-synthesis-position">
Controlling synthesized super- and subscripts: The 'font-synthesis-position' property</h4>

	<pre class="propdef">
	Name: font-synthesis-position
	Value: auto | none
	Initial: auto
	Applies to: all elements and text
	Inherited: yes
	Percentages: N/A
	Computed value: specified keyword
	Animation type: discrete
	</pre>

	<wpt>
		font-synthesis-position-001.html
		parsing/font-synthesis-position-invalid.html
		parsing/font-synthesis-position-valid.html
	</wpt>

	This property controls whether user agents are required to synthesize
	superscript and subscript glyphs for 'font-variant-position'
	when a font lacks them.

	<dl dfn-for=font-synthesis-position dfn-type=value>
		<dt><dfn>auto</dfn>
		<dd>
			Synthesis of superscript and subscript forms is required

		<dt><dfn>none</dfn>
		<dd>
			Synthesis of superscript and subscript forms is not allowed
	</dl>

<h4 id="font-synthesis">
Controlling synthetic faces: the 'font-synthesis' shorthand</h4>

	<pre class="propdef">
	Name: font-synthesis
	Value: none | [ weight || style || small-caps || position]
	Initial: weight style small-caps position
	Applies to: all elements and text
	Inherited: yes
	Percentages: N/A
	Computed value: specified keyword(s)
	Animation type: discrete
	</pre>

	<wpt>
		font-synthesis-01.html
		font-synthesis-02.html
		font-synthesis-03.html
		font-synthesis-04.html
		font-synthesis-05.html
		font-synthesis-06.html
		font-synthesis-07.html
		font-synthesis-08.html
		font-synthesis-style-oblique-only.html
		oblique-last-resort-weight-selection.html
		oblique-request-italic-only-family-no-crash.html
		synthetic-bold-space-width.html
		parsing/font-synthesis-computed.html
		parsing/font-synthesis-invalid.html
		parsing/font-synthesis-valid.html
	</wpt>

	This property is a shorthand for the 'font-synthesis-weight',
	'font-synthesis-style',
	'font-synthesis-small-caps',
	and 'font-synthesis-position' properties. Values are mapped as following:

	<table class='data'>
		<thead>
			<tr>
				<th>'font-synthesis' value
				<th>'font-synthesis-weight' value
				<th>'font-synthesis-style' value
				<th>'font-synthesis-small-caps' value</th>
				<th>'font-synthesis-position' value</th>
		<tbody>
			<tr>
				<th>none
				<td>none
				<td>none
				<td>none
				<td>none
			<tr>
				<th>weight
				<td>auto
				<td>none
				<td>none
				<td>none
			<tr>
				<th>style
				<td>none
				<td>auto
				<td>none
				<td>none
			<tr>
				<th>small-caps
				<td>none
				<td>none
				<td>auto
				<td>none
			<tr>
				<th>position
				<td>none
				<td>none
				<td>none
				<td>auto
			<tr>
				<th>weight style
				<td>auto
				<td>auto
				<td>none
				<td>none
			<tr>
				<th>weight small-caps
				<td>auto
				<td>none
				<td>auto
				<td>none
			<tr>
				<th>weight position
				<td>auto
				<td>none
				<td>none
				<td>auto
			<tr>
				<th>style small-caps
				<td>none
				<td>auto
				<td>auto
				<td>none
			<tr>
				<th>style position
				<td>none
				<td>auto
				<td>none
				<td>auto
			<tr>
				<th>small-caps position
				<td>none
				<td>none
				<td>auto
				<td>auto
			<tr>
				<th>weight style small-caps
				<td>auto
				<td>auto
				<td>auto
				<td>none
			<tr>
				<th>weight style position
				<td>auto
				<td>auto
				<td>none
				<td>auto
			<tr>
				<th>weight small-caps position
				<td>auto
				<td>none
				<td>auto
				<td>auto
			<tr>
				<th>style small-caps position
				<td>none
				<td>auto
				<td>auto
				<td>auto
			<tr>
				<th>weight style small-caps position
				<td>auto
				<td>auto
				<td>auto
				<td>auto
	</table>

	<div class="example" id="ex-no-obliqued-arabic">
		The style rule below disables the use of synthetically obliqued Arabic:

		<pre>*:lang(ar) { font-synthesis: none; }</pre>
	</div>

<!--
████████  ████████ ██    ██ ████████  ████████ ████████  ████ ██    ██  ██████
██     ██ ██       ███   ██ ██     ██ ██       ██     ██  ██  ███   ██ ██    ██
██     ██ ██       ████  ██ ██     ██ ██       ██     ██  ██  ████  ██ ██
████████  ██████   ██ ██ ██ ██     ██ ██████   ████████   ██  ██ ██ ██ ██   ████
██   ██   ██       ██  ████ ██     ██ ██       ██   ██    ██  ██  ████ ██    ██
██    ██  ██       ██   ███ ██     ██ ██       ██    ██   ██  ██   ███ ██    ██
██     ██ ████████ ██    ██ ████████  ████████ ██     ██ ████ ██    ██  ██████
-->

<h2 id="font-rendering-controls">
Font Rendering Controls</h2>

<h3 id="font-rendering-controls-introduction">
Introduction to Font Rendering Controls</h3>

	When using downloadable Web Fonts via ''@font-face'',
	the user agent needs to know what to do while the font is actively loading.
	Most web browsers have adopted some form of timeout:

	<table class='data'>
		<thead>
			<tr>
				<th>Browser
				<th>Timeout
				<th>Fallback
				<th>Swap
		<tbody>
			<tr>
				<th>Chrome 35+
				<td>3 seconds
				<td>yes
				<td>yes
			<tr>
				<th>Opera
				<td>3 seconds
				<td>yes
				<td>yes
			<tr>
				<th>Firefox
				<td>3 seconds
				<td>yes
				<td>yes
			<tr>
				<th>Internet Explorer
				<td>0 seconds
				<td>yes
				<td>yes
			<tr>
				<th>Safari
				<td>3 seconds
				<td>yes
				<td>yes
	</table>

	* Chrome and Firefox have a 3 second timeout after which the text is shown with the fallback font.
		Eventually, a swap occurs:
		the text is re-rendered with the intended font once it becomes available.
	* Internet Explorer has a 0 second timeout which results in immediate text rendering:
		if the requested font is not yet available,
		fallback is used,
		and text is rerendered later once the requested font becomes available.

	While these default behaviors are reasonable,
	they're unfortunately inconsistent across browsers.
	Worse, no single approach is sufficient to cover the range of use-cases
	required by modern user-experience&ndash; and performance&ndash;conscious applications.

	The Font Loading API [[CSS-FONT-LOADING-3]] allows a developer to override some of the above behaviors,
	but that requires scripting,
	a non-trivial amount of effort,
	and ultimately doesn't provide sufficient hooks to cover <em>all</em> reasonable cases.
	Additionally,
	the developer needs to either inline the loading script into their page
	or load an external library,
	introducing additional network latency before the fonts can be loaded
	and delaying text rendering.

	Design/performance-conscious web developers have a good sense
	for the relative importance of a given Web Font
	for the intended user experience.
	This specification provides them the ability to control
	font timeout and rendering behavior.
	Specifically, it lets developers:

	* Define the font display policy when
		text is ready to be painted:
		block, or paint with fallback.
	* Define the font display policy once
		the desired font is available:
		rerender text with the new font,
		or leave it with the fallback.
	* Define custom timeout values for each font.
	* Define custom display and timeout policies per element.

<!--
████████ ████ ██     ██ ████████ ██       ████ ██    ██ ████████
   ██     ██  ███   ███ ██       ██        ██  ███   ██ ██
   ██     ██  ████ ████ ██       ██        ██  ████  ██ ██
   ██     ██  ██ ███ ██ ██████   ██        ██  ██ ██ ██ ██████
   ██     ██  ██     ██ ██       ██        ██  ██  ████ ██
   ██     ██  ██     ██ ██       ██        ██  ██   ███ ██
   ██    ████ ██     ██ ████████ ████████ ████ ██    ██ ████████
-->

<h3 id="font-display-timeline">
The Font Display Timeline</h3>

	At the moment the user agent first attempts
	to use a given downloaded font face on a page,
	the font face's <dfn export local-lt="timer">font download timer</dfn> is started.
	This timer advances through three periods of time
	associated with the font face--
	the <a>block period</a>,
	the <a>swap period</a>, and
	the <a>failure period</a>--
	which dictate the rendering behavior of any elements using the font face:

	* The first period is the <dfn export local-lt="block period">font block period</dfn>.
		During this period,
		if the font face is not loaded,
		any element attempting to use it must instead
		<a>render with an invisible fallback font face</a>.
		If the font face successfully loads during the <a>block period</a>,
		the font face is then used normally.
	* The second period, occurring immediately after the <a>block period</a>,
		is the <dfn export local-lt="swap period">font swap period</dfn>.
		During this period,
		if the font face is not loaded,
		any element attempting to use it must instead
		<a>render with a fallback font face</a>.
		If the font face successfully loads during the <a>swap period</a>,
		the font face is then used normally.
	* The third period, occurring immediately after the <a>swap period</a>,
		is the <dfn export local-lt="failure period">font failure period</dfn>.
		If the font face is not yet loaded when this period starts,
		it's marked as a failed load,
		causing normal font fallback.
		Otherwise, the font face is used normally.

	To <dfn export>render with a fallback font face</dfn> for a given element,
	the user agent must find the first font face
	specified in the element's 'font-family!!property' list
	which is already loaded,
	and use that for rendering text.
	Doing this must not trigger loads of any of the fallback fonts.

	To <dfn export>render with an invisible fallback font face</dfn>
	for a given element,
	find a font face as per "<a>render with a fallback font face</a>".
	Create an anonymous font face
	with the same metrics as the selected font face
	but with all glyphs "invisible" (containing no "ink"),
	and use that for rendering text.
	Doing this must not trigger loads of any of the fallback fonts.

	<!-- Githubify issue -->
	Issue: ''fallback'' and ''optional'' can result in some faces in a family being used
	while others are required to fallback,
	giving a "ransom note" look.
	Perhaps require that all fonts in a family have the same behavior (all swapped in, or all fallback)?
	See also the @font-feature-values for controlling the behavior on a font family basis.

<h2 id="font-resources">
Font Resources</h2>

<!--
 ███████  ████████  ███████  ██    ██ ████████         ████████    ███     ██████  ████████
██     ██ ██       ██     ██ ███   ██    ██            ██         ██ ██   ██    ██ ██
██ ███ ██ ██       ██     ██ ████  ██    ██            ██        ██   ██  ██       ██
██ ███ ██ ██████   ██     ██ ██ ██ ██    ██    ███████ ██████   ██     ██ ██       ██████
██ █████  ██       ██     ██ ██  ████    ██            ██       █████████ ██       ██
██        ██       ██     ██ ██   ███    ██            ██       ██     ██ ██    ██ ██
 ███████  ██        ███████  ██    ██    ██            ██       ██     ██  ██████  ████████
-->

<h3 id="font-face-rule">
The <dfn id="at-font-face-rule">''@font-face''</dfn> rule</h3>

	The ''@font-face'' rule allows for linking to fonts
	that are automatically fetched and activated when needed.
	This allows authors to select a font
	that closely matches the design goals for a given page
	rather than limiting the font choice
	to a set of fonts available on a given platform.
	A set of font descriptors define the location of a font resource,
	either locally or externally,
	along with the style characteristics of an individual face.
	Multiple ''@font-face'' rules can be used to construct font families with a variety of faces.
	Using CSS font matching rules,
	a user agent can selectively download
	only those faces that are needed for a given piece of text.

	Its syntax is:

	<pre class=prod>
	@font-face {
		<<declaration-list>>
	}
	</pre>

	<wpt>
		downloadable-font-in-iframe-print.html
		downloadable-font-print.html
		variations/at-font-face-descriptors.html
	</wpt>

	The ''@font-face'' rule accepts the descriptors defined in this specification.

	Each ''@font-face''rule specifies a value for every font descriptor,
	either implicitly or explicitly.
	Those not given explicit values in the rule
	take the initial value listed with each descriptor in this specification.
	These descriptors apply solely within the context of the ''@font-face'' rule
	in which they are defined,
	and do not apply to document language elements.
	There is no notion of which elements the descriptors apply to
	or whether the values are inherited by child elements.
	When a given descriptor occurs multiple times in a given ''@font-face'' rule,
	only the last descriptor declaration is used
	and all prior declarations for that descriptor are ignored.

	<div class="example" id="ex-gentium">
		To use a downloadable font called Gentium:

		<pre>
		@font-face {
		font-family: Gentium;
		src: url(http://example.com/fonts/Gentium.woff);
		}

		p { font-family: Gentium, serif; }
		</pre>

		The user agent will download Gentium and use it when rendering text
		within paragraph elements.  If for some reason the site serving the font
		is unavailable, the default serif font will be used.
	</div>

	A given set of ''@font-face'' rules define a set of fonts
	available for use within the documents that contain these rules.
	When font matching is done, fonts defined using these rules
	are considered before other available fonts on a system.

	Downloaded fonts are only available to documents that reference them.
	The process of activating these fonts must not
	make them available to other applications
	or to documents that don't directly link to the same font.
	User agent implementers might consider it convenient
	to use downloaded fonts when rendering characters
	in other documents for which
	no other available font exists
	as part of the <em>installed font fallback</em> procedure.
	However, this would cause a security leak
	since the contents of one page would be able to affect other pages,
	something an attacker could use as an attack vector.
	These restrictions do not affect caching behavior,
	fonts are cached the same way other web resources are cached.

	<wpt>
		downloadable-font-scoped-to-document.html
		web-font-no-longer-accessible-when-stylesheet-removed.html
	</wpt>

	This at-rule follows the forward-compatible parsing rules of CSS.
	Like properties in a declaration block,
	declarations of any descriptors that are not supported by the user agent
	must be ignored.
	''@font-face'' rules require a font-family
	and src descriptor;
	if either of these are missing,
	the ''@font-face'' rule must not be considered
	when performing the <a href="#font-matching-algorithm">font matching algorithm</a>.

	In cases where user agents have limited platform resources
	or implement the ability to disable downloadable font resources,
	''@font-face'' rules must simply be ignored;
	the behavior of individual descriptors
	as defined in this specification
	should not be altered.

<!--
████████    ███    ██     ██ ████ ██       ██    ██
██         ██ ██   ███   ███  ██  ██        ██  ██
██        ██   ██  ████ ████  ██  ██         ████
██████   ██     ██ ██ ███ ██  ██  ██          ██
██       █████████ ██     ██  ██  ██          ██
██       ██     ██ ██     ██  ██  ██          ██
██       ██     ██ ██     ██ ████ ████████    ██
-->

<h3 id="font-family-desc">Font family: the '@font-face/font-family' descriptor</h3>

	<pre class='descdef'>
	Name: font-family
	Value: <<font-family-name>>
	For: @font-face
	Initial: N/A
	</pre>

	This descriptor defines the font family name
	that will be used in all CSS font family name matching.
	It overrides the font family names
	contained in the underlying font data.
	If the font family name is the same
	as a font family available in a given user's environment,
	it effectively hides the underlying font
	for documents that use the stylesheet.
	This permits a web author to freely choose font-family names
	without worrying about conflicts with font family names
	present in a given user's environment.
	Likewise, platform substitutions
	for a given font family name
	must not be used.

<!--
 ██████  ████████   ██████
██    ██ ██     ██ ██    ██
██       ██     ██ ██
 ██████  ████████  ██
      ██ ██   ██   ██
██    ██ ██    ██  ██    ██
 ██████  ██     ██  ██████
-->

<h3 id="src-desc">Font reference: the 'src!!descriptor' descriptor</h3>

	<pre class='descdef'>
	Name: src
	Value: <<font-src-list>>
	For: @font-face
	Initial: N/A
	</pre>

	This descriptor specifies the resource containing font data.
	Its value is
	a prioritized,
	comma-separated list
	of external references
	or locally-installed font face names.
	When a font is needed
	the user agent iterates over the set of references listed,
	using the first one it can successfully parse and activate.
	Parsing this descriptor is more complicated than parsing other descriptors;
	see [[#font-face-src-parsing]] for the parsing rules.
	Activation of a font involves downloading the file
	or reading it from disk,
	parsing it,
	and perhaps additional user-agent-dependent steps.
	Fonts containing invalid data
	or local font faces
	that are not found
	are ignored
	and the user agent loads the next font in the list.

<h4 id="font-face-src-parsing">Parsing the 'src!!descriptor' descriptor</h4>

To parse a <dfn><<font-src-list>></dfn> production, [=parse a list=] of <<font-src>>s.

	<pre class="prod">
		<dfn>&lt;font-src></dfn> = <<url>> [ <dfn value for="@font-face/src" id="format()">format( <<font-format>> )</dfn> ]? [ <dfn value for="@font-face/src" id="tech()">tech( <<font-tech>># )</dfn> ]?
			| <dfn value for="@font-face/src" id="local()">local( <<font-family-name>> )</dfn>
	</pre>

	<pre class="prod"><dfn id="font-format-values">&lt;font-format&gt;</dfn>
		= [ <<string>> | collection | embedded-opentype | opentype
			| svg | truetype | woff | woff2 ]</pre>

	<pre class="prod"><dfn id="font-tech-values">&lt;font-tech&gt;</dfn>
		= [ <<font-features-tech>> | <<color-font-tech>>
			| variations | palettes | incremental ]</pre>

	<pre class="prod"><dfn id="font-features-tech-values">&lt;font-features-tech&gt;</dfn>
		= [ features-opentype | features-aat | features-graphite ]</pre>

	<pre class="prod"><dfn id="color-font-tech-values">&lt;color-font-tech&gt;</dfn>
		= [ color-COLRv0 | color-COLRv1 | color-SVG | color-sbix | color-CBDT ]</pre>

	<wpt>
		font-face-local-not-family.html
		font-family-src-quoted.html
		parsing/font-face-src-format.html
		parsing/font-face-src-list.html
		parsing/font-face-src-local.html
		parsing/font-face-src-tech.html
	</wpt>

	While keywords are preferred to identify font formats,
	for reasons of backwards compatibility the following strings are also accepted,
	and have the same effect as if the equivalent modern syntax had been used.

	<table>
		<tr><th>String form</th><th>Equivalent syntax</th></tr>
		<tr><td>format("woff2")</td><td>format(woff2)</td></tr>
		<tr><td>format("woff")</td><td>format(woff)</td></tr>
		<tr><td>format("truetype")</td><td>format(truetype)</td></tr>
		<tr><td>format("opentype")</td><td>format(opentype)</td></tr>
		<tr><td>format("collection")</td><td>format(collection)</td></tr>
		<tr><td>format("woff2-variations")</td><td>format(woff2) tech(variations)</td></tr>
		<tr><td>format("woff-variations")</td><td>format(woff) tech(variations)</td></tr>
		<tr><td>format("truetype-variations")</td><td>format(truetype) tech(variations)</td></tr>
		<tr><td>format("opentype-variations")</td><td>format(opentype) tech(variations)</td></tr>
	</table>

	<wpt>
		format-specifiers-variations.html
	</wpt>

	Note: The CSS WG does not anticipate extending this list of format strings in the future.

	If a component value is parsed correctly
	and is of a <a href="#font-format-definitions">font format</a> or
	<a href="#font-tech-definitions">font tech</a>
	that the UA supports,
	add it to the list of supported sources.
	If parsing a component value results in a parsing error
	or its format or tech are unsupported,
	do not add it to the list of supported sources.

	If there are no supported entries at the end of this process,
	the value for the 'src!!descriptor' descriptor is a parse error.

	These parsing rules allow for graceful fallback of fonts
	for user agents which don't support a particular font tech
	or font format.

	<div class="example" id="ex-incremental">
		For example,
		when incremental transfer is not supported,
		a woff2 compressed version of the font
		is supplied,
		for optimal performance.
		Then, for
		<a href="https://w3c.github.io/IFT/Overview.html">incremental transfer</a>,
		the raw uncompressed OpenType font is provided,
		portions of which will be loaded on demand.

		<pre>
		@font-face {
			font-family: "MyIncrementallyLoadedWebFont";
			src: url("FallbackURLForBrowsersWhichDontSupportIncrementalLoading.woff2") format("woff2");
			src: url("MyIncrementallyLoadedWebFont.otf") format(opentype)  tech(incremental);
		}
		</pre>
	</div>

<h4 id="font-face-src-loading">Loading an individual item in the 'src!!descriptor' descriptor</h4>

	As with other URLs in CSS,
	the URL can be relative,
	in which case
	it is resolved relative to the location of the style sheet
	containing the ''@font-face'' rule.
	In the case of SVG fonts,
	the URL points to an element within a document
	containing SVG font definitions.
	If the element reference is omitted,
	a reference to the first defined font is implied.
	Similarly, font container formats
	that can contain more than one font
	must load one and only one of the fonts
	for a given ''@font-face'' rule.
	Fragment identifiers are used to indicate which font to load;
	these use the PostScript name of the font
	as defined in [[!RFC8081]].

	<wpt>
		variations/font-opentype-collections.html
	</wpt>

	Conformant user agents must not use a face
	from the resource
	unless its PostScript name exactly matches
	the fragment identifier,
	and must skip downloading the resource
	if the given fragment identifier
	cannot be a valid PostScript name.

	<div class="example" id="ex-load-font-fragment">
		<pre>
		src: url(fonts/simple.woff);       /* load simple.woff relative to stylesheet location */
		src: url(/fonts/simple.woff);      /* load simple.woff from absolute location */
		src: url(fonts/coll.otc#foo);      /* load font foo from collection coll.otc
		src: url(fonts/coll.woff2#foo);    /* load font foo from woff2 collection coll.woff2
		src: url(fonts.svg#simple);        /* load SVG font with id 'simple' */
		</pre>
	</div>

<h4 id="font-face-src-formats">Selecting items in the 'src!!descriptor'</h4>

	External references consist of a URL,
	followed by an optional hint
	describing the format of the font resource referenced by that URL.
	Conformant user agents
	must skip downloading a font resource
	if the format hint indicates an unsupported or unknown font format,
	or if any of the font technologies are unsupported by the user agent.
	If no format hint is supplied,
	the user agent should download the font resource.

	<div class="example" id="ex-woff2-woff1">
		For example, the following shows how to load a WOFF 2 font if possible,
		otherwise a WOFF 1,
		otherwise use an OpenType font

		<pre>
		@font-face {
			font-family: bodytext;
			src: url(ideal-sans-serif.woff2) format("woff2"),
				url(ideal-sans-serif.woff) format("woff"),
				url(basic-sans-serif.ttf) format("opentype");
		}
		</pre>
	</div>

	<div class="example" id="ex-fictitious-zebra">
		In this example, if woff2 is not supported,
		an unsupported and fictitious "zebra" format is skipped
		and the opentype font is downloaded:
		<pre>src: url(ideal.woff2) format("woff2"),
		url(unsupported.zeb) format("zebra"),
		url(basic.ttf) format("opentype");</pre>
	</div>

	<div class="example" id="ex-instance-in-collection">Here an individual instance in a collection is loaded,
		or if collections are not supported, download an individual font instead.

		<pre>
		@font-face {
			font-family: 源ノ角ゴシック Code JP;
			src: url(SourceHanCodeJP.otc#Regular) format("collection"),
				url(SourceHanCodeJP-Regular.ttf) format("opentype");
		}
		</pre>
	</div>

	<!-- font formats and font requirements
		moved from a minor section inside src
		to a new section
		so they can be more easily shared
		with css-conditional-4
	-->

<h5 id="local-font-fallback">Local font fallback</h5>

	When authors would prefer to use
	a locally available copy of a given font
	and download it if it's not,
	<code>local()</code> can be used.
	The locally-installed <<font-family-name>> argument to <code>local()</code>
	is a format-specific string
	that uniquely identifies a single font face
	within a larger family.
	The name can optionally be enclosed in quotes.
	If unquoted,
	the <a href="#font-family-name-syntax">unquoted font family name processing conventions</a> apply;
	in other words,
	the name must be a sequence of identifiers
	separated by <a href="https://www.w3.org/TR/css3-syntax/#whitespace">whitespace</a>
	which is converted to a string
	by joining the identifiers together
	separated by a single space;
	and thus,
	<a>CSS-wide keywords</a> such as ''inherit'', and
	<<generic-font-family>> keywords such as ''serif''
	are not allowed inside <code>local()</code>.

	<pre  class="lang-css">
	/* regular face of Gentium */
	@font-face {
		font-family: MyGentium;
		src: local(Gentium),    /* prefer locally available Gentium */
			url(Gentium.woff);  /* otherwise, download it */
	}
	</pre>

	<div class="invalid example" id="ex-local-no-keywords">
		For example, this use of <code>local()</code> would be an error:

		<pre class="lang-css">
		@font-face {
			font-family: foo;
			src: local(inherit);
		}
		</pre>
	</div>

	For OpenType and TrueType fonts,
	this string is used to match only the Postscript name
	or the full font name
	in the name table of locally available fonts.
	Which type of name is used varies by platform
	and font,
	so authors should include both of these names
	to assure proper matching across platforms.
	Platform substitutions for a given font name must not be used.

	<pre>
	/* bold face of Gentium */
	@font-face {
		font-family: MyGentium;
		src: local(Gentium Bold),    /* full font name */
			local(Gentium-Bold),    /* Postscript name */
			url(GentiumBold.woff);  /* otherwise, download it */
		font-weight: bold;
	}
	</pre>

	Just as an ''@font-face'' rule specifies
	the characteristics of a single font
	within a family,
	the unique name used with <code>local()</code>
	specifies a single font,
	not an entire font family.
	Defined in terms of OpenType font data,
	the Postscript name is found in
	the font's
	<a href="https://www.microsoft.com/typography/otspec/name.htm">name table</a>,
	in the name record with nameID = 6
	(see [[!OPENTYPE]] for more details).
	The Postscript name is the commonly used key for all fonts on OSX
	and for Postscript CFF fonts under Windows.
	The full font name (nameID = 4) is used as a unique key
	for fonts with TrueType glyphs on Windows.

	For OpenType fonts with multiple localizations of the full font name,
	the US English version must be used
	(language ID = 0x409 for Windows and language ID = 0 for Macintosh)
	or the first localization
	when a US English full font name is not available
	(the OpenType specification recommends that
	<a
	href="https://www.microsoft.com/typography/otspec/recom.htm">all fonts
	minimally include US English names</a>).
	User agents that also match other full font names,
	e.g. matching the Dutch name when the current system locale is set to Dutch,
	are considered non-conformant.

	Note: This is done,
	not to prefer English,
	but to avoid matching inconsistencies
	across font versions and OS localizations,
	since font style names (e.g. "Bold")
	are frequently localized into many languages
	and the set of localizations available
	varies widely across platform and font version.

	User agents that match a concatenation of
	family name (nameID = 1) with
	style name (nameID = 2)
	are considered non-conformant.

	Note: This also allows for referencing faces
	that belong to larger families
	that cannot otherwise be referenced.

	<div class="example" id="ex-local-font">
		Use a local font or reference an SVG font in another document:

		<pre>
		@font-face {
			font-family: Headline;
			src: local(Futura-Medium),
				url(images/fonts.svg#MyGeometricModern) format("svg");
		}
		</pre>

		Create an alias for local Japanese fonts on different platforms:

		<pre>
		@font-face {
			font-family: jpgothic;
			src: local(HiraKakuPro-W3), local(Meiryo), local(IPAPGothic);
		}
		</pre>

		Reference a font face that cannot be matched within a larger family:

		<pre>
		@font-face {
			font-family: Hoefler Text Ornaments;
			/* has the same font properties as Hoefler Text Regular */
			src: local(HoeflerText-Ornaments);
		}
		</pre>

		Since localized fullnames never match,
		a document with the header style rules below
		would always render using the default serif font,
		regardless whether a particular system locale parameter is set to Finnish or not:

		<pre>
		@font-face {
			font-family: SectionHeader;
			src: local("Arial Lihavoitu");  /* Finnish fullname for Arial Bold, should fail */
			font-weight: bold;
		}

		h2 { font-family: SectionHeader, serif; }
		</pre>

		A conformant user agent would never load the font 'gentium.eot'
		in the example below,
		since it is included in the first definition of the 'src!!descriptor' descriptor
		which is overridden by the second definition in the same ''@font-face'' rule:

		<pre>
		@font-face {
			font-family: MainText;
			src: url(gentium.eot);                     /* for use with older user agents */
			src: local("Gentium"), url(gentium.woff);  /* Overrides src definition */
		}
		</pre>
	</div>

<!--
████████  ████████   ███████  ████████          ████████  ████████  ██████   ██████
██     ██ ██     ██ ██     ██ ██     ██         ██     ██ ██       ██    ██ ██    ██
██     ██ ██     ██ ██     ██ ██     ██         ██     ██ ██       ██       ██
████████  ████████  ██     ██ ████████  ███████ ██     ██ ██████    ██████  ██
██        ██   ██   ██     ██ ██                ██     ██ ██             ██ ██
██        ██    ██  ██     ██ ██                ██     ██ ██       ██    ██ ██    ██
██        ██     ██  ███████  ██                ████████  ████████  ██████   ██████
-->

<h3 id="font-prop-desc">
Font property descriptors: the 'font-style!!descriptor', 'font-weight!!descriptor', and
'font-width!!descriptor' descriptors</h3>

	<pre class='descdef'>
	Name: font-style
	Value: auto | normal | italic | left | right | oblique [ <<angle [-90deg,90deg]>>{1,2} ]?
	For: @font-face
	Initial: auto
	</pre>

	<pre class='descdef'>
	Name: font-weight
	Value: auto | <<font-weight-absolute>>{1,2}
	For: @font-face
	Initial: auto
	</pre>

	<pre class='descdef'>
	Name: font-width
	Value: auto | <<'font-width'>>{1,2}
	For: @font-face
	Initial: auto
	</pre>

	<wpt>
		font-face-range-order.html
		font-face-stretch-auto-static.html
		font-face-stretch-auto-variable.html
		font-face-stretch-default-variable.html
		font-face-style-normal.html
		font-face-style-auto-static.html
		font-face-style-auto-variable.html
		font-face-style-default-variable.html
		font-face-weight-auto-static.html
		font-face-weight-auto-variable.html
		font-face-weight-default-variable.html
		font-face-sign-function.html
		font-size-sign-function.html
		font-style-sign-function.html
		variations/font-descriptor-range-reversed.html
	</wpt>

	These descriptors define the characteristics of a font face
	and are used in the process of matching styles to specific faces.
	For a font family defined with several ''@font-face'' rules,
	user agents can either download all faces in the family
	or use these descriptors to selectively download font faces that match actual styles used in document.
	The meaning of the values for these descriptors
	are the same as those for the corresponding font properties
	except that relative keywords are not allowed,
	''bolder'' and ''lighter''.
	If these descriptors are omitted,
	initial values are assumed.
	If specified values are out of range
	of the accepted values of the property of the same name,
	the descriptor is treated as a parse error.

	Ranges are accepted in these three descriptors in place of a single value.
	Where a single value is specified,
	it has the same meaning as a range with identical startpoint and endpoint.
	User agents must swap the computed value of the startpoint and endpoint of the range
	in order to forbid decreasing ranges.
	Both endpoints are inclusive.
	The ranges are used in the <a href="#font-matching-algorithm">Font Matching Algorithm</a> below.

	<wpt>
		font-face-range-order.html
		matching/range-descriptor-reversed.html
	</wpt>

	The auto values for these three descriptors have the following effects:

	- For font selection purposes, the font is selected as if
		the appropriate normal value
		(''font-style/normal'', ''font-weight/normal'' or ''font-width/normal'')
		is chosen
	- For variation axis clamping, clamping does not occur

	The value for these font face style attributes
	is used in place of the style implied by the underlying font data.
	This allows authors to combine faces in flexible combinations,
	even in situations where the original font data was arranged differently.
	User agents that implement synthetic bolding and obliquing
	must only apply synthetic styling in cases
	where the font descriptors imply this is needed,
	rather than based on the style attributes implied by the font data.
	However, variation values applied to fonts defined with '@font-face'
	will be clamped to both the values specified in these descriptors,
	or implied by the application of variation parameters
	(such as manipulation of the <code>wght</code> axis
	to satisfy the requested ''font-weight''),
	as well as the values supported by the font file itself.

	<wpt>
		synthetic-bold-out-of-capabilities-range.html
	</wpt>

	<div class="example" id="ex-descriptors-matching">
		The font descriptors defined in this section
		are used for selecting a font
		from within the set of fonts defined by ''@font-face'' rules for a given family.

		Consider a family containing a single, regular face:

		<pre>
		@font-face {
			font-family: BaskervilleSimple;
			src: url(baskerville-regular.woff2);
		}
		</pre>

		Unstyled text would display using the regular face
		defined in the ''@font-face'' rule:

		<figure><img alt="regular face display" src="images/fiddlesticks-regular.png" width="373" height="74"></figure>

		However, italic text would display in most user agents
		using synthetically obliqued glyphs from the regular face,
		since a separate italic face is not defined:

		<figure><img alt="synthetic italics display" src="images/fiddlesticks-synitalics.png" width="373" height="94"></figure>

		Now consider a family for which an actual italic face is defined:

		<pre>
		@font-face {
			font-family: BaskervilleFull;
			src: url(baskerville-regular.woff2);
		}

		@font-face {
			font-family: BaskervilleFull;
			src: url(baskerville-italic.woff2);
			font-style: italic;
		}
		</pre>

		The second ''@font-face'' rule
		defines the font resource <code>baskerville-italic.woff</code>
		to have style attributes of normal weight, normal stretch and italic style.
		When displaying italic text,
		the user agent will use this font,
		since it's the closest match for italic text.
		Thus, the text will display using glyphs designed by a type designer
		rather than using synthetically obliqued glyphs from the regular face:

		<figure><img alt="real italics display" src="images/fiddlesticks-italics.png" width="373" height="96"></figure>

		See the section on <a href="#font-style-matching">font matching</a>
		for more complete details of the process used
		to select a particular face within a font family.
	</div>

	<div class="example" id="ex-descriptors-range">
		Fonts may advertise the range of 'font-weight!!property', 'font-width!!property', and 'font-style!!property' they are
		compatible with.

		<pre>
		@font-face {
			font-family: Lastima;
			src: url(lastima-varfont.woff2);
			font-weight: 100 399;
		}
		</pre>

		The above ''@font-face'' rule indicates that <code>lastima-varfont.woff</code> should be used when
		'font-weight!!property' is between 100 and 399. Depending on if there are any other ''@font-face'' rules which specify
		<code>font-family: Lastima</code>, <code>lastima-varfont.woff</code> might be used for values of 'font-weight!!property'
		outside of the 100 - 399 range. For more details, see the [[#font-matching-algorithm]].

		As <a href="#ex-descriptors-matching">above</a>, multiple ''@font-face'' rules may be joined together into a single
		family, spanning multiple ranges of 'font-weight!!property', 'font-width!!property', and/or 'font-style!!property':

		<pre>
		@font-face {
			font-family: Lastima;
			src: url(lastima-varfont-lightrange.woff2);
			font-weight: 100 399;
		}
		@font-face {
			font-family: Lastima;
			src: url(lastima-varfont-heavyrange.woff2);
			font-weight: 400 700;
		}
		</pre>

		The above ''@font-face'' rules indicate that <code>lastima-varfont-lightrange.woff</code> should be used when
		'font-weight!!property' is between 100 and 399, whereas <code>lastima-varfont-heavyrange.woff</code> should be used when
		'font-weight!!property' is between 400 and 700.
	</div>

<h4 id="font-stretch-desc">
	Font width: the '@font-face/font-stretch!!descriptor' legacy name alias</h4>

	For historical reasons,
	a <dfn descriptor for="@font-face">font-stretch</dfn> descriptor exists
	which is a [=legacy name alias=]
	and functions in the identical way to
	the 'font-width!!descriptor' descriptor.

	<wpt>
		parsing/font-stretch-alias.html
		parsing/font-width-computed.html
		parsing/font-width-invalid.html
		parsing/font-width-valid.html
	</wpt>

<!--
██     ██ ████████     ███    ██    ██  ██████   ████████
██     ██ ██     ██   ██ ██   ███   ██ ██    ██  ██
██     ██ ██     ██  ██   ██  ████  ██ ██        ██
██     ██ ████████  ██     ██ ██ ██ ██ ██   ████ ██████
██     ██ ██   ██   █████████ ██  ████ ██    ██  ██
██     ██ ██    ██  ██     ██ ██   ███ ██    ██  ██
 ███████  ██     ██ ██     ██ ██    ██  ██████   ████████
-->

<h3 id="unicode-range-desc">
Character range: the 'unicode-range!!descriptor' descriptor</h3>

	<pre class='descdef'>
	Name: unicode-range
	Value: <<unicode-range-token>>#
	Initial: U+0-10FFFF
	For: @font-face
	</pre>

	<wpt>
		font-face-unicode-range-2.html
		font-face-unicode-range-nbsp.html
		font-face-unicode-range.html
	</wpt>

	This descriptor defines the set of Unicode codepoints that may be
	supported by the font face for which it is declared. The descriptor
	value is a comma-delimited list of Unicode range token (<<unicode-range-token>>)
	values. The union of these ranges defines the set of codepoints that
	serves as a hint for user agents when deciding whether or not to
	download a font resource for a given text run.

	Each <<unicode-range-token>> value is a
	token made up of a "U+" or "u+" prefix
	followed by a codepoint range in one of the three forms listed below.
	Ranges that do not fit one of these forms are invalid
	and cause the declaration to be ignored.

	<dl>
		<dt>single codepoint (e.g. U+416)</dt>
		<dd>a Unicode codepoint, represented as one to six hexadecimal digits</dd>
		<dt>interval range (e.g. U+400-4ff)</dt>
		<dd>represented as two hyphen-separated Unicode codepoints
		indicating the inclusive start and end codepoints of a range</dd>
		<dt>wildcard range (e.g. U+4??)</dt>
		<dd>defined by the set of codepoints implied when
		trailing '?' characters signify any hexadecimal digit</dd>
	</dl>

	Individual codepoints are written using hexadecimal values that correspond to
	<a href="https://www.unicode.org/charts/">Unicode character codepoints</a>.
	Unicode codepoint values must be between 0 and 10FFFF inclusive. Digit
	values of codepoints are <a href="https://infra.spec.whatwg.org/#ascii-case-insensitive">ASCII case-insensitive</a>. For interval ranges,
	the start and end codepoints must be within the range noted above and
	the end codepoint must be greater than or equal to the start
	codepoint.

	Wildcard ranges specified with ‘?’ that lack an
	initial digit (e.g. "U+???") are valid and equivalent
	to a wildcard range with an initial zero digit (e.g. "U+0???" = "U+0000-0FFF").
	Wildcard ranges that extend beyond the range of
	Unicode codepoints are invalid. Because of this, the maximum
	number of trailing '?' wildcard characters is five, even though the
	<a href="https://www.w3.org/TR/CSS21/syndata.html#tokenization"><code title="UNICODE-RANGE token">UNICODE-RANGE</code></a>
	token accepts six.

	Within the comma-delimited list of Unicode ranges in a
	'unicode-range!!descriptor' descriptor declaration, ranges may overlap. The union
	of these ranges defines the set of codepoints for which the
	corresponding font may be used. User agents must not download or use
	the font for codepoints outside this set. User agents may normalize
	the list of ranges into a list that is different but represents the
	same set of codepoints.

	The associated font might not contain glyphs for the entire set of
	codepoints defined by the 'unicode-range!!descriptor' descriptor. When the font
	is used, the <dfn export>effective character map</dfn> is the intersection of the
	codepoints defined by 'unicode-range!!descriptor' with the font's <a>character map</a>.
	This allows authors to define supported ranges in terms of broad
	ranges without worrying about the precise codepoint ranges supported
	by the underlying font.

<h4 id="composite-fonts">Using character ranges to define composite fonts</h4>

	Multiple ''@font-face'' rules with different unicode ranges for the same
	family and style descriptor values can be used to create composite fonts
	that mix the glyphs from different fonts for different scripts. This
	can be used to combine fonts that only contain glyphs for a single
	script (e.g. Latin, Greek, Cyrillic) or it can be used by authors as a
	way of segmenting a font into fonts for commonly used characters and
	less frequently used characters. Since the user agent will only pull
	down the fonts it needs this helps reduce page bandwidth.

	If the unicode ranges overlap for a set of ''@font-face'' rules with the
	same family and style descriptor values, the rules are ordered in the
	reverse order they were defined; the last rule defined is the first to
	be checked for a given character.

	Example ranges for specific languages or characters:

	<dl>
		<dt>unicode-range: U+A5;</dt>
		<dd>a single code point, the yen/yuan symbol</dd>

		<dt>unicode-range: U+0-7F;</dt>
		<dd>code range for basic ASCII characters</dd>

		<dt>unicode-range: U+590-5ff;</dt>
		<dd>code range for Hebrew characters</dd>

		<dt>unicode-range: U+A5, U+4E00-9FFF, U+30??, U+FF00-FF9F;</dt>
		<dd>code range for Japanese kanji, hiragana and katakana characters plus yen/yuan symbol</dd>
	</dl>

	<div class="example" id="ex-urange-bengali">
		The BBC provides news services in a wide variety of languages, many
		that are not well supported across all platforms. Using an ''@font-face''
		rule, the BBC could provide a font for any of these languages, as it
		already does via a manual font download.

		<pre>
		@font-face {
			font-family: BBCBengali;
			src: url(fonts/BBCBengali.woff) format("woff");
			unicode-range: U+00-FF, U+980-9FF;
		}
		</pre>
	</div>

	<div class="example" id="ex-stix">
		Technical documents often require a wide range of symbols.  The STIX
		Fonts project is one project aimed at providing fonts to support a wide
		range of technical typesetting in a standardized way.  The example below
		shows the use of a font that provides glyphs for many of the
		mathematical and technical symbol ranges within Unicode:

		<pre>
		@font-face {
			font-family: STIXGeneral;
			src: local(STIXGeneral), url(/stixfonts/STIXGeneral.otf);
			unicode-range: U+000-49F, U+2000-27FF, U+2900-2BFF, U+1D400-1D7FF;
		}
		</pre>
	</div>

	<div class="example" id="ex-better-latin">
		This example shows how an author can override the glyphs used for
		Latin characters in a Japanese font with glyphs from a different font.
		The first rule specifies no range so it defaults to the entire range.
		The range specified in the second rule overlaps but takes precedence
		because it is defined later.

		<pre>
		@font-face {
			font-family: JapaneseWithGentium;
			src: local(MSMincho);
			/* no range specified, defaults to entire range */
		}

		@font-face {
			font-family: JapaneseWithGentium;
			src: url(../fonts/Gentium.woff);
			unicode-range: U+0-2FF;
		}
		</pre>
	</div>

	<div class="example" id="ex-subset-ftw">
		Consider a family constructed to optimize bandwidth by separating out
		Latin, Japanese and other characters into different font files:

		<pre>
		/* fallback font - size: 4.5MB */
		@font-face {
			font-family: DroidSans;
			src: url(DroidSansFallback.woff);
			/* no range specified, defaults to entire range */
		}

		/* Japanese glyphs - size: 1.2MB */
		@font-face {
			font-family: DroidSans;
			src: url(DroidSansJapanese.woff);
			unicode-range: U+3000-9FFF, U+ff??;
		}

		/* Latin, Greek, Cyrillic along with some
			punctuation and symbols - size: 190KB */
		@font-face {
			font-family: DroidSans;
			src: url(DroidSans.woff);
			unicode-range: U+000-5FF, U+1e00-1fff, U+2000-2300;
		}
		</pre>

		For simple Latin text, only the font for Latin characters is downloaded:

		<pre>
		body { font-family: DroidSans; }

		&lt;p>This is that&lt;/p>
		</pre>

		In this case the user agent first checks the unicode-range for the
		font containing Latin characters (DroidSans.woff).  Since all the
		characters above are in the range U+0-5FF, the user agent downloads the
		font and renders the text with that font.

		Next, consider text that makes use of an arrow character (&#x21e8;):

		<pre>
		&lt;p>This &amp;#x21e8; that&lt;p>
		</pre>

		The user agent again first checks the unicode-range of the font
		containing Latin characters. Since U+2000-2300 includes the arrow
		code point (U+21E8), the user agent downloads the font. For this
		character however the Latin font does not have a matching glyph, so the
		effective unicode-range used for font matching excludes this code point.
		Next, the user agent evaluates the Japanese font. The unicode-range for
		the Japanese font, U+3000-9FFF and U+ff??, does not include U+21E8, so
		the user agent does not download the Japanese font.
		Next the fallback font is considered. The ''@font-face'' rule for the
		fallback font does not define unicode-range so its value defaults to
		the range of all Unicode code points. The fallback font is downloaded and
		used to render the arrow character.
	</div>

<!--
████████ ████████  ██████        ████████ ██     ██  ██████
██       ██       ██    ██       ██       ██     ██ ██    ██
██       ██       ██             ██       ██     ██ ██
██████   ██████    ██████        ██████   ██     ██  ██████
██       ██             ██       ██        ██   ██        ██
██       ██       ██    ██       ██         ██ ██   ██    ██
██       ██        ██████        ██          ███     ██████
-->

<h3 id="font-rend-desc">
Font features and variations: the 'font-feature-settings!!descriptor' and 'font-variation-settings!!descriptor' descriptors</h3>

	<!--
		font-variant descriptor removed at Fukuoka TPAC
		https://github.com/w3c/csswg-drafts/issues/2531
	-->

	<pre class='descdef'>
	Name: font-feature-settings
	Value: normal | <<feature-tag-value>>#
	Initial: normal
	For: @font-face
	</pre>

	<wpt>
		font-feature-resolution-001.html
		font-feature-resolution-002.html
		font-feature-settings-descriptor-01.html
		font-feature-settings-descriptor-02.html
		font-feature-settings-descriptor-binary.html
		font-feature-settings-serialization-001.html
	</wpt>

	<pre class='descdef'>
	Name: font-variation-settings
	Value: normal | [ <<string>> <<number>>]#
	Initial: normal
	For: @font-face
	</pre>

	<wpt>
		calc-in-font-variation-settings.html
		font-variation-settings-descriptor-01.html
		font-variation-settings-descriptor-02.html
		font-variation-settings-descriptor-03.html
		font-variation-settings-descriptor-04.html
		font-variation-settings-serialization-001.html
		font-variation-settings-serialization-002.html
		animations/font-variation-settings-composition.html
		animations/font-variation-settings-interpolation.html
		parsing/font-variation-settings-computed.html
		parsing/font-variation-settings-invalid.html
		parsing/font-variation-settings-valid.html
		variations/font-variation-settings-inherit.html
	</wpt>

	These descriptors define initial settings that apply when the font defined by
	an ''@font-face'' rule is rendered.  They do not affect font selection.
	Values are identical to those defined for the corresponding
	'font-feature-settings!!property' and
	'font-variation-settings!!property' properties defined below
	except that the <a>CSS-wide keywords</a> are omitted. When multiple font
	feature descriptors, properties, or variations are used, optionally along with a named instance,
	the cumulative effect on
	text rendering is detailed in the section
	[[#font-feature-variation-resolution]] below.

	These descriptors set features and variation values
	on the font object which the ''@font-face'' rule represents,
	rather than on an entire element.
	Therefore, when using these descriptors,
	only some glyphs in an element may be rendered with that feature,
	due to [[#cluster-matching]].

<!--
██    ██    ███    ██     ██ ████████ ████████
███   ██   ██ ██   ███   ███ ██       ██     ██
████  ██  ██   ██  ████ ████ ██       ██     ██
██ ██ ██ ██     ██ ██ ███ ██ ██████   ██     ██
██  ████ █████████ ██     ██ ██       ██     ██
██   ███ ██     ██ ██     ██ ██       ██     ██
██    ██ ██     ██ ██     ██ ████████ ████████
-->

<h3 id="font-named-instance">Using named instances from variable fonts: the 'font-named-instance!!descriptor' descriptor</h3>

	<pre class='descdef'>
	Name: font-named-instance
	Value: auto | <<string>>
	Initial: auto
	For: @font-face
	</pre>

	If the 'font-named-instance!!descriptor' descriptor is set
	to a value other than ''font-named-instance/auto'',
	then the appropriate stage in the [[#font-feature-variation-resolution]]
	will inspect the font file to find the first named instance in
	the font which has a localized name equal to the given <<string>>
	according to the rules given in [[#localized-name-matching]].
	If no such named instance exists,
	this descriptor is treated as if it has a value of 'font-named-instance/auto'.
	Otherwise, this named instance's variation axis values
	are applied to this position in the [[#font-feature-variation-resolution]].

	<div class="example" id="ex-grotesque-XHGT">
		For example, the following ''@font-face'' block will
		apply the instance named "Grotesque"
		but will override the "XHGT" axis to have a value of 0.7.

		<pre>
		@font-face {
			font-family: "AccuroVar";
			src: url("accurovar.otf") format("opentype");
			font-named-instance: "Grotesque";
			font-variation-settings: "XHGT" 0.7;
		}
		</pre>
	</div>

	Note: Because the variation axis values supplied in the
		'font-weight!!property', 'font-width!!property', and 'font-style!!property' properties
		are applied before
		the value in the 'font-named-instance!!descriptor' descriptor,
		there is no need to change the value of those properties
		when a named instance is desired.

<!--
████████  ████████  ███████  ██     ██ ████████  ██████  ████████  ██████
██     ██ ██       ██     ██ ██     ██ ██       ██    ██    ██    ██    ██
██     ██ ██       ██     ██ ██     ██ ██       ██          ██    ██
████████  ██████   ██     ██ ██     ██ ██████    ██████     ██     ██████
██   ██   ██       ██  ██ ██ ██     ██ ██             ██    ██          ██
██    ██  ██       ██    ██  ██     ██ ██       ██    ██    ██    ██    ██
██     ██ ████████  █████ ██  ███████  ████████  ██████     ██     ██████
-->

<h3 id="font-requests">Font request guidelines</h3>

<h4 id="font-face-loading">Font loading guidelines</h4>

	The ''@font-face'' rule is designed to allow lazy loading
	of font resources that are only downloaded when used within a
	document. A stylesheet can include ''@font-face'' rules for
	a library of fonts of which only a select set are used; user agents
	must only download those fonts that are referred to within the style
	rules applicable to a given page. User agents that download all fonts
	defined in ''@font-face'' rules without considering whether
	those fonts are in fact used within a page are considered
	non-conformant. In cases where a font might be downloaded in character
	fallback cases, user agents may download a font if it's contained within
	the computed value of 'font-family!!property'
	for a given text run.

	<pre>
	@font-face {
		font-family: GeometricModern;
		src: url(font.woff);
	}

	p {
		/* font will be downloaded for pages with p elements */
		font-family: GeometricModern, sans-serif;
	}

	h2 {
		/* font may be downloaded for pages with h2 elements, even if Futura is available locally */
		font-family: Futura, GeometricModern, sans-serif;
	}
	</pre>

	In cases where textual content is loaded before downloadable fonts are available,
	user agents must render text according to the '@font-face/font-display!!descriptor' descriptor of that ''@font-face'' block.
	In cases where the font download fails, user agents must
	display the text visibly. Authors are advised to use fallback fonts in
	their font lists that closely match the metrics of the
	downloadable fonts to avoid large page reflows where possible.

<h4 id="font-fetching-requirements" oldids="same-origin-restriction,allowing-cross-origin-font-loading">
Font fetching requirements</h4>

	<div algorithm>
		To <dfn export>fetch a font</dfn> given a selected <<url>> |url| for ''@font-face'' |rule|,
		[=fetch a style resource|fetch=] |url|,
		with ruleOrDeclaration being |rule|,
		destination "font",
		CORS mode "cors",
		and processResponse being the following steps given [=/response=] |res| and null, failure or a
		byte stream |stream|:

		1. If |stream| is null, return.

		2. ISSUE: Load a font from |stream| according to its type.
	</div>

	Note: The implications of this for authors are that fonts
	will typically not be loaded cross-origin unless authors specifically
	take steps to permit cross-origin loads. Sites can explicitly allow
	cross-site loading of font data using the <code>Access-Control-Allow-Origin</code>
	HTTP header.  For other schemes, no explicit mechanism to allow
	cross-origin loading, beyond what is permitted by the
	<a>fetch</a>
	algorithm, is defined or required.

	<wpt>
		test_datafont_same_origin.html
	</wpt>

	<div class="example" id="ex-cross-origin">
		For the examples given below, assume that a document is located at
		<code>https://example.com/page.html</code> and all URLs link to valid
		font resources supported by the user agent.

		Fonts defined with the 'src!!descriptor' descriptor values below will be loaded:

		<pre>/* same origin (i.e. domain, scheme, port match document) */
		src: url(fonts/simple.woff);

		/* data urls with no redirects are treated as same origin */
		src: url("data:application/font-woff;base64,...");

		/* cross origin, different domain */
		/* Access-Control-Allow-Origin response header set to '*' */
		src: url(http://another.example.com/fonts/simple.woff);
		</pre>

		Fonts defined with the 'src!!descriptor' descriptor values below will fail to load:

		<pre>/* cross origin, different scheme */
		/* no Access-Control-xxx headers in response */
		src: url(http://example.com/fonts/simple.woff);

		/* cross origin, different domain */
		/* no Access-Control-xxx headers in response */
		src: url(http://another.example.com/fonts/simple.woff);
		</pre>
	</div>

<!--
████████  ████  ██████  ████████  ██          ███    ██    ██
██     ██  ██  ██    ██ ██     ██ ██         ██ ██    ██  ██
██     ██  ██  ██       ██     ██ ██        ██   ██    ████
██     ██  ██   ██████  ████████  ██       ██     ██    ██
██     ██  ██        ██ ██        ██       █████████    ██
██     ██  ██  ██    ██ ██        ██       ██     ██    ██
████████  ████  ██████  ██        ████████ ██     ██    ██
-->

<h3 id="font-display-desc">
Controlling Font Display Per Font-Face: the '@font-face/font-display!!descriptor' descriptor</h3>

	The '@font-face/font-display!!descriptor' descriptor for ''@font-face''
	determines how a font face is displayed,
	based on whether and when it is downloaded and ready to use.

	<pre class='descdef'>
	Name: font-display
	Value: auto | block | swap | fallback | optional
	Initial: auto
	For: @font-face
	</pre>

	<wpt>
		font-display/font-display-change.html
		font-display/font-display-failure-fallback.html
		font-display/font-display-preload.html
		font-display/font-display.html
	</wpt>

	Note: For all of these values,
	user agents may use slightly different durations,
	or more sophisticated behaviors that can't be directly expressed in the '@font-face/font-display!!descriptor' syntax,
	in order to provide more useful behavior for their users.
	They may also provide the ability for users to override author-chosen behavior
	with something more desirable;
	for example, forcing all fonts to have a ''0s'' <a>block period</a>.

	<dl dfn-type="value" dfn-for="@font-face/font-display">
		<dt><dfn>auto</dfn>
		<dd>
			The font display policy is user-agent-defined.

			Note: Many browsers have a default policy similar to that specified by ''display/block''.

		<dt><dfn>block</dfn>
		<dd>
			Gives the font face a short <a>block period</a>
			(''3s'' is recommended in most cases)
			and an infinite <a>swap period</a>.

			Note: In other words, the browser draws "invisible" text at first if it's not loaded,
			but swaps the font face in as soon as it loads.

			This value must only be used when rendering text in a particular font is required for the page to be usable.
			It must only be used for small pieces of text.

			<div class="example" id="ex-bad-icon-fonts">
				For example, badly designed "icon fonts" might associate a "⎙" (printer) icon
				with an unrelated character like "P",
				so if the text is displayed with a fallback font instead
				there will be confusing letters scattered around the page
				rather than the desired icon.
				In this case, temporary blank spots are better than using a fallback font.

				(However, the fallback font is used <em>eventually</em>,
				as having confusing letters scattered around the page
				is better than having links and such never show up at all.)

				A better solution is described in the
				<a href="#a11y">Accessibility Considerations</a> section.
			</div>

		<dt><dfn>swap</dfn>
		<dd>
			Gives the font face an extremely small <a>block period</a>
			(''100ms'' or less is recommended in most cases)
			and an infinite <a>swap period</a>.

			Note: In other words, the browser draws the text immediately with a fallback if the font face isn't loaded,
			but swaps the font face in as soon as it loads.

			This value should only be used when rendering text in a particular font is very important for the page,
			but rendering in any font will still get a correct message across.
			It should only be used for small pieces of text.

			<div class='example' id="ex-logo-font">
				For example,
				if a website has a custom font for rendering their logo,
				rendering that logo correctly is fairly important for branding purposes,
				but displaying the logo in any font will at least get the point across without confusion.
			</div>

		<dt><dfn>fallback</dfn>
		<dd>
			Gives the font face an extremely small <a>block period</a>
			(''100ms'' or less is recommended in most cases)
			and a short <a>swap period</a>
			(''3s'' is recommended in most cases).

			Note: In other words, the font face is rendered with a fallback at first if it's not loaded,
			but it's swapped in as soon as it loads.
			However, if too much time passes,
			the fallback will be used for the rest of the page's lifetime instead.

			This value should be used for body text,
			or any other text where the use of the chosen font is useful and desired,
			but it's acceptable for the user to see the text in a fallback font.
			This value is appropriate to use for large pieces of text.

			<div class="example" id="ex-avoid-shifting">
				For example,
				in large pieces of body text,
				it's most important just to get the text rendered quickly,
				so the user can begin to read as quickly as possible.
				Further, once the user has started reading,
				they shouldn't be disturbed by the text suddenly "shifting"
				as a new font is swapped in,
				as that's distracting and annoying to re-find where one was in the text.
			</div>

		<dt><dfn>optional</dfn>
		<dd>
			If the font can be loaded "immediately"
			(such that it's available to be used for the "first paint" of the text),
			the font is used.

			Otherwise, the font is treated
			as if its [=block period=] and [=swap period=] both expired before it finished loading.
			If the font is not used due to this,
			the user agent may choose to abort the font download,
			or download it with a very low priority.
			If the user agent believes it would be useful for the user,
			it may avoid even starting the font download,
			and proceed immediately to using a fallback font.

			An ''optional'' font <strong>must never</strong>
			cause the layout of the page to "jump" as it loads in.
			A user agent <em>may</em> choose to slightly delay rendering an element using an optional font
			to give it time to load from a possibly-slow local cache,
			but once the text has been painted to the screen with a fallback font instead,
			it must not be rendered with the ''optional'' font for the rest of the page's lifetime.

			This value should be used for body text,
			or any other text where the chosen font is purely a decorative "nice-to-have".
			It should be used anytime it is more important that the web page render quickly on first visit,
			than it is that the user wait a longer time to see everything perfect immediately.

			<div class='example' id="ex-perfectly-readable">
				For example, body text is perfectly readable in one of the browser default fonts,
				though a downloadable font face might be more attractive
				and mesh with the site's aesthetics better.
				First time visitors to a site generally care far more about the site being quickly usable
				than they do about the finer points of its display,
				and ''optional'' provides a good behavior for them.
				If they return later,
				the desired font faces might have finished downloading,
				giving them the "intended" experience without slowing down
				either their first or subsequent visits.

				Users on very slow connections might not ever receive the "intended" experience,
				but ''optional'' ensures they can actually <em>use</em> the site,
				rather than quitting and going elsewhere because the site takes too long to load.
			</div>

			<div class=note>
				To increase the chance that an ''optional'' font will be available
				in time to use for rendering some text,
				it is recommended that the user agent employ heuristics
				to make it faster to access
				or to judge when it would be worthwhile to delay rendering some text,
				such as checking if the font is preloaded in HTML,
				or moving the file from slower to faster in-memory caches
				as soon as it is seen in a stylesheet
				(before it's known whether it will be used on the page).

				These heuristics cannot be relied upon by authors, however;
				it must be understood that the ''optional'' value
				can result in the font never being used.
				If a somewhat higher assurance of the font being used is needed,
				authors should consider using the ''fallback'' value.
			</div>
	</dl>

<h4 id="font-display-font-feature-values">
Controlling Font Display Per Font-Family via ''@font-feature-values''</h4>

	The '@font-feature-values/font-display!!descriptor' descriptor for ''@font-feature-values''
	determines how a font family is displayed,
	by setting the "default" font-display value
	for ''@font-face'' rules targeting the same font family.
	When '@font-face/font-display!!descriptor' is omitted in an ''@font-face'' rule,
	the user agent uses the '@font-feature-values/font-display!!descriptor' value
	set via ''@font-feature-values'' for the relevant font-family if one is set,
	and otherwise defaults to ''@font-feature-values/font-display!!descriptor/auto''.

	This mechanism can be used to set a default display policy for an entire font-family,
	and enables developers to set a display policy for ''@font-face'' rules
	that are not directly under their control.
	For example, when a font is served by a third-party font foundry,
	the developer does not control the ''@font-face'' rules
	but is still able to set a default font-display policy for the provided font-family.
	The ability to set a default policy for an entire font-family
	is also useful to avoid the ransom note effect
	(i.e. mismatched font faces)
	because the display policy is then applied to the entire font family.

	<pre class='descdef'>
	Name: font-display
	Value: auto | block | swap | fallback | optional
	Initial: auto
	For: @font-feature-values
	</pre>

<!--
██          ███    ██    ██  ██████            ███████  ██     ██ ████████
██         ██ ██   ███   ██ ██    ██          ██     ██ ██     ██ ██     ██
██        ██   ██  ████  ██ ██                ██     ██ ██     ██ ██     ██
██       ██     ██ ██ ██ ██ ██   ████ ███████ ██     ██ ██     ██ ████████
██       █████████ ██  ████ ██    ██          ██     ██  ██   ██  ██   ██
██       ██     ██ ██   ███ ██    ██          ██     ██   ██ ██   ██    ██
████████ ██     ██ ██    ██  ██████            ███████     ███    ██     ██
-->

<h3 id="font-language-override-desc">
Default font language overriding: the 'font-language-override' descriptor</h3>

	<pre class='descdef'>
	Name: font-language-override
	Value: normal | <<string>>
	For: @font-face
	Initial: normal
	</pre>

	This descriptor defines initial settings that apply when the font defined by an @font-face rule is rendered. It does not affect font selection. Values are identical to those defined for the 'font-language-override!!property' property defined below except that the value inherit is omitted. When multiple font feature descriptors, properties, or variations are used, the cumulative effect on text rendering is detailed in the section [[#font-feature-variation-resolution]] below.

<!--
██     ██ ████████ ████████ ████████  ████  ██████         ███████  ██     ██ ████████
███   ███ ██          ██    ██     ██  ██  ██    ██       ██     ██ ██     ██ ██     ██
████ ████ ██          ██    ██     ██  ██  ██             ██     ██ ██     ██ ██     ██
██ ███ ██ ██████      ██    ████████   ██  ██             ██     ██ ██     ██ ████████
██     ██ ██          ██    ██   ██    ██  ██             ██     ██  ██   ██  ██   ██
██     ██ ██          ██    ██    ██   ██  ██    ██       ██     ██   ██ ██   ██    ██
██     ██ ████████    ██    ██     ██ ████  ██████         ███████     ███    ██     ██
-->

<h3 id="font-metrics-override-desc">
Default font metrics overriding:
the 'ascent-override!!descriptor',
'descent-override!!descriptor' and
'line-gap-override!!descriptor' descriptors</h3>

	<pre class='descdef'>
	Name: ascent-override
	Value: normal | <<percentage [0,∞]>>
	For: @font-face
	Initial: normal
	</pre>

	<wpt>
		ascent-descent-override.html
		metrics-override-normal-keyword.html
	</wpt>

	<pre class='descdef'>
	Name: descent-override
	Value: normal | <<percentage [0,∞]>>
	For: @font-face
	Initial: normal
	</pre>

	<wpt>
		ascent-descent-override.html
		metrics-override-normal-keyword.html
	</wpt>

	<pre class='descdef'>
	Name: line-gap-override
	Value: normal | <<percentage [0,∞]>>
	For: @font-face
	Initial: normal
	</pre>

	<wpt>
		line-gap-override.html
		metrics-override-normal-keyword.html
	</wpt>

	The 'ascent-override!!descriptor',
	'descent-override!!descriptor' and
	'line-gap-override!!descriptor' descriptors define the
	<a spec="CSS-INLINE-3">ascent metric</a>, <a spec="CSS-INLINE-3">descent metric</a> and
	<a spec="CSS-INLINE-3">line gap metric</a> of the font, respectively.

	When the descriptor value is ''line-gap-override/normal'', the corresponding metric value is obtained from the
	font file directly.

	Note: User agents may draw data from different places from the font file as the metric values,
	which results in different text layouts.

	When the descriptor value is a percentage, the corresponding metric value is resolved as the
	given percentage multiplied by the used font size. Negative values are invalid at parse time.

	<div class="example" id="ex-percent-resolve">
		The percentage is resolved against different font sizes for different elements.

		<pre>
		@font-face {
			font-family: overridden-font;
			ascent-override: 50%;
			...
		}

		&lt;span style="font-family: overridden-font; font-size: 20px;"&gt;
			Outer span content
			&lt;span style="font-size: 150%;"&gt;Inner span content&lt;/span&gt;
		&lt;/span&gt;
		</pre>

		The outer span uses an <a spec="CSS-INLINE-3" lt="ascent metric">ascent</a> value of
		10px, whereas the inner span uses 15px.
	</div>

	<div class="example" id="ex-override-local-metrics">
		We may override the metrics of a local fallback font to match the primary font, which
		is a web font. This reduces layout shifting when switching from fallback to the
		primary font.

		<pre>
		@font-face {
			font-family: cool-web-font;
			src: url("https://example.com/font.woff");
		}

		@font-face {
			font-family: fallback-to-local;
			src: local(Some Local Font);
			/* Override metric values to match cool-web-font */
			ascent-override: 125%;
			descent-override: 25%;
			line-gap-override: 0%;
		}

		&lt;div style="font-family: cool-web-font, fallback-to-local"&gt;Title goes here&lt;/div&gt;
		&lt;img src="https://example.com/largeimage" alt="A large image that you don't want to shift"&gt;
		</pre>

		The image will not be vertically shifted when the user agent finishes loading and
		switches to use the web font.
	</div>

<h2 id="font-matching-algorithm">Font Matching Algorithm</h2>

	The algorithm below describes how fonts are associated with individual runs of text.
	For each character in the run
	a font family is chosen
	and a particular font face is selected
	containing a glyph for that character.

	The set of  <a href="#installed-fonts">installed fonts</a> available
	to the Font Matching Algorithm
	is explicitly undefined.

	The default set of installed fonts will vary
	by UA, platform, and locale;
	it is important that users be able to customise
	which installed fonts are available for rendering web pages
	and to which generic font families, if any,
	these fonts are mapped.

	UAs may choose to expose all installed fonts to the web,
	regardless of how that font was installed;
	doing so is likely to have good internationalization properties
	for users whose primary language is not supported
	by fonts shipping with their operating system.

	UAs may alternatively choose
	to not initially expose any user-installed fonts to aid privacy on the web;
	for the set of installed fonts a user has installed
	is often used as a tracking vector to track users across the web.
	Users should then be able to add to or remove fonts from that set,
	according to their needs.

	UAs may choose a hybrid approach, where some user-installed fonts
	are initially exposed for internationalization,
	but others aren't.
	Again, users should be able to customise this starting set.

	UAs are expected to make informed decisions
	on which fonts they expose to the web by default,
	so as to balance between internationalization and privacy.
	UAs are expected to also provide a convenient means
	for users to add and subtract fonts
	to meet their particular needs.

	<wpt>
		fallback-remote-to-data-url.html
		fallback-url-to-local.html
		variations/at-font-face-font-matching.html
	</wpt>

<!--
██          ██     █████   ██    ██
██        ████    ██   ██  ███   ██
██          ██   ██     ██ ████  ██
██          ██   ██     ██ ██ ██ ██
██          ██   ██     ██ ██  ████
██          ██    ██   ██  ██   ███
████████  ██████   █████   ██    ██
-->

<h3 id="localized-name-matching">Localized name matching</h3>

	Some font file formats allow
	font faces to carry multiple localizations
	of a particular string
	(e.g. family name or named instance).
	User agents must recognize and correctly match all of these names
	independent of the underlying platform localization,
	system API used, or document encoding.

	<div class="example" id="ex-localized-name">
		For example,
		for each of the fonts listed below,
		the author can use either the Latin name
		or the localized name
		in the 'font-family!!property' property,
		and the results will be identical on all systems:

		<figure>
			<img alt="examples of localized family names" src="images/localizedfamilynames.png" width="523" height="211">
			<figcaption>Localized family names</figcaption>
		</figure>
	</div>

	User agents must match these names case insensitively,
	using the "Default Caseless Matching" algorithm outlined in the Unicode specification [[!UNICODE]].
	This algorithm is detailed in section 3.13 entitled "Default Case Algorithms".
	Specifically, the algorithm must be applied
	without normalizing the strings involved
	and without applying any language-specific tailorings.
	The case folding method specified by this algorithm
	uses the case mappings with status field "C" or "F"
	in the CaseFolding.txt file of the Unicode Character Database.

	Note: For authors this means that font family names are matched case insensitively,
	whether those names exist in a platform font
	or in the ''@font-face'' rules contained in a stylesheet.
	Authors should take care to ensure that names
	use a character sequence consistent with the actual font family name,
	particularly when using combining characters such as diacritical marks.
	For example, a family name that contains a lowercase a (U+0061)
	followed by a combining ring (U+030A)
	will <strong>not</strong> match a name that looks identical
	but which uses the precomposed lowercase a-ring character (U+00E5)
	instead of the combining sequence.

	Note: Implementors should take care to verify that a given caseless string comparison implementation
	uses this precise algorithm
	and not assume that a given platform string matching routine follows it,
	as many of these have locale-specific behavior
	or use some level of string normalization.

<!--
██     ██    ███    ████████  ██████  ██     ██        ██████  ████████ ██    ██ ██       ████████
███   ███   ██ ██      ██    ██    ██ ██     ██       ██    ██    ██     ██  ██  ██       ██
████ ████  ██   ██     ██    ██       ██     ██       ██          ██      ████   ██       ██
██ ███ ██ ██     ██    ██    ██       █████████        ██████     ██       ██    ██       ██████
██     ██ █████████    ██    ██       ██     ██             ██    ██       ██    ██       ██
██     ██ ██     ██    ██    ██    ██ ██     ██       ██    ██    ██       ██    ██       ██
██     ██ ██     ██    ██     ██████  ██     ██        ██████     ██       ██    ████████ ████████
-->

<h3 id="font-style-matching">Matching font styles</h3>

	The procedure for choosing a font
	for a given character in a run of text
	consists of iterating over the font families named by the 'font-family!!property' property,
	selecting a font face with the appropriate style
	based on other font properties
	and then determining whether a glyph exists for the given character.
	This is done using the <dfn>character map</dfn> of the font,
	data which maps characters to the default glyph for that character.
	A font is considered to <dfn>support</dfn> a given character if
	(1) the character is contained in the font's <a>character map</a> and
	(2) if required by the containing script, shaping information is available for that character.

	Some legacy fonts might include a given character in the <a>character map</a>
	but lack the shaping information
	(e.g. <a href="https://www.microsoft.com/typography/otspec/ttochap1.htm">OpenType layout tables</a>
	or <a href="https://scripts.sil.org/cms/scripts/page.php?site_id=projects&amp;item_id=graphite_techAbout">Graphite tables</a>)
	necessary for correctly rendering text runs containing that character.

	Codepoint sequences consisting of a base character
	followed by a sequence of combining characters
	are treated slightly differently,
	see the section on <a href="#cluster-matching">cluster matching</a> below.

	For this procedure,
	the <dfn export lt="default face">default font face</dfn> for a given font family
	is defined to be the face that would be selected
	if all font style properties were set to their initial value.

	<ol id="fontmatchingalg">
		1. Using the computed font property values for a given element,
			the user agent starts with the first family name
			specified by the 'font-family!!property' property.

		2. If the family name is a generic family keyword, the user agent
			looks up the appropriate font family name to be used.  User
			agents may choose the generic font family to use based on the
			language of the containing element or the Unicode range of the
			character.

		3. For other family names, the user agent attempts to find the
			family name among fonts defined via ''@font-face'' rules and then
			among available installed fonts
			(this may include font aliases),
			matching names with a
			[[#localized-name-matching]] as outlined
			in the section above.
			If the font
			resources defined for a given face in an ''@font-face'' rule are either
			not available or contain invalid font data, then the face should be
			treated as not present in the family. If no faces are present for a
			family defined via ''@font-face'' rules, the family should be treated as
			missing; matching a platform font with the same name must not occur
			in this case.

		4. If a font family match occurs, the user agent assembles the set
			of font faces in that family and then narrows the set to a single
			face using other font properties in the order given below. Fonts might be
			present in this group which can support a range of
			'font-width!!property', 'font-style!!property', or 'font-weight!!property' properties. In
			this case, the algorithm proceeds as if each supported combination of
			values is a unique font in the set. If such a font is ultimately
			selected by this algorithm, particular values for
			'font-width!!property', 'font-style!!property', and 'font-weight!!property' must be applied
			before any layout or rendering occurs. The application of these values
			must be applied in the <a href="#apply-font-matching-variations">Apply
			font matching variations</a> step detailed in
			[[#font-feature-variation-resolution]].
			A group
			of faces defined via ''@font-face'' rules with identical font
			descriptor values but differing 'unicode-range!!descriptor' values are considered to be
			a single <dfn export lt="composite face">composite font face</dfn> for this step:

			<wpt>
				matching/fixed-stretch-style-over-weight.html
				matching/stretch-distance-over-weight-distance.html
				matching/style-ranges-over-weight-direction.html
			</wpt>

			<ol id="fontstylematchingalg">
				1. 'font-width!!property' is tried first. If a font
					does not have any concept of varying strengths of width values, its width value
					is mapped according table in the <a href="#widthmappings">property definition</a>.
					If the matching set includes faces with width values
					containing the 'font-width!!property' desired value, faces with width values which do not include the desired width value
					are removed from the matching set. If there is no face
					which contains the desired value, a width value is chosen using the rules below:

					* If the desired width value is less than or equal to 100%, width values below the
						desired width value are checked in descending order followed by
						width values above the desired width value in ascending order until a
						match is found.
					* Otherwise, width values above the
						desired width value are checked in ascending order followed by
						width values below the desired width value in descending order until a
						match is found.

					Once the
					closest matching width has been determined by this process,
					faces with widths which do not include this determined width are removed from the matching set.

					<div class="example" id="ex-ascending-stretch">
						This search algorithm can be thought of as a distance function, where the lowest-distance value present in the font family is selected, and all fonts not including that value are eliminated.

						Consider a font family with three fonts, named A, B, and C, each with associated supported ranges for the 'font-width!!property' descriptor. If an element is styled with "font-width: 125%", the search algorithm can be visualized as follows:

						<img src="images/stretchdistance.svg" width="600" height="450" alt="algorithm">

						The font width ranges supported by fonts A, B, and C are shown in the graph above. As you can see, because font B contains the minimum width value across the entire family, font B would be selected by this algorithm. However, if font B were somehow eliminated from the family, font C would then contain the lowest distance in the family, so it would be selected.
					</div>

					<div class="example" id="ex-ascending-stretch-2">
						Similar to the <a href="#ex-ascending-stretch">previous example</a>, here is the conceptual distance graph for an element styled with "font-width: 75%":

						<img src="images/stretchdistance2.svg" width="600" height="450" alt="distance graph">

						As you can see, because font B contains the minimum width value across the entire family, font B would be selected by this algorithm. However, if font B were somehow eliminated from the family, font A would then contain the lowest distance in the family, so it would be selected.
					</div>

				2. 'font-style!!property' is tried next
					(see [[#font-style-matching]]).
					If a font does not have any concept of varying strengths of italics or oblique angles, its style
					is mapped according to the description in the 'font-style!!property' property definition.

					If the value of 'font-style!!property' is ''italic'':

					1. If the matching set includes faces with italic values containing the mapped value of ''italic'',
						then faces with italic values which do not include the desired italic mapped value are removed from the matching set.
					2. Otherwise, italic values above the desired italic value are checked in ascending order followed by
						italic values below the desired italic value, until 0 is hit. Only positive values of italic values are checked
						in this stage.
					3. If no match is found, oblique values greater than or equal to 11deg are checked in ascending order
						followed by oblique values below 11deg in descending order, until 0 is hit. Only positive values of oblique values
						are checked in this stage.

						ISSUE: The threshold for preferring oblique over normal <a href="https://github.com/w3c/csswg-drafts/issues/2295">should be lower than the average angle</a>.

					4. If no match is found, italic values less than or equal to 0 are checked in descending order until a match is found.
					5. If no match is found, oblique values less than or equal to 0deg are checked in descending order until a match is found.

						<div class="example" id="ex-ascending-italic">
							Similar to the <a href="#ex-ascending-stretch">previous example</a>, here is the conceptual distance graph for an element styled with "font-style: italic":

							<img src="images/styledistance.svg" width="600" height="400" alt="distance graph">

							As you can see, because font D contains the minimum italic value across the entire family, font D would be selected by this algorithm. However, if font D were somehow eliminated from the family, font E would then contain the lowest distance in the family, so it would be selected. If E were eliminated, C would be selected. If C were eliminated, font B would not be chosen immediately; instead, oblique values would be consulted and an oblique value might be chosen. However, if no oblique value is chosen, font B would then be selected, followed by font A.
						</div>

					If the value of 'font-style!!property' is ''oblique'' and the requested angle is greater than or equal to 11deg,

					<ol id="greater-oblique-steps">
						1. If the matching set includes faces with oblique values containing the value of ''oblique'',
							faces with oblique values which do not include the desired oblique value are removed from the matching set.
						2. Otherwise, oblique values above the desired oblique value are checked in ascending order followed by
							oblique values below the desired oblique value, until 0 is hit. Only positive values of oblique values are checked in this stage.
						3. For variable fonts with a slnt axis,
							a match is created by setting the slnt value
							with the specified oblique value.
							Otherwise, if 'font-synthesis-style' has the value
							''font-synthesis-style/auto'',
							then a fallback match is produced
							by geometric shearing to the specified oblique value.
						4. If no match is found, italic values greater than or equal to 1 are checked in ascending order
							followed by italic values below 1 in descending order, until 0 is hit. Only positive values of italic values are checked in this stage.
						5. If no match is found, oblique values less than or equal to 0deg are checked in descending order until a match is found.
						6. If no match is found, italic values less than or equal to 0 are checked in descending order until a match is found.

							<div class="example" id="ex-ascending-oblique-40">
								Similar to the <a href="#ex-ascending-stretch">previous example</a>, here is the conceptual distance graph for an element styled with "font-style: oblique 40deg":

								<img src="images/styledistance2.svg" width="600" height="400" alt="distance graph">

								As you can see, because font D contains the minimum oblique value across the entire family, font D would be selected by this algorithm. However, if font D were somehow eliminated from the family, font E would then contain the lowest distance in the family, so it would be selected. If E were eliminated, C would be selected. If C were eliminated, font B would not be chosen immediately; instead, italic values would be consulted and an italic value might be chosen. However, if no italic value is chosen, font B would then be selected, followed by font A.
							</div>
					</ol>

					If the value of 'font-style!!property' is ''oblique'' and the requested angle is greater than or equal to 0deg and less than 11deg,

					<ol id="lesser-oblique-steps">
						1. If the matching set includes faces with oblique values containing the value of ''oblique'',
							faces with oblique values which do not include the desired oblique value are removed from the matching
							set.
						2. Otherwise, oblique values below the desired oblique value are checked in descending order until 0 is hit, followed by
							oblique values above the desired oblique value. Only positive values of oblique values are checked
							in this stage.
						3. For variable fonts with a slnt axis,
							a match is created by setting the slnt value
							with the specified oblique value.
							Otherwise, if 'font-synthesis-style' has the value ''font-synthesis-style/auto'',
							then a fallback match is produced
							by geometric shearing to the specified oblique value.
						4. If no match is found, italic values less than 1 are checked in descending order until 0 is hit,
							followed by italic values above 1 in ascending order. Only positive values of italic values
							are checked in this stage.
						5. If no match is found, oblique values less than or equal to 0deg are checked in descending order until a match is found.
						6. If no match is found, italic values less than or equal to 0 are checked in descending order until a match is found.
					</ol>

					<div class="example" id="ex-ascending-oblique-13">
						Similar to the <a href="#ex-ascending-stretch">previous example</a>, here is the conceptual distance graph for an element styled with "font-style: oblique 13deg":

						<img src="images/styledistance3.svg" width="600" height="400" alt="distance graph">

						As you can see, because font D contains the minimum oblique value across the entire family, font D would be selected by this algorithm. However, if font D were somehow eliminated from the family, font C would then contain the lowest distance in the family, so it would be selected. If C were eliminated, E would be selected. If E were eliminated, font B would not be chosen immediately; instead, italic values would be consulted and an italic value might be chosen. However, if no italic value is chosen, font B would then be selected, followed by font A.
					</div>

					If the value of 'font-style!!property' is ''oblique'' and the requested angle is less than 0deg and greater than -11deg, follow the steps <a href="#lesser-oblique-steps">above</a>, except with the negated values and opposite directions. If the value of 'font-style!!property' is ''oblique'' and the requested angle is less than or equal to -11deg, follow the steps <a href="#greater-oblique-steps">above</a>, except with the negated values and opposite directions.

					If the value of 'font-style!!property' is ''font-style/normal'',

					1. Oblique values greater than or equal to 0 are checked in ascending order.
					2. If no match is found, italic values greater than or equal to 0 are checked in ascending
					3. If no match is found, oblique values less than 0deg are checked in descending order until a match is found.
					4. If no match is found, italic values less than 0 are checked in descending order until a match is found.

					<div class="example" id="ex-ascending-normal">
						Similar to the <a href="#ex-ascending-stretch">previous example</a>, here is the conceptual distance graph for an element styled with "font-style: normal":

						<img src="images/styledistance4.svg" width="600" height="375" alt="distance graph">

						As you can see, because font C contains the minimum oblique value across the entire family, font C would be selected by this algorithm. However, if font C were somehow eliminated from the family, font B would not be chosen immediately; instead, italic values would be consulted and an italic value might be chosen. However, if no italic value is chosen, font B would then be selected, followed by font A.
					</div>

					If an oblique angle was found in the above search, all faces which don't include that oblique angle are excluded from the matching set. Otherwise, if an italic value was found in the above search, all faces which don't include that italic value are excluded from the matching set.

					<wpt>
						oblique-last-resort-weight-selection.html
						oblique-request-italic-only-family-no-crash.html
					</wpt>

					User agents are not required to distinguish between italic and oblique fonts. In such user agents, the 'font-style!!property' matching steps above are performed by mapping both italic values and oblique angles onto a common scale. The exact nature of this mapping is undefined, however, an italic value of 1 must map to the same value that an oblique angle of 11deg maps to. Within font
					families defined via ''@font-face'' rules, italic and oblique
					faces must be distinguished using the value of the
					'font-style!!descriptor' descriptor.

					For families that lack any italic or oblique faces, user agents
					may create artificial oblique faces, if this is permitted by the
					value of the 'font-synthesis' property.


				3. 'font-weight!!property' is matched next. If a font does not have any concept of varying strengths of weights, its weight is mapped according list in the <a href="#font-weight-numeric-values">property definition</a>. If bolder/lighter relative weights are used, the effective weight is calculated based on the inherited weight value, as described in the definition of the 'font-weight!!property' property. If the matching set after performing the steps above includes faces with weight values containing the font-weight desired value, faces with weight values which do not include the desired font-weight value are removed from the matching set. If there is no face which contains the desired value, a weight value is chosen using the rules below:

					* If the desired weight is inclusively between 400 and 500, weights greater than or equal to the target weight are checked in ascending order until 500 is hit and checked, followed by weights less than the target weight in descending order, followed by weights greater than 500, until a match is found.
					* If the desired weight is less than 400, weights less than or equal to the
						desired weight are checked in descending order followed by
						weights above the desired weight in ascending order until a
						match is found.
					* If the desired weight is greater than 500, weights greater than or equal to the
						desired weight are checked in ascending order followed by
						weights below the desired weight in descending order until a
						match is found.

						<wpt>
							matching/font-weight-search-direction.html
						</wpt>

					<div class="example" id="ex-weight-400">
						Similar to the <a href="#ex-ascending-stretch">previous example</a>, here is the conceptual distance graph for an element styled with "font-weight: 400":

						<img src="images/styleweight.svg" width="600" height="400" alt="distance graph">

						As you can see, because font B contains the minimum distance across the entire family, font B would be selected by this algorithm. However, if font B were somehow eliminated from the family, font C would then contain the lowest distance in the family, so it would be selected. If C were eliminated, D would be selected, followed by fonts A and then E.
					</div>

					<div class="example" id="ex-weight-450">
						Similar to the <a href="#ex-ascending-stretch">previous example</a>, here is the conceptual distance graph for an element styled with "font-weight: 450":

						<img src="images/styleweight450.svg" width="600" height="400" alt="distance graph">

						As you can see, because font C contains the minimum distance across the entire family, font C would be selected by this algorithm. However, if font C were somehow eliminated from the family, font D would then contain the lowest distance in the family, so it would be selected. If D were also eliminated, B would be selected, followed by fonts A and then E.
					</div>

					<div class="example" id="ex-weight-500">
						Similar to the <a href="#ex-ascending-stretch">previous example</a>, here is the conceptual distance graph for an element styled with "font-weight: 500":

						<img src="images/weightmatching.svg" width="600" height="400" alt="distance graph">

						As you can see, because font D contains the minimum distance across the entire family, font D would be selected by this algorithm. However, if font D were somehow eliminated from the family, font B would then contain the lowest distance in the family, so it would be selected. If B were eliminated, C would be selected, followed by fonts B, A, and then E.
					</div>

					<div class="example" id="ex-weight-300">
						Similar to the <a href="#ex-ascending-stretch">previous example</a>, here is the conceptual distance graph for an element styled with "font-weight: 300":

						<img src="images/weightmatching2.svg" width="600" height="400" alt="distance graph">

						As you can see, because font B contains the minimum distance across the entire family, font B would be selected by this algorithm. However, if font B were somehow eliminated from the family, font A would then contain the lowest distance in the family, so it would be selected. If A were eliminated, C would be selected.
					</div>

					Once the closest matching weight has been determined by this process,
					faces with weights which do not include this determined weight are removed from the matching set.

					Note: There is a small behavior change between [[CSS-FONTS-3]] and this specification
					with the animation of the 'font-weight!!property' property.
					Previously, interpolated values of font-weight were rounded to their closest multiple of 100,
					and the font-matching algorithm was run on these rounded values.
					In this specification, the font-matching algorithm is able to accept any value,
					so no rounding occurs.
					The small behavior change is due to the discontinuous nature of the font-matching algorithm.

				4. 'font-size' must be
					matched within a UA-dependent margin of tolerance. (Typically, sizes
					for scalable fonts are rounded to the nearest whole pixel, while the
					tolerance for bitmapped fonts could be as large as 20%.) Further
					computations, e.g., by ''em'' values in other properties, are based on
					the 'font-size' value that
					is used, not the one that is specified.
			</ol>

			Note that more than one font might be remaining in the matching set after performing
			the above steps. If so, the user agent must choose a single font from
			the matching set and continue these steps with it. The choice of which
			font to choose can differ between multiple user agents and multiple operating
			system platforms; however, it must not differ between two elements in the same document.

		5. If the matched face is defined via ''@font-face''
			rules, user agents must use the procedure below to select a single
			font:

			1. If the font resource has not been loaded and the range of
				characters defined by the 'unicode-range!!descriptor' descriptor value
				includes the character in question, load the font.
			2. After downloading, if the [=effective character map=]
				supports the character in question, select that font.

			When the matched face is a [=composite face=], user agents must use
			the procedure above on each of the faces in the [=composite face=] in
			reverse order of ''@font-face'' rule definition.

			While the download occurs, user agents must either wait until the
			font is downloaded or render once with substituted font metrics and
			render again once the font is downloaded.


		6. If no matching face exists or the matched face does not contain
			a glyph for the character to be rendered, the next family name is
			selected and the previous three steps repeated.  Glyphs from other
			faces in the family are not considered.  The only exception is that
			user agents may optionally substitute a synthetically obliqued version of the
			[=default face=] if that face supports a given glyph and synthesis
			of these faces is permitted by the value of the 'font-synthesis' property.
			For example, a synthetic italic version of the regular face might be used if the
			italic face doesn't support glyphs for Arabic.

			<!-- resolution on the above: http://lists.w3.org/Archives/Public/www-style/2012Nov/0292.html -->

		7. If there are no more font families to be evaluated and no matching
			face has been found, then the user agent performs an <dfn>installed font
			fallback</dfn> procedure to find the best match for the character to be
			rendered.  The result of this procedure can vary across user agents.

		8. If a particular character cannot be displayed using any
			font, the user agent should indicate by some means that a
			character is not being displayed, displaying either a
			symbolic representation of the missing glyph (e.g. using a <a
			href="https://en.wikipedia.org/wiki/Last_resort_font">Last
			Resort Font</a>) or using the missing character glyph from
			a default font.
	</ol>

	Optimizations of this process are allowed
	provided that an implementation behaves as if the algorithm had been followed exactly.
	Matching occurs in a well-defined order
	to ensure that the results are as consistent as possible across user agents,
	given an identical set of available fonts and rendering tech.

	The <dfn export>first available font</dfn>,
	used for example in the definition of <a>font-relative lengths</a> such as ''ex''
	or in the definition of the 'line-height' property,
	is defined to be the first font
	for which the character U+0020 (space)
	is not excluded by a 'unicode-range!!descriptor',
	given the font families in the 'font-family!!property' list
	(or a user agent's default font if none are available).

	Installed fonts referenced directly by family name,
	rather than via @font-face rules,
	are considered to have a 'unicode-range!!descriptor'
	that covers the entire Unicode code space.

	<wpt>
		first-available-font-001.html
		first-available-font-002.html
		first-available-font-003.html
		first-available-font-004.html
		first-available-font-005.html
		first-available-font-006.html
		first-available-font-007.html
		italic-oblique-fallback.html
	</wpt>

	Note: it does not matter whether that font actually has a glyph for the space character.

<!--
 ██████  ██       ██     ██  ██████  ████████ ████████ ████████
██    ██ ██       ██     ██ ██    ██    ██    ██       ██     ██
██       ██       ██     ██ ██          ██    ██       ██     ██
██       ██       ██     ██  ██████     ██    ██████   ████████
██       ██       ██     ██       ██    ██    ██       ██   ██
██    ██ ██       ██     ██ ██    ██    ██    ██       ██    ██
 ██████  ████████  ███████   ██████     ██    ████████ ██     ██
-->

<h3 id="cluster-matching">
Cluster matching</h3>

	When text contains characters such as combining marks,
	ideally
	the base character should be rendered
	using the same font as the mark,
	this assures proper placement of the mark.
	For this reason,
	the font matching algorithm for clusters
	is more specialized
	than the general case of matching a single character by itself.
	For sequences containing variation selectors,
	which indicate the precise glyph to be used for a given character,
	user agents always attempt <a>installed font fallback</a>
	to find the appropriate glyph
	before using the default glyph of the base character.

	A sequence of codepoints containing combining mark
	or other modifiers
	is termed a grapheme cluster
	(see [[CSS3TEXT]] and [[UAX29]] for a more complete description).
	For a given cluster containing a base character,
	<em>b</em> and a sequence of combining characters
	<em>c1, c2&hellip;</em>, the entire cluster is matched using these steps:

	<ol>
		<li>For each family in the font list,
			a face is chosen using the style selection rules
			defined in the previous section.

			<ol>
				<li>If all characters in the sequence <em>b + c1 + c2 &hellip;</em>
				are completely supported by the font,
				select this font for the sequence.</li>

				<li>If a sequence of multiple codepoints
					is canonically equivalent to a single character
					and the font <a>supports</a> that character,
					select this font for the sequence
					and use the glyph associated with
					the canonically equivalent character
					for the entire cluster.</li>
			</ol>

		<li>If no font was found in the font list in step 1:

			<ol>
				<li>If <em>c1</em> is a variation selector,
					system fallback must be used
					to find a font that <em title="support">supports</em>
					the full sequence of <em>b + c1</em>.
					If no font on the system <a>supports</a> the full sequence,
					match the single character <em>b</em>
					using the normal procedure for matching
					single characters
					and ignore the variation selector.
					Note: a sequence with more than one variation selector
					must be treated as an encoding error
					and the trailing selectors must be ignored. [[!UNICODE]]</li>

				<li>Otherwise, the user agent may optionally use
					installed font fallback
					to match a font that <a>supports</a>
					the entire cluster.</li>
			</ol>

		<li>If no font is found in step 2,
			use the matching sequence
			from step 1 to determine the longest sequence
			that is completely <a>supported</a>
			by a font in the font list
			and attempt to match the remaining combining characters
			separately using the rules for single characters.</li>
	</ol>

<!--
 ██████  ██     ██    ███    ████████        ██     ██    ███    ██    ██ ████████  ██       ████████
██    ██ ██     ██   ██ ██   ██     ██       ██     ██   ██ ██   ███   ██ ██     ██ ██       ██
██       ██     ██  ██   ██  ██     ██       ██     ██  ██   ██  ████  ██ ██     ██ ██       ██
██       █████████ ██     ██ ████████        █████████ ██     ██ ██ ██ ██ ██     ██ ██       ██████
██       ██     ██ █████████ ██   ██         ██     ██ █████████ ██  ████ ██     ██ ██       ██
██    ██ ██     ██ ██     ██ ██    ██        ██     ██ ██     ██ ██   ███ ██     ██ ██       ██
 ██████  ██     ██ ██     ██ ██     ██       ██     ██ ██     ██ ██    ██ ████████  ████████ ████████
-->

<h3 id="char-handling-issues">
Character handling issues</h3>

	CSS font matching is always performed on
	text runs containing Unicode characters [[!UNICODE]],
	so documents using legacy encodings are assumed
	to have been transcoded before matching fonts.
	For fonts containing <a>character maps</a>
	for both legacy encodings and Unicode,
	the contents of the legacy encoding <a>character map</a>
	must have no effect on the results
	of the font matching process.

	The font matching process does not assume
	that text runs are in either normalized or denormalized form
	(see [[CHARMOD-NORM]] for more details).
	Fonts may only support precomposed forms
	and not the decomposed sequence of base character plus combining marks.
	Authors should always tailor their choice of fonts to their content,
	including whether that content contains
	normalized or denormalized character streams.

	If a given character is a Private-Use Area Unicode codepoint,
	user agents must only
	match font families named in the 'font-family' list
	that are not generic families.
	If none of the families
	named in the 'font-family' list
	contain a glyph for that codepoint,
	user agents must display some form of missing glyph symbol
	for that character
	rather than attempting <a>installed font fallback</a>
	for that codepoint.
	When matching the replacement character U+FFFD,
	user agents may skip the font matching process
	and immediately display
	some form of missing glyph symbol,
	they are not required to display
	the glyph from the font
	that would be selected
	by the font matching process.

	In general,
	the fonts for a given family
	will all have the same
	or similar <a>character maps</a>.
	The process outlined here
	is designed to handle even font families
	containing faces with widely variant <a>character maps</a>.
	However,
	authors are cautioned that
	the use of such families
	can lead to unexpected results.

	<wpt>
		matching/font-unicode-PUA.html
		matching/font-unicode-PUA-primary-font.html
	</wpt>

<!-- start new list wrt Fonts 3, if needed
<h3 id="font-matching-changes">
Font matching changes since CSS Fonts 3</h3>
-->

<!-- new examples wrt Fonts 3, if needed
<h3 id="font-matching-examples">
Font matching examples</h3>
-->

<h2 id="font-rend-props">
Font Feature Properties</h2>

	Modern font technologies support a variety of
	advanced typographic and language-specific font features.
	Using these features,
	a single font can provide glyphs
	for a wide range of
	ligatures,
	contextual and stylistic alternates,
	tabular and old-style figures,
	small capitals,
	automatic fractions,
	swashes,
	and alternates specific to a given language.
	To allow authors control over these font capabilities,
	the 'font-variant!!property' property has been expanded.
	It now functions as a shorthand
	for a set of properties
	that provide control over
	stylistic font features.

<!--
 ██████   ██       ██    ██ ████████  ██     ██        ██████  ████████ ██       ████████  ██████  ████████
██    ██  ██        ██  ██  ██     ██ ██     ██       ██    ██ ██       ██       ██       ██    ██    ██
██        ██         ████   ██     ██ ██     ██       ██       ██       ██       ██       ██          ██
██   ████ ██          ██    ████████  █████████        ██████  ██████   ██       ██████   ██          ██
██    ██  ██          ██    ██        ██     ██             ██ ██       ██       ██       ██          ██
██    ██  ██          ██    ██        ██     ██       ██    ██ ██       ██       ██       ██    ██    ██
 ██████   ████████    ██    ██        ██     ██        ██████  ████████ ████████ ████████  ██████     ██
-->

<h3 id="glyph-selection-positioning">
Glyph selection and positioning</h3>

	This section is non-normative

	Simple fonts used for displaying Latin text
	use a very basic processing model.
	Fonts contain a <a>character map</a>
	which maps each character
	to a glyph for that character.
	Glyphs for subsequent characters
	are simply placed one after the other along a run of text.
	Modern font formats
	such as OpenType
	and AAT (Apple Advanced Typography)
	use a richer processing model.
	The glyph for a given character can be
	chosen and positioned
	not just based on the codepoint of the character itself,
	but also on adjacent characters
	as well as the language,
	script,
	and features enabled for the text.
	Font features may be
	required for specific scripts,
	or recommended as enabled by default
	or they might be stylistic features
	meant to be used under author control.
	The point at which font selection and positioning happens
	in the overall order of text processing operations
	(such as text transformation, text orientation and text alignment)
	is described in [[css-text-3#order]].

	For a detailed description of glyph processing
	for OpenType fonts,
	see [[WINDOWS-GLYPH-PROC]].

	Stylistic font features can be classified
	into two broad categories:
	ones that affect the harmonization of glyph shapes
	with the surrounding context,
	such as kerning and ligature features,
	and ones such as the small-caps,
	subscript/superscript and alternate features
	that affect shape selection.

	The subproperties of 'font-variant!!property' listed below
	are used to control these stylistic font features.
	They do not control features
	that are required for displaying certain scripts,
	such as the OpenType features used when displaying Arabic or Indic language text.
	They affect glyph selection and positioning,
	but do not affect font selection
	as described in the font matching section
	(except in cases required for compatibility with CSS 2.1).

	To assure consistent behavior across user agents,
	the equivalent OpenType property settings
	are listed for individual properties
	and are normative.
	When using other font formats
	these should be used as a guideline
	to map CSS font feature property values
	to specific font features.

<!--
██          ███    ██    ██  ██████
██         ██ ██   ███   ██ ██    ██
██        ██   ██  ████  ██ ██
██       ██     ██ ██ ██ ██ ██   ████
██       █████████ ██  ████ ██    ██
██       ██     ██ ██   ███ ██    ██
████████ ██     ██ ██    ██  ██████
-->

<h3 id="language-specific-support">
Language-specific display</h3>

	OpenType also supports language-specific glyph selection and
	positioning, so that text can be displayed correctly in cases where
	the language dictates a specific display behavior. Many languages
	share a common script, but the shape of certain letters can vary
	across those languages. For example, certain Cyrillic letters have
	different shapes in Russian text than in Bulgarian. In Latin text,
	it's common to render "fi" with an explicit fi-ligature that lacks a
	dot on the "i". However, in languages such as Turkish which uses both
	a dotted-i and a dotless-i, it's important to not use this ligature or
	use a specialized version that contains a dot over the "i".

	<wpt>
		language-specific-01.html
	</wpt>

	The example below shows language-specific variations based on stylistic
	traditions found in Spanish, Italian and French orthography:

	<div class="featex"><img alt="language specific forms, spanish" src="images/locl-1.png" width="432" height="62"></div>
	<div class="featex"><img alt="language specific forms, italian" src="images/locl-2.png" width="396" height="62"></div>
	<div class="featex"><img alt="language specific forms, french" src="images/locl-3.png" width="288" height="62"></div>

	If the content language of the element is known according to the
	rules of the <a href="https://www.w3.org/TR/CSS21/conform.html#doclanguage">document language</a>,
	user agents are required to infer the OpenType language system from
	the [=content language=] and use that when selecting and positioning
	glyphs using an OpenType font.
	If a writing system has been explicitly specified,
	it must take precedence over the customary one implied by the [=content language=].

	<!-- previously in level 3, now moved to Level 4 -->
	For OpenType fonts, in some cases it may be necessary to explicitly
	declare the OpenType language to be used, for example when displaying
	text in a given language that uses the typographic conventions of
	another language or when the font does not explicitly support a given
	language but supports a language that shares common typographic
	conventions. The 'font-language-override!!property' property is used for this
	purpose.

<!--
██    ██ ████████ ████████  ██    ██
██   ██  ██       ██     ██ ███   ██
██  ██   ██       ██     ██ ████  ██
█████    ██████   ████████  ██ ██ ██
██  ██   ██       ██   ██   ██  ████
██   ██  ██       ██    ██  ██   ███
██    ██ ████████ ██     ██ ██    ██
-->

<h3 id="font-kerning-prop">
Kerning: the 'font-kerning' property</h3>

	<pre class="propdef">
	Name: font-kerning
	Value: auto | normal | none
	Initial: auto
	Applies to: all elements and text
	Inherited: yes
	Percentages: n/a
	Computed value: as specified
	Animation type: discrete
	</pre>

	<wpt>
		font-kerning-01.html
		font-kerning-02.html
		font-kerning-03.html
		font-kerning-04.html
		font-kerning-05.html
		cjk-kerning.html
		hiragana-katakana-kerning.html
		parsing/font-kerning-computed.html
		parsing/font-kerning-invalid.html
		parsing/font-kerning-valid.html
	</wpt>

	<p>Kerning is the contextual adjustment
	of inter-glyph spacing.
	This property controls metric kerning,
	kerning that utilizes adjustment data
	contained in the font.</p>

	<dl dfn-for="font-kerning" dfn-type="value">
		<dt><dfn id="font-kerning-auto-value" title="auto!!font-kerning">auto</dfn></dt>
		<dd>Specifies that kerning is applied at the discretion of the user agent</dd>
		<dt><dfn id="font-kerning-normal-value" title="normal!!font-kerning">normal</dfn></dt>
		<dd>Specifies that kerning is applied</dd>
		<dt><dfn id="font-kerning-none-value" title="none!!font-kerning">none</dfn></dt>
		<dd>Specifies that kerning is not applied</dd>
	</dl>

	<p>For fonts that do not include kerning data
	this property will have no visible effect.
	When rendering with OpenType fonts,
	the [[!OPENTYPE]] specification suggests that
	kerning be enabled by default.
	When kerning is enabled,
	the relevant OpenType kerning features are enabled
	(for horizontal [=typographic modes=]
	and for [=sideways typesetting=] in vertical [=typographic modes=],
	the <span class="tag">kern</span> feature;
	for [=upright typesetting=] in [=vertical typographic modes=],
	the <span class="tag">vkrn</span> feature.
	User agents must also support fonts
	that only support kerning
	via data contained in a
	<span class="tag">kern</span> font table,
	as detailed in the OpenType specification.
	If the 'letter-spacing' property is defined,
	kerning adjustments are considered part of the default spacing
	and letter spacing adjustments are made
	<em>after</em> kerning has been applied.</p>

	<p>When set to ''font-kerning/auto!!value'',
	user agents can determine
	whether to apply kerning or not
	based on a number of factors:
	text size,
	script, or
	other factors that influence text processing speed.
	Authors who want proper kerning
	should use ''font-kerning/normal''
	to explicitly enable kerning.
	Likewise,
	some authors may prefer to disable kerning
	in situations where performance
	is more important than precise appearance.
	However, in well-designed modern implementations
	the use of kerning generally
	does not have a large impact
	on text rendering speed.</p>

<!--
██       ████  ██████      ███    ████████ ██     ██ ████████  ████████
██        ██  ██    ██    ██ ██      ██    ██     ██ ██     ██ ██
██        ██  ██         ██   ██     ██    ██     ██ ██     ██ ██
██        ██  ██   ████ ██     ██    ██    ██     ██ ████████  ██████
██        ██  ██    ██  █████████    ██    ██     ██ ██   ██   ██
██        ██  ██    ██  ██     ██    ██    ██     ██ ██    ██  ██
████████ ████  ██████   ██     ██    ██     ███████  ██     ██ ████████
-->

<h3 id="font-variant-ligatures-prop">
Ligatures: the 'font-variant-ligatures' property</h3>

	<pre class="propdef">
	Name: font-variant-ligatures
	Value: <span title="normal!!font-variant-ligatures">normal</span> | <span title="none!!font-variant-ligatures">none</span> | [ <var>&lt;common-lig-values&gt;</var> || <var>&lt;discretionary-lig-values&gt;</var> || <var>&lt;historical-lig-values&gt;</var> || <var>&lt;contextual-alt-values&gt;</var> ]
	Initial: normal
	Applies to: all elements and text
	Inherited: yes
	Percentages: n/a
	Computed value: as specified
	Animation type: discrete
	</pre>

	<wpt>
		font-variant-ligatures-01.html
		font-variant-ligatures-02.html
		font-variant-ligatures-03.html
		font-variant-ligatures-04.html
		font-variant-ligatures-05.html
		font-variant-ligatures-06.html
		font-variant-ligatures-07.html
		font-variant-ligatures-08.html
		font-variant-ligatures-09.html
		font-variant-ligatures-10.html
		font-variant-ligatures-11.optional.html
		font-variant-ligatures.html
		font-features-across-space-1.html
		font-features-across-space-2.html
		font-features-across-space-3.html
		parsing/font-variant-ligatures-computed.html
		parsing/font-variant-ligatures-invalid.html
		parsing/font-variant-ligatures-valid.html
	</wpt>

	<p>Ligatures and contextual forms
	are ways of combining glyphs
	to produce more harmonized forms.</p>

	<pre class="prod"><dfn id="common-lig-values"><var>&lt;common-lig-values&gt;</var></dfn>        = [ common-ligatures | no-common-ligatures ]</pre>

	<pre class="prod"><dfn id="discretionary-lig-values"><var>&lt;discretionary-lig-values&gt;</var></dfn> = [ discretionary-ligatures | no-discretionary-ligatures ]</pre>

	<pre class="prod"><dfn id="historical-lig-values"><var>&lt;historical-lig-values&gt;</var></dfn>    = [ historical-ligatures | no-historical-ligatures ]</pre>

	<pre class="prod"><dfn id="contextual-alt-values"><var>&lt;contextual-alt-values&gt;</var></dfn>    = [ contextual | no-contextual ]</pre>

	<p>Individual values have the following meanings:</p>

	<dl dfn-for="font-variant-ligatures" dfn-type="value">
		<dt><dfn id="font-variant-ligatures-normal-value" title="normal!!font-variant-ligatures">normal</dfn>
		<dd>A value of ''font-variant-ligatures/normal''
			specifies that common default features are enabled,
			<a href="#font-feature-variation-resolution">as described in detail
			in the next section</a>.
			For OpenType fonts,
			common ligatures and contextual forms are on by default,
			discretionary and historical ligatures are not.</dd>

		<dt><dfn id="font-variant-ligatures-none-value">''font-variant-ligatures/none''</dfn>
		<dd>Specifies that all types of ligatures and contextual forms
			covered by this property
			are explicitly disabled.
			In situations where ligatures are not considered necessary,
			this <em>may</em>
			improve the speed of text rendering.</dd>

		<dt><dfn>common-ligatures</dfn>
		<dd>Enables display of common ligatures
			(OpenType features: <span class="tag">liga, clig</span>).
			For OpenType fonts,
			common ligatures are enabled by default.

		<div class="featex"><img alt="common ligature example" src="images/liga.png" width="300" height="69"></div>

		<dt><dfn>no-common-ligatures</dfn>
		<dd>Disables display of common ligatures
			(OpenType features: <span class="tag">liga, clig</span>).

		<dt><dfn>discretionary-ligatures</dfn>
		<dd>Enables display of discretionary ligatures
			(OpenType feature: <span class="tag">dlig</span>).
			Which ligatures are discretionary or optional is decided by the type designer,
			so authors will need to refer to
			the documentation of a given font
			to understand which ligatures are considered discretionary.

		<div class="featex"><img alt="discretionary ligature example" src="images/dlig.png" width="432" height="62"></div>

		<dt><dfn>no-discretionary-ligatures</dfn>
		<dd>Disables display of discretionary ligatures
			(OpenType feature: <span class="tag">dlig</span>).

		<dt><dfn>historical-ligatures</dfn>
		<dd>Enables display of historical ligatures
			(OpenType feature: <span class="tag">hlig</span>).

			<div class="featex"><img alt="historical ligature example" src="images/hlig.png" width="300" height="87"></div>

		<dt><dfn>no-historical-ligatures</dfn>
		<dd>Disables display of historical ligatures
			(OpenType feature: <span class="tag">hlig</span>).

		<dt><dfn>contextual</dfn>
		<dd>Enables display of contextual alternates
			(OpenType feature: <span class="tag">calt</span>).
			Although not strictly a ligature feature,
			like ligatures this feature is commonly used
			to harmonize the shapes of glyphs with the surrounding context.
			For OpenType fonts,
			this feature is on by default.

			<div class="featex"><img alt="contextual alternate example" src="images/calt.png" width="500" height="66"></div>

		<dt><dfn>no-contextual</dfn>
		<dd>Disables display of contextual alternates
			(OpenType feature: <span class="tag">calt</span>).</dd>
	</dl>

	<p id="rlig-unaffected"><em>Required</em> ligatures,
	needed for correctly rendering complex scripts,
	are not affected by the settings above,
	including ''font-variant-ligatures/none''
	(OpenType feature: <span class="tag">rlig</span>).</p>

<!--
 ██████  ██     ██ ████████         ██████  ██     ██ ████████
██    ██ ██     ██ ██     ██       ██    ██ ██     ██ ██     ██
██       ██     ██ ██     ██       ██       ██     ██ ██     ██
 ██████  ██     ██ ████████         ██████  ██     ██ ████████
      ██ ██     ██ ██                    ██ ██     ██ ██     ██
██    ██ ██     ██ ██              ██    ██ ██     ██ ██     ██
 ██████   ███████  ██               ██████   ███████  ████████
-->

<h3 id="font-variant-position-prop">
Subscript and superscript forms: the 'font-variant-position' property</h3>

	<pre class="propdef">
	Name: font-variant-position
	Value: normal | sub | super
	Initial: normal
	Applies to: all elements and text
	Inherited: yes
	Percentages: n/a
	Computed value: as specified
	Animation type: discrete
	</pre>

	<wpt>
		font-variant-position-01.html
		font-variant-position-02.html
		font-variant-position-03.html
		font-variant-position-04.html
		font-variant-position-05.html
		font-variant-position.html
		parsing/font-variant-position-computed.html
		parsing/font-variant-position-invalid.html
		parsing/font-variant-position-valid.html
	</wpt>

	<p>This property is used
	to enable typographic subscript and superscript glyphs.
	These are alternate glyphs
	designed within the same em-box as default glyphs
	and are intended to be laid out
	on the same baseline
	as the default glyphs,
	with no resizing or repositioning of the baseline.
	They are explicitly designed
	to match the surrounding text
	and to be more readable
	without affecting the line height.</p>

	<div class="figure">
		<img alt="comparison between real subscript glyphs and synthesized ones" src="images/realsubscripts.png" width="649" height="250">
		<p class="caption">Subscript glyphs (top) vs. typical synthesized subscripts (bottom)</p>
	</div>

	<p>Individual values have the following meanings:</p>

	<dl dfn-for="font-variant-position" dfn-type="value">
		<dt><dfn id="font-variant-position-normal-value" title="normal!!font-variant-position">normal</dfn></dt>
		<dd>None of the features listed below are enabled.</dd>
		<dt><dfn>sub</dfn></dt>
		<dd>Enables display of subscript variants
		(OpenType feature: <span class="tag">subs</span>).</dd>
		<dt><dfn>super</dfn></dt>
		<dd>Enables display of superscript variants
		(OpenType feature: <span class="tag">sups</span>).</dd>
	</dl>

	<p>Because of the semantic nature of subscripts and superscripts,
	when the value is either ''sub'' or ''super''
	for a given contiguous run of text,
	if a variant glyph is not available for all the characters in the run,
	simulated glyphs <!-- must --> should be synthesized
	for all characters
	using reduced forms of the glyphs
	that would be used
	without this feature applied.
	This is done per run
	to avoid a mixture of variant glyphs and synthesized ones
	that would not align correctly.
	In the case of OpenType fonts
	that lack subscript or superscript glyphs
	for a given character,
	user agents <em>must</em> synthesize
	appropriate subscript and superscript glyphs.</p>

	<div class="figure">
		<img alt="alternate superscripts vs. glyphs synthesized using superscript metrics" src="images/superscript-alt-synth.png" width="762" height="157">
		<p class="caption">Superscript alternate glyph (left), synthesized superscript glyphs (middle), and incorrect mixture of the two (right)</p>
	</div>

	<!--
		at-risk must downgraded to should
		see https://github.com/w3c/csswg-drafts/issues/2796#issuecomment-398565265
	-->

	<p>In situations where text decorations
	are only applied to runs of text
	containing superscript or subscript glyphs,
	the synthesized glyphs may be used,
	to avoid problems with the placement of decorations.</p>

	<p>In the past,
	user agents have used font-size
	and vertical-align
	to simulate subscripts and superscripts
	for the
	<code title="HTML sub element">sub</code>
	and <code title="HTML sup element">sup</code> elements.
	To allow a backwards compatible way
	of defining subscripts and superscripts,
	it is recommended
	that authors use conditional rules [[CSS3-CONDITIONAL]]
	so that older user agents will still render
	subscripts and superscripts via
	the older mechanism.</p>

	<p>Because <code>font-size: smaller</code>
	is often used for these elements,
	the effective scaling factor
	applied to subscript and superscript text
	varies depending upon the size.
	For larger text,
	the font size is often reduced by a third
	but for smaller text sizes,
	the reduction can be much less.
	This allows subscripts and superscripts
	to remain readable
	even within elements using small text sizes.
	User agents should consider this
	when deciding how to synthesize
	subscript and superscript glyphs.</p>

	<p class="note">The OpenType font format
	defines subscript and superscript metrics
	in the
	<a href="https://docs.microsoft.com/en-us/typography/opentype/spec/os2">OS/2 table</a>
	[[!OPENTYPE]]
	but these are not always accurate in practice
	and so cannot be relied upon
	when synthesizing subscript and superscript glyphs.</p>

	<p>Authors should note
	that fonts typically only provide
	subscript and superscript glyphs
	for a subset of all characters
	supported by the font.
	For example,
	while subscript and superscript glyphs
	are often available for Latin numbers,
	glyphs for punctuation and letter characters
	are less frequently provided.
	The synthetic fallback rules
	defined for this property
	try to ensure that subscripts and superscripts
	will always appear
	but the appearance may not match author expectations
	if the font used does not provide
	the appropriate alternate glyph
	for all characters contained in a
	subscript or superscript.</p>

	<p>This property is not cumulative.
	Applying it to elements
	within a subscript or superscript
	won't nest the placement
	of a subscript or superscript glyph.
	Images contained within text runs
	where the value of this property
	is ''sub'' or ''super'' will be drawn
	just as they would
	if the value was ''font-variant-position/normal!!value''.</p>

	<!-- due to lack of consensus, couldn't resolve on exact positioning of text decorations:
	http://www.w3.org/2013/06/06-css-minutes.html#item03 -->

	<p>Because of these limitations,
	'font-variant-position'
	is not recommended for use in user agent stylesheets.
	Authors should use it
	in cases where subscripts or superscripts
	will only contain the narrow range of characters
	supported by the fonts specified.</p>

	<p class="note">The variant glyphs
	use the same baseline
	as the default glyphs would use.
	There is no shift in the placement along the baseline,
	so the use of variant glyphs doesn't affect
	the height of the inline box
	or alter the height of the linebox.
	This makes superscript and subscript variants
	ideal for situations where it's important
	that leading remain constant,
	such as in multi-column layout.</p>

	<div class="example" id="ex-typical-ua-style">
		<p>A typical user agent default style for the <span class="tag">sub</span> element:</p>

		<pre>sub {
			vertical-align: sub;
			font-size: smaller;
			line-height: normal;
		}
		</pre>

		<p>Using 'font-variant-position'
		to specify typographic subscripts
		in a way that will still show subscripts
		in older user agents:</p>

		<pre>@supports ( font-variant-position: sub ) {
			sub {
				vertical-align: baseline;
				font-size: 100%;
				line-height: inherit;
				font-variant-position: sub;
			}
		}
		</pre>

		<p>User agents that support the 'font-variant-position' property
		will select a subscript variant glyph
		and render this
		without adjusting the baseline or font-size.
		Older user agents will ignore
		the 'font-variant-position' property definition
		and use the standard defaults for subscripts.</p>
	</div>

<!--
 ██████     ███    ████████   ██████
██    ██   ██ ██   ██     ██ ██    ██
██        ██   ██  ██     ██ ██
██       ██     ██ ████████   ██████
██       █████████ ██              ██
██    ██ ██     ██ ██        ██    ██
 ██████  ██     ██ ██         ██████
-->

<h3 id="font-variant-caps-prop">
Capitalization: the 'font-variant-caps' property</h3>

	<pre class="propdef">
	Name: font-variant-caps

	Value:	normal | small-caps | all-small-caps | petite-caps | all-petite-caps | unicase | titling-caps
	Initial: normal
	Applies to: all elements and text
	Inherited: yes
	Percentages: n/a
	Computed value: as specified
	Animation type: discrete
	</pre>

	<wpt>
		font-variant-caps-01.html
		font-variant-caps-02.html
		font-variant-caps-03.html
		font-variant-caps-04.html
		font-variant-caps-05.html
		font-variant-caps-06.html
		font-variant-caps-07.html
		font-variant-caps.html
		font-variant-caps-invalidation-container-sizing.html
		parsing/font-variant-caps-computed.html
		parsing/font-variant-caps-invalid.html
		parsing/font-variant-caps-valid.html
	</wpt>

	<p>This property allows
	the selection of alternate glyphs
	used for small or petite capitals or for titling.
	These glyphs are specifically designed
	to blend well with the surrounding normal glyphs,
	to maintain the weight and readability
	which suffers when text is simply resized
	to fit this purpose.</p>

	<p>Individual values have the following meanings:</p>

	<dl dfn-for="font-variant-caps" dfn-type="value">
		<dt><dfn id="font-variant-caps-normal-value" title="normal!!font-variant-caps">normal</dfn>
		<dd>None of the features listed below are enabled.</dd>

		<dt><dfn>small-caps</dfn>
		<dd>Enables display of small capitals
			(OpenType feature: <span class="tag">smcp</span>).
			Small-caps glyphs typically use the form of uppercase letters
			but are reduced to the size of lowercase letters.

			<div class="featex"><img alt="small-caps example" src="images/smcp.png" width="300" height="65"></div>
		</dd>

		<dt><dfn>all-small-caps</dfn>
		<dd>Enables display of small capitals for both upper and lowercase letters
			(OpenType features: <span class="tag">c2sc, smcp</span>).</dd>

		<dt><dfn>petite-caps</dfn>
		<dd>Enables display of petite capitals
			(OpenType feature: <span class="tag">pcap</span>).</dd>

		<dt><dfn>all-petite-caps</dfn>
		<dd>Enables display of petite capitals for both upper and lowercase letters
			(OpenType features: <span class="tag">c2pc, pcap</span>).</dd>

		<dt><dfn>unicase</dfn>
		<dd>Enables display of mixture of small capitals for uppercase letters
			with normal lowercase letters
			(OpenType feature: <span class="tag">unic</span>).</dd>

		<dt><dfn>titling-caps</dfn>
		<dd>Enables display of titling capitals
			(OpenType feature: <span class="tag">titl</span>).
			Uppercase letter glyphs are often designed for use with lowercase letters.
			When used in all uppercase titling sequences
			they can appear too strong.
			Titling capitals are designed specifically for this situation.</dd>
	</dl>

	<p>The availability of these glyphs
	is based on whether a given feature is defined or not
	in the feature list of the font.
	User agents can optionally decide this
	on a per-script basis
	but should explicitly not decide this
	on a per-character basis.</p>

	<p>Some fonts may only support a subset
	or none
	of the features
	described for this property.
	For backwards compatibility with CSS 2.1,
	if ''small-caps'' or ''all-small-caps'' is specified
	but small-caps glyphs are not available for a given font,
	user agents should simulate a small-caps font,
	for example by taking a normal font
	and replacing the glyphs for lowercase letters
	with scaled versions of the glyphs
	for uppercase characters
	(replacing the glyphs for both upper and lowercase letters
	in the case of ''all-small-caps'').</p>

	<div class="figure" style="padding: 0; margin: auto;">
		<img class="hires" alt="synthetic vs. real small-caps" src="images/synthetic-vs-real-small-caps.png" width="512" height="116">
		<p class="caption">Synthetic vs. real small-caps</p>
	</div>

	<p>The 'font-feature-settings' property
	also affects the decision of
	whether or not to use a simulated small-caps font
	(unlike CSS Fonts 3).<p>

	<div class="example" id="ex-small-caps">
		<pre>#example1 { font-variant-caps: small-caps; }
			#example2 { font-variant-caps: small-caps; font-feature-settings: 'smcp' 0; }</pre>

		For fonts which don't support small caps, both #example1 and #example2
		should be rendered with synthesized small caps. However, for fonts which
		do support small caps, #example1 should be rendered with native small
		caps, while #example2 should be rendered without any small-caps (native
		or synthesized).
	</div>

	<p>To match the surrounding text,
	a font may provide alternate glyphs
	for caseless characters
	when these features are enabled
	but when a user agent simulates small capitals,
	it must not attempt to simulate alternates
	for codepoints which are considered caseless.</p>

	<div class="figure" style="padding: 0; margin: auto;">
		<img class="hires" alt="caseless characters with small-caps, all-small-caps enabled" src="images/small-capitals-variations.png" width="418" height="317">
		<p class="caption">Caseless characters with small-caps, all-small-caps enabled</p>
	</div>

	<p>If either ''petite-caps'' or ''all-petite-caps''' is specified
	for a font that doesn't support these features,
	the property behaves as if
	''small-caps'' or ''all-small-caps'', respectively,
	had been specified.
	If ''unicase'' is specified
	for a font that doesn't support that feature,
	the property behaves as if ''small-caps'' was applied
	only to lowercased uppercase letters.
	If ''titling-caps'' is specified
	with a font that does not support this feature,
	this property has no visible effect.
	When simulated small capital glyphs are used,
	for scripts that lack uppercase and lowercase letters,
	''small-caps'', ''all-small-caps'', ''petite-caps'',
	''all-petite-caps'' and ''unicase''
	have no visible effect.</p>

	<p>When casing transforms are used
	to simulate small capitals,
	the casing transformations must match
	those used for the <span class="property">'text-transform'</span> property.</p>

	<p>As a last resort,
	unscaled uppercase letter glyphs
	in a normal font
	may replace glyphs in a small-caps font
	so that the text appears
	in all uppercase letters.</p>

	<div class="figure" style="padding: 0; margin: auto;">
		<img class="hires" alt="using all-small-caps in acronym-laden text" src="images/acronym-laden-text.png" width="596" height="325">
		<p class="caption">Using small capitals to improve readability in acronym-laden text</p>
	</div>

	<div class="example" id="ex-quote-italic-small-caps">
		<p>Quotes rendered italicized, with small-caps on the first line:</p>

		<pre>blockquote            { font-style: italic; }
		blockquote:first-line { font-variant: small-caps; }

		&lt;blockquote><a href="https://lists.w3.org/Archives/Public/www-style/2009Dec/0036.html" style="text-decoration: none; border: none;">I'll be honor-bound to slap them like a haddock.</a>&lt;/blockquote>
		</pre>
	</div>

<!--
██    ██ ██     ██ ██     ██ ████████ ████████  ████  ██████
███   ██ ██     ██ ███   ███ ██       ██     ██  ██  ██    ██
████  ██ ██     ██ ████ ████ ██       ██     ██  ██  ██
██ ██ ██ ██     ██ ██ ███ ██ ██████   ████████   ██  ██
██  ████ ██     ██ ██     ██ ██       ██   ██    ██  ██
██   ███ ██     ██ ██     ██ ██       ██    ██   ██  ██    ██
██    ██  ███████  ██     ██ ████████ ██     ██ ████  ██████
-->

<h3 id="font-variant-numeric-prop">
Numerical formatting: the 'font-variant-numeric' property</h3>

	<pre class="propdef">
	Name: font-variant-numeric
	Value:	normal | [ <<numeric-figure-values>> || <<numeric-spacing-values>> || <<numeric-fraction-values>> || ordinal || slashed-zero ]
	Initial: normal
	Applies to: all elements and text
	Inherited: yes
	Percentages: n/a
	Computed value: as specified
	Animation type: discrete
	</pre>

	<wpt>
		font-variant-numeric-01.html
		font-variant-numeric-02.html
		font-variant-numeric-03.html
		font-variant-numeric-04.html
		font-variant-numeric-05.html
		font-variant-numeric-06.html
		font-variant-numeric-07.html
		font-variant-numeric-08.html
		font-variant-numeric-09.html
		font-variant-numeric.html
		parsing/font-variant-numeric-computed.html
		parsing/font-variant-numeric-invalid.html
		parsing/font-variant-numeric-valid.html
	</wpt>

	<p>Specifies control over numerical forms. The example below shows how
	some of these values can be combined to influence the rendering of
	tabular data with fonts that support these features. Within normal
	paragraph text, proportional numbers are used while tabular numbers
	are used so that columns of numbers line up properly:</p>

	<div class="figure" style="padding: 0; margin: auto;">
		<img alt="combining number styles" src="images/numberstyles.png" width="453" height="374">
		<p class="caption">Using number styles</p>
	</div>

	<p>Possible combinations:</p>

	<pre class="prod"><dfn id="numeric-figure-values">&lt;numeric-figure-values&gt;</dfn>   = [ lining-nums | oldstyle-nums ]</pre>

	<pre class="prod"><dfn id="numeric-spacing-values">&lt;numeric-spacing-values&gt;</dfn>  = [ proportional-nums | tabular-nums ]</pre>

	<pre class="prod"><dfn id="numeric-fraction-values">&lt;numeric-fraction-values&gt;</dfn> = [ diagonal-fractions | stacked-fractions ]</pre>

	<p>Individual values have the following meanings:</p>

	<dl dfn-for="font-variant-numeric" dfn-type="value">
		<dt><dfn id="font-variant-numeric-normal-value" title="normal!!font-variant-numeric">normal</dfn>
		<dd>None of the features listed below are enabled.</dd>

		<dt><dfn>lining-nums</dfn>
		<dd>Enables display of lining numerals
			(OpenType feature: <span class="tag">lnum</span>).</dd>

		<dt><dfn>oldstyle-nums</dfn>
		<dd>Enables display of old-style numerals
			(OpenType feature: <span class="tag">onum</span>).</dd>

		<dt><dfn>proportional-nums</dfn>
		<dd>Enables display of proportional numerals
			(OpenType feature: <span class="tag">pnum</span>).</dd>

		<dt><dfn>tabular-nums</dfn>
		<dd>Enables display of tabular numerals
			(OpenType feature: <span class="tag">tnum</span>).</dd>

		<dt><dfn>diagonal-fractions</dfn>
		<dd>Enables display of lining diagonal fractions
			(OpenType feature: <span class="tag">frac</span>).

			<div class="featex">
				<img alt="diagonal fraction example" src="images/frac.png" width="350" height="60">
			</div>
		</dd>

		<dt><dfn>stacked-fractions</dfn>
		<dd>Enables display of lining stacked fractions
			(OpenType feature: <span class="tag">afrc</span>).

			<div class="featex">
				<img alt="stacked fraction example" src="images/afrc.png" width="350" height="63">
			</div>
		</dd>

		<dt><dfn>ordinal</dfn>
		<dd>Enables display of letter forms used with ordinal numbers
			(OpenType feature: <span class="tag">ordn</span>).

			<div class="featex">
				<img alt="ordinals example" src="images/ordinals.png" width="635" height="71">
			</div>
		</dd>

		<dt><dfn>slashed-zero</dfn>
		<dd>Enables display of slashed zeros
			(OpenType feature: <span class="tag">zero</span>).

			<div class="featex">
				<img alt="slashed zero example" src="images/zero.png" width="300" height="58">
			</div>
		</dd>
	</dl>

	<div class="example" id="ex-ordinal-form">
		<p>In the case of ''ordinal'', although ordinal forms
		are often the same as superscript forms, they are marked up
		differently.</p>
		<p>For superscripts, the variant property is only applied
		to the sub-element containing the superscript:</p>

		<pre>
		sup { font-variant-position: super; }
		x&lt;sup&gt;2&lt;/sup&gt;
		</pre>

		<p>For ordinals, the variant property is applied
		to the entire ordinal number rather than
		just to the suffix (or to the containing paragraph):</p>

		<pre>
		.ordinal { font-variant-numeric: ordinal; }
		&lt;span class="ordinal"&gt;17th&lt;/span&gt;
		</pre>

		<p>In this case only the "th" will appear in ordinal form,
		the digits will remain unchanged.
		Depending upon the typographic traditions used in a given language,
		ordinal forms may differ from superscript forms.
		In Italian, for example,
		ordinal forms sometimes include an underline in the ordinal design.</p>
	</div>

	<div class="example" id="ex-steak-marinade">
		<p>A simple flank steak marinade recipe,
		rendered with automatic fractions and old-style numerals:</p>

		<pre>.amount { font-variant-numeric: oldstyle-nums diagonal-fractions; }

		&lt;h4>Steak marinade:&lt;/h4>
		&lt;ul>
			&lt;li>&lt;span class="amount">2&lt;/span> tbsp olive oil&lt;/li>
			&lt;li>&lt;span class="amount">1&lt;/span> tbsp lemon juice&lt;/li>
			&lt;li>&lt;span class="amount">1&lt;/span> tbsp soy sauce&lt;/li>
			&lt;li>&lt;span class="amount">1 1/2&lt;/span> tbsp dry minced onion&lt;/li>
			&lt;li>&lt;span class="amount">2 1/2&lt;/span> tsp italian seasoning&lt;/li>
			&lt;li>Salt &amp;amp; pepper&lt;/li>
		&lt;/ul>

		&lt;p>Mix the meat with the marinade
		and let it sit covered in the refrigerator
		for a few hours or overnight.&lt;/p>
		</pre>

		<p>Note that the fraction feature
		is only applied to values
		not the entire paragraph.
		Fonts often implement this feature using contextual rules
		based on the use of the slash ('/') character.
		As such, it's not suitable for use as a paragraph-level style.</p>
	</div>

<!--
 ██████  ██      ██    ███     ██████  ██     ██
██    ██ ██  ██  ██   ██ ██   ██    ██ ██     ██
██       ██  ██  ██  ██   ██  ██       ██     ██
 ██████  ██  ██  ██ ██     ██  ██████  █████████
      ██ ██  ██  ██ █████████       ██ ██     ██
██    ██ ██  ██  ██ ██     ██ ██    ██ ██     ██
 ██████   ███  ███  ██     ██  ██████  ██     ██
-->

<h3 id="font-variant-alternates-prop">
Alternates and swashes: the 'font-variant-alternates' property</h3>

	<pre class="propdef">
	Name: font-variant-alternates
	Value: normal | [ stylistic(<<font-feature-value-name>>) ||
		historical-forms ||
		styleset(<<font-feature-value-name>>#) ||
		character-variant(<<font-feature-value-name>>#) ||
		swash(<<font-feature-value-name>>) ||
		ornaments(<<font-feature-value-name>>) ||
		annotation(<<font-feature-value-name>>) ]
	Initial: normal
	Applies to: all elements and text
	Inherited: yes
	Percentages: n/a
	Computed value: as specified
	Animation type: discrete
	</pre>

	<wpt>
		alternates-order.html
		font-variant-alternates-01.html
		font-variant-alternates-02.html
		font-variant-alternates-03.html
		font-variant-alternates-04.html
		font-variant-alternates-05.html
		font-variant-alternates-06.html
		font-variant-alternates-07.html
		font-variant-alternates-08.html
		font-variant-alternates-09.html
		font-variant-alternates-10.html
		font-variant-alternates-11.html
		font-variant-alternates-12.html
		font-variant-alternates-13.html
		font-variant-alternates-14.html
		font-variant-alternates-15.html
		font-variant-alternates-16.html
		font-variant-alternates-17.html
		font-variant-alternates-18.html
		font-variant-alternates-19.html
		font-variant-alternates-layers.html
		font-variant-alternates-parsing.html
		parsing/font-variant-alternates-invalid.html
		parsing/font-variant-alternates-valid.html
	</wpt>

	<pre class="prod"><dfn id="font-feature-index-value">&lt;font-feature-index&gt;</dfn> = <<integer>></pre>
	<pre class="prod"><dfn id="font-feature-value-name-value">&lt;font-feature-value-name&gt;</dfn> = <<ident>></pre>

	For any given character, fonts can provide a variety of alternate
	glyphs in addition to the default glyph for that character. This
	property provides control over the selection of these alternate
	glyphs.

	For many of the property values listed below, several different
	alternate glyphs are available. How many alternates are available
	and what they represent is font-specific, so these are each marked
	<dfn>font specific</dfn> in the value definitions below.  Because the nature
	of these alternates is font-specific, the
	''@font-feature-values'' rule is used to define values for a
	specific font family or set of families that associate a font-specific
	numeric <<font-feature-index>> with a custom
	<<font-feature-value-name>>, which is then used in this
	property to select specific alternates:

	<pre class=example  id="ex-noble-script">
	@font-feature-values Noble Script { @swash { swishy: 1; flowing: 2; } }

	p {
		font-family: Noble Script;
		font-variant-alternates: swash(flowing); /* use swash alternate #2 */
	}
	</pre>

	When a particular <<font-feature-value-name>> has not
	been defined for a given family or for a particular feature type, the
	computed value must be the same as if it had been defined.  However,
	property values that contain these undefined <<font-feature-value-name>>
	identifiers must be ignored when choosing glyphs.

	<pre class=example  id="ex-effectively-same">
	/* these two style rules are effectively the same */

	p { font-variant-alternates: swash(unknown-value); } /* not a defined value, ignored */
	p { font-variant-alternates: normal; }
	</pre>

	This allows values to be defined and used for a given set of font
	families but ignored if fallback occurs, since the font family name
	would be different. If a given value is outside the range supported by
	a given font, the value is ignored.  These values never apply to
	generic font families.

	Individual values have the following meanings:

	<dl dfn-for="font-variant-alternates" dfn-type="value">
		<dt><dfn id="font-variant-alternates-normal-value" title="normal!!font-variant-alternates">normal</dfn>
		<dd>None of the features listed below are enabled.</dd>

		<dt><dfn>historical-forms</dfn>
		<dd>Enables display of historical forms (OpenType feature: <span class="tag">hist</span>).

			<div class="featex">
				<img alt="historical form example" src="images/hist.png" width="380" height="65">
			</div>
		</dd>

		<dt><dfn id="stylistic" title="stylistic">stylistic(<<font-feature-value-name>>)</dfn>
		<dd>Enables display of stylistic alternates ([=font specific=], OpenType feature: <span class="tag">salt <<font-feature-index>></span>).

			<div class="featex">
				<img alt="stylistic alternate example" src="images/salt.png" width="300" height="58">
			</div>
		</dd>

		<dt><dfn id="styleset" title="styleset">styleset(<<font-feature-value-name>>#)</dfn>
		<dd>Enables display with stylistic sets ([=font specific=], OpenType feature: <span class="tag">ss<<font-feature-index>></span>
			OpenType currently defines <span class="tag">ss01</span> through <span class="tag">ss20</span>).

			<div class="featex">
				<img alt="styleset example" src="images/ssnn.png" width="700" height="76">
			</div>
		</dd>

		<dt><dfn id="character-variant" title="character-variant">character-variant(<<font-feature-value-name>>#)</dfn>
		<dd>Enables display of specific character variants ([=font specific=], OpenType feature: <span class="tag">cv<<font-feature-index>></span>
			OpenType currently defines <span class="tag">cv01</span> through <span class="tag">cv99</span>).</dd>

		<dt><dfn id="swash" title="swash">swash(<<font-feature-value-name>>)</dfn>
		<dd>Enables display of swash glyphs ([=font specific=], OpenType feature: <span class="tag">swsh <<font-feature-index>>, cswh <<font-feature-index>></span>).

			<div class="featex">
				<img alt="swash example" src="images/swsh.png" width="380" height="64">
			</div>
		</dd>

		<dt><dfn id="ornaments" title="ornaments">ornaments(<<font-feature-value-name>>)</dfn>
		<dd>Enables replacement of default glyphs with ornaments, if provided in the font ([=font specific=], OpenType feature: <span class="tag">ornm <<font-feature-index>></span>).
			Some fonts may offer ornament glyphs as alternates for a wide collection of characters; however, displaying arbitrary
			characters (e.g., alphanumerics) as ornaments is poor practice as it distorts the semantics of the data. Font designers
			are encouraged to encode all ornaments (except those explicitly encoded in the Unicode Dingbats blocks, etc.) as
			alternates for the bullet character (U+2022) to allow authors to select the desired glyph using ''ornaments()''.

			<div class="featex">
				<img alt="ornaments example" src="images/ornm.png" width="350" height="45">
			</div>
		</dd>

		<dt><dfn id="annotation" title="annotation">annotation(<<font-feature-value-name>>)</dfn>
		<dd>Enables display of alternate annotation forms ([=font specific=], OpenType feature: <span class="tag">nalt <<font-feature-index>></span>).

			<div class="featex">
				<img alt="alternate annotation form example" src="images/nalt.png" width="350" height="62">
			</div>
		</dd>
	</dl>

<!--
████████ ████████ ██     ██
██       ██       ██     ██
██       ██       ██     ██
██████   ██████   ██     ██
██       ██        ██   ██
██       ██         ██ ██
██       ██          ███
-->

<h3 id="font-feature-values">
Defining font specific alternates: the <dfn>@font-feature-values</dfn> rule</h3>

	Several of the possible values of 'font-variant-alternates' listed above
	are labeled as [=font specific=];
	a font can define not just a single glyph for the feature,
	but <em>multiple</em> possible glyph variants,
	and associate each one with a numeric index
	to let you choose which to turn on.

	These numeric indexes are idiosyncratic to each face;
	a <code>swsh 1</code> feature on one font face might turn on the swash version of capital Q,
	while on another font face it turns on the swash version of the &amp;.
	Thus, specifying the index in 'font-feature-settings'
	requires that the author know <em>exactly</em> which font will be used on an element;
	if they get it wrong (due to font fallback selecting a different font)
	they might end up turning on an entirely different,
	and undesirable,
	feature to what they wanted!
	It also means that the author can't easily turn on similar features for elements with different fonts;
	they have to individually set different 'font-feature-settings' values for each
	that uses the correct numeric indexes for the desired features.

	To fix this issue,
	the ''@font-feature-values'' rule lets an author assign,
	for each font face,
	a human-friendly name to specific feature indexes.
	Using these friendly names,
	an author can easily turn on similar features regardless of the font in use
	(if they've defined that name for all the fonts),
	and be sure they're not accidentally turning on unrelated features
	(as fonts without those names defined for them simply won't do anything).

	<div class="example" id="ex-font-feature-values">
		<p>Using a commonly named value allows authors to use a single style rule
		to cover a set of fonts for which the underlying selector is different for
		each font. If either font in the example below is found, a circled number
		glyph will be used:
		</p>

		<pre>
		@font-feature-values Otaru Kisa {
			@annotation { circled: 1; black-boxed: 3; }
		}
		@font-feature-values Taisho Gothic {
			@annotation { boxed: 1; circled: 4; }
		}

		h3.title {
			/* circled form defined for both fonts */
			font-family: Otaru Kisa, Taisho Gothic;
			font-variant: annotation(circled);
		}
		</pre>

		Trying to turn on the "circled" forms for either font explicitly,
		using ''@font-feature-values'',
		would require the author know <em>for certain</em> which font will be used;
		if they expected "Otaru Kisa" and wrote <css>font-feature-settings: "nalt" 1;</css>,
		it would turn on "circled" characters in Otara Kisa,
		but would instead turn on <strong>boxed</strong> characters
		if the system fell back to Taisho Gothic,
		as that's what Taisho Gothic associates with <code>nalt 1</code>!
	</div>


<h4 id="font-feature-values-syntax">Basic syntax</h4>

	An ''@font-feature-values'' rule's prelude
	contains a list of font family names,
	followed by a block containing multiple <dfn export lt="font feature value block | feature value block">feature value blocks</dfn>,
	a special type of subsidiary at-rule.
	Each [=feature value block=] contains declarations
	mapping author-chosen human-friendly names
	(such as "flowing")
	to feature indexes for the associated feature.

	Each [=font feature value block|font feature value=] has the same meaning
	as the corresponding value of the 'font-variant-alternates' property.

	<pre class=prod export>
		@font-feature-values = @font-feature-values <<font-family-name>># { <<declaration-rule-list>> }

		<dfn for="@font-feature-values">&lt;font-feature-value-type></dfn> = <<@stylistic>> | <<@historical-forms>> | <<@styleset>> | <<@character-variant>>
			| <<@swash>> | <<@ornaments>> | <<@annotation>>

		<dfn for="@font-feature-values">@stylistic</dfn> = @stylistic { <<declaration-list>> }
		<dfn for="@font-feature-values">@historical-forms</dfn> = @historical-forms { <<declaration-list>> }
		<dfn for="@font-feature-values">@styleset</dfn> = @styleset { <<declaration-list>> }
		<dfn for="@font-feature-values">@character-variant</dfn> = @character-variant { <<declaration-list>> }
		<dfn for="@font-feature-values">@swash</dfn> = @swash { <<declaration-list>> }
		<dfn for="@font-feature-values">@ornaments</dfn> = @ornaments { <<declaration-list>> }
		<dfn for="@font-feature-values">@annotation</dfn> = @annotation { <<declaration-list>> }
	</pre>

	<wpt>
		alternates-order.html
		test_font_feature_values_parsing.html
	</wpt>

	The ''@font-feature-values'' prelude
	is a comma-delimited list of font family names that match the definition of <<font-family-name>>
	for the 'font-family!!property' property.
	This means that only named font families are allowed;
	rules that include generic or system fonts in the list of font families are syntax errors.
	However, if a user agent defines a generic font to be a specific named font (e.g. Helvetica),
	the settings associated with that family name will be used.
	If syntax errors occur within the <<font-family-name>> list,
	the entire rule ''@font-feature-values'' rule is invalid
	and must be ignored.

	The ''@font-feature-values'' block accepts <<declaration-rule-list>> as its contents;
	these list items are either:

	- [=at-rules=] named by one of the <<@font-feature-values/font-feature-value-type>> at-keyword tokens

	or

	- the '@font-feature-values/font-display!!descriptor' descriptor.

	<!-- TODO: tab says "The OM needs to make sure it exposes both .style and .childRules or whatever." -->

	Specifying the same <<@font-feature-values/font-feature-value-type>> more than once is valid;
	their contents are cascaded together.
	Each [=feature value block=] accepts a list of [=declarations=],
	the <dfn lt="font feature value declaration">font feature value declarations</dfn>,
	where the declaration's name can be any [=css identifier=],
	and the value must be a list of one or more non-negative <<integer>>s.

	The [=feature value blocks=] accept any declaration name;
	these names must be <<font-feature-value-name>>,
	per standard CSS syntax rules,
	and are [=case-sensitive=]
	(so <css>foo: 1;</css> and <css>FOO: 2</css> define two different features).

	Each declaration's value in ''@annotation'', ''@ornaments'', ''@stylistic'', ''@swash'',
	must match the grammar <<font-feature-index>>,
	or else the declaration is invalid and must be ignored.

	Each declaration’s value in ''@character-variant''
	must match the grammar <<font-feature-index [0,99]>> <<font-feature-index [0,∞]>>,
	or else the declaration is invalid and must be ignored.

	Each declaration’s value in ''@styleset''
	must match the grammar <<font-feature-index [0,20]>>+,
	or else the declaration is invalid and must be ignored.

	Note: Each feature name is unique only within a single [=feature value block=].
	Between different [=feature value blocks=],
	or the same type of [=feature value blocks=] in separate ''@font-feature-values'' rules,
	names can be reused without colliding.

	For each <<font-family-name>> in the ''@font-feature-values'' prelude,
	each [=font feature value declaration=] defines a mapping between a
	(family name, feature block name, declaration name) [=tuple=]
	and the list of one or more integers from the declaration's value.
	If the same tuple appears more than once in a document
	(such as if a single block),
	the last-defined one is used.

	<div class=example id="ex-same-font-feature-values">
		For example, the following all define the exact same set of font feature values:

		<pre>
		/* Default */
		@font-feature-values foo {
			@swash { pretty: 1; cool: 2; }
		}

		/* Repeated declaration names */
		@font-feature-values foo {
			@swash { pretty: 0; pretty: 1; cool: 2; }
		}

		/* Multiple blocks of the same type */
		@font-feature-values foo {
			@swash { pretty: 1; }
			@swash { cool: 2; }
		}

		/* Multiple rules for the same family */
		@font-feature-values foo {
			@swash { pretty: 1; }
		}
		@font-feature-values foo {
			@swash { cool: 2; }
		}
		</pre>
	</div>

	A syntax error within a [=font feature value declaration=]
	makes the declaration invalid and ignored,
	but does not invalidate the [=font feature value block=] it occurs in.
	An unknown at-rule within a ''@font-feature-values'' block
	(not using one of the predefined list of allowed at-keywords)
	makes that at-rule invalid and ignored,
	but does not invalidate the ''@font-feature-values'' rule.

	<div class="example" id="ex-invalid-ignored">
		Rules that are equivalent given syntax error handling:

		<pre>
		@font-feature-values Bongo {
			@swash { ornate: 1; }
			annotation { boxed: 4; } /* should be @annotation! */
			@swash { double-loops: 1; flowing: -1; } /* negative value */
			@ornaments ; /* incomplete definition */
			@styleset { double-W: 14; sharp-terminals: 16 1 } /* missing ; */
			redrum  /* random editing mistake */
		}
		</pre>

		The example above is equivalent to:

		<pre>
		@font-feature-values Bongo {
			@swash { ornate: 1; }
			@swash { double-loops: 1; }
			@styleset { double-W: 14; sharp-terminals: 16 1; }
		}
		</pre>
	</div>

	If multiple ''@font-feature-values'' rules are defined for
	a given family, the resulting values definitions are the union of the
	definitions contained within these rules. This allows a set of named
	values to be defined for a given font family globally for a site and
	specific additions made per-page.

	<div class="example" id="ex-site-wide-per-page">
		Using both site-wide and per-page feature values:

		site.css:

		<pre>
		@font-feature-values Mercury Serif {
			@styleset {
				stacked-g: 3; /* "two-storey" versions of g, a */
				stacked-a: 4;
			}
		}
		</pre>

		page.css:

		<pre>
		@font-feature-values Mercury Serif {
			@styleset {
			geometric-m: 7; /* alternate version of m */
			}
		}

		body {
			font-family: Mercury Serif, serif;

			/* enable both the use of stacked g and alternate m */
			font-variant-alternates: styleset(stacked-g, geometric-m);
		}
		</pre>
	</div>

<h4 id="multi-value-features">
Multi-valued feature value definitions</h4>

	Most [=font specific=] functional values of the 'font-variant-alternates' property
	take a single value (e.g. ''swash()'') which enables the feature.

	<pre class="example" id="ex-single-valued-feature" >@font-feature-values Jupiter Serif {
		@swash {
			swishy: 5;     /* implies ss05 = 1 */
			swirly: 2;     /* implies ss02 = 1 */
		}
	}
	</pre>

	The ''character-variant()'' property value and the ''@character-variant'' descriptor allow two values,
	which enables a feature (from the first value) and sets it to a given (second) value.

	<pre class="example" id="ex-two-valued-feature" >@font-feature-values MM Greek {
			@character-variant { alpha-2: 1 2; }   /* implies cv01 = 2 */
			@character-variant { beta-3: 2 3; }    /* implies cv02 = 3 */
		}
	</pre>

	For the ''styleset()'' property value and ''@styleset'' rule,
	multiple values indicate the style
	sets to be enabled.  Values between 1 and 99 enable OpenType features
	<span class="tag">ss01</span> through <span class="tag">ss99</span>.
	However, the OpenType standard only officially defines
	<span class="tag">ss01</span> through <span class="tag">ss20</span>.
	For OpenType fonts, values greater than 99 or equal to 0 do not
	generate a syntax error when parsed but enable no OpenType features.

	<pre class="example" id="ex-multi-valued-feature" >@font-feature-values Mars Serif {
		@styleset {
			alt-g: 1;        /* implies ss01 = 1 */
			curly-quotes: 3; /* implies ss03 = 1 */
			code: 4 5;       /* implies ss04 = 1, ss05 = 1 */
		}

		@styleset {
			dumb: 125;        /* &gt;99, ignored */
		}

		@swash {
			swishy: 3 5;     /* more than 1 value for swash, syntax error */
		}
	}

	p.codeblock {
		/* implies ss03 = 1, ss04 = 1, ss05 = 1 */
		font-variant-alternates: styleset(curly-quotes, code);
	}
	</pre>

	For <<@character-variant>>, a single value between 1 and 99 indicates
	the enabling of OpenType feature <span class="tag">cv01</span> through
	<span class="tag">cv99</span>. For OpenType fonts, values greater than
	99 or equal to 0 are ignored but do not generate a syntax error when parsed
	but enable no OpenType features. When two values are listed, the first
	value indicates the feature used and the second the value passed for
	that feature.  If more than two values are assigned to a given name, a
	syntax error occurs and the entire
	feature value definition is
	ignored.

	<pre class="example" id="ex-greek-variant-features" >@font-feature-values MM Greek {
		@character-variant { alpha-2: 1 2; }   /* implies cv01 = 2 */
		@character-variant { beta-3: 2 3; }    /* implies cv02 = 3 */
		@character-variant { epsilon: 5 3 6; } /* more than 2 values, syntax error, definition ignored */
		@character-variant { gamma: 12; }      /* implies cv12 = 1 */
		@character-variant { zeta:   20 3; }   /* implies cv20 = 3 */
		@character-variant { zeta-2: 20 2; }   /* implies cv20 = 2 */
		@character-variant { silly: 105; }     /* &gt;99, ignored */
		@character-variant { dumb: 323 3; }    /* &gt;99, ignored */
	}

	#title {
		/* use the third alternate beta, first alternate gamma */
		font-variant-alternates: character-variant(beta-3, gamma);
	}

	p {
		/* zeta-2 follows zeta, implies cv20 = 2  */
		font-variant-alternates: character-variant(zeta, zeta-2);
	}

	.special {
		/* zeta follows zeta-2, implies cv20 = 3  */
		font-variant-alternates: character-variant(zeta-2, zeta);
	}
	</pre>

	<div class="figure">
		<img alt="Matching text on Byzantine seals using character variants" src="images/byzantineseal.png" width="543" height="522">
		<p class="caption">Byzantine seal text displayed with character variants</p>
	</div>

	<div class="example" id="ex-byzantine-variants">
		<p>In the figure above, the text in red is rendered using a font containing
		character variants that mimic the character forms found on a Byzantine seal
		from the 8th century A.D.  Two lines below is the same text displayed in
		a font without variants.  Note the two variants for U and N used on the
		seal.</p>

		<pre>@font-feature-values Athena Ruby {
			@character-variant {
				leo-B: 2 1;
				leo-M: 13 3;
				leo-alt-N: 14 1;
				leo-N: 14 2;
				leo-T: 20 1;
				leo-U: 21 2;
				leo-alt-U: 21 4;
			}
		}

		p {
			font-variant: discretionary-ligatures
			character-variant(leo-B, leo-M, leo-N, leo-T, leo-U);
		}

		span.alt-N {
			font-variant-alternates: character-variant(leo-alt-N);
		}

		span.alt-U {
			font-variant-alternates: character-variant(leo-alt-U);
		}

		&lt;p>ENO....UP͞RSTU&lt;span class="alt-U">U&lt;/span>͞&lt;span class="alt-U">U&lt;/span>ΚΑΙTỤẠG̣IUPNS&lt;/p>

		&lt;p>LEON|ΚΑΙCONSTA|NTI&lt;span class="alt-N">N&lt;/span>OS..|STOIBAṢ.|LIṢROM|AIO&lt;span class="alt-N">N&lt;/span>&lt;/p>
		</pre>
	</div>

<!--
████████    ███     ██████  ████████          ███     ██████  ████    ███    ██    ██
██         ██ ██   ██    ██    ██            ██ ██   ██    ██  ██    ██ ██   ███   ██
██        ██   ██  ██          ██           ██   ██  ██        ██   ██   ██  ████  ██
██████   ██     ██  ██████     ██          ██     ██  ██████   ██  ██     ██ ██ ██ ██
██       █████████       ██    ██          █████████       ██  ██  █████████ ██  ████
██       ██     ██ ██    ██    ██          ██     ██ ██    ██  ██  ██     ██ ██   ███
████████ ██     ██  ██████     ██          ██     ██  ██████  ████ ██     ██ ██    ██
-->

<h3 id="font-variant-east-asian-prop">
East Asian text rendering: the 'font-variant-east-asian' property</h3>

	<pre class="propdef">
	Name: font-variant-east-asian
	Value:	normal | [ <<east-asian-variant-values>> || <<east-asian-width-values>> || ruby ]
	Initial: normal
	Applies to: all elements and text
	Inherited: yes
	Percentages: n/a
	Computed value: as specified
	Animation type: discrete
	</pre>

	<wpt>
		font-variant-east-asian-01.html
		font-variant-east-asian-02.html
		font-variant-east-asian-03.html
		font-variant-east-asian-04.html
		font-variant-east-asian-05.html
		font-variant-east-asian-06.html
		font-variant-east-asian-07.html
		font-variant-east-asian-08.html
		font-variant-east-asian-09.html
		font-variant-east-asian-10.html
		font-variant-east-asian.html
		parsing/font-variant-east-asian-computed.html
		parsing/font-variant-east-asian-invalid.html
		parsing/font-variant-east-asian-valid.html
	</wpt>

	<p>Allows control of glyph substitution and sizing in East Asian text.</p>

	<pre class="prod"><dfn id="east-asian-variant-values">&lt;east-asian-variant-values&gt;</dfn> = [ jis78 | jis83 | jis90 | jis04 | simplified | traditional ]</pre>

	<pre class="prod"><dfn id="east-asian-width-values">&lt;east-asian-width-values&gt;</dfn>   = [ full-width | proportional-width ]</pre>

	<p>Individual values have the following meanings:</p>

	<dl dfn-for="font-variant-east-asian" dfn-type="value">
		<dt><dfn id="font-variant-east-asian-normal-value" title="normal!!font-variant-east-asian">normal</dfn>
		<dd>None of the features listed below are enabled.</dd>

		<dt><dfn>jis78</dfn>
		<dd>Enables rendering of JIS78 forms
			(OpenType feature: <span class="tag">jp78</span>).

			<div class="featex">
				<img alt="JIS78 form example" src="images/jp78.png" width="350" height="78">
			</div>
		</dd>

		<dt><dfn>jis83</dfn>
		<dd>Enables rendering of JIS83 forms
			(OpenType feature: <span class="tag">jp83</span>).</dd>

		<dt><dfn>jis90</dfn>
		<dd>Enables rendering of JIS90 forms
			(OpenType feature: <span class="tag">jp90</span>).</dd>

		<dt><dfn>jis04</dfn>
		<dd>Enables rendering of JIS2004 forms
			(OpenType feature: <span class="tag">jp04</span>).

			<p>The various JIS variants reflect
			the glyph forms defined in different Japanese national standards.
			Fonts generally include glyphs
			defined by the most recent national standard,
			but it's sometimes necessary
			to use older variants,
			to match signage for example.</p>
		</dd>

		<dt><dfn>simplified</dfn>
		<dd>Enables rendering of simplified forms
			(OpenType feature: <span class="tag">smpl</span>).

		<dt><dfn>traditional</dfn>
		<dd>Enables rendering of traditional forms
			(OpenType feature: <span class="tag">trad</span>).

			<p>The ''simplified'' and ''traditional'' values
			allow control over the glyph forms
			for characters which have been simplified over time
			but for which the older, traditional form
			is still used in some contexts.
			The exact set of characters and glyph forms
			will vary to some degree
			by the context for which a given font was designed.</p>

			<div class="featex">
				<img alt="traditional form example" src="images/trad.png" width="350" height="74">
			</div>
		</dd>

		<dt><dfn>full-width</dfn>
		<dd>Enables rendering of full-width variants
			(OpenType feature: <span class="tag">fwid</span>).</dd>

		<dt><dfn>proportional-width</dfn>
		<dd>Enables rendering of proportionally-spaced variants
			(OpenType feature: <span class="tag">pwid</span>).

			<div class="featex">
				<img alt="proportionally spaced Japanese example" src="images/pwid.png" width="700" height="64">
			</div>
		</dd>

		<dt><dfn>ruby</dfn>
		<dd>Enables display of ruby variant glyphs
			(OpenType feature: <span class="tag">&#x0072;uby</span>).
			Since ruby text is generally smaller
			than the associated body text,
			font designers can design special glyphs for use with ruby
			that are more readable than scaled down versions
			of the default glyphs.
			Only glyph selection is affected,
			there is no associated font scaling
			or other change that affects line layout.

			The red ruby text below
			is shown with default glyphs (top)
			and with ruby variant glyphs (bottom).
			Note the slight difference
			in stroke thickness.

			<div class="featex">
				<img alt="ruby variant example" src="images/rubyshinkansen.png" width="226" height="272">
			</div>
		</dd>
	</dl>

<!--
████████  ███████  ██    ██ ████████         ██     ██    ███    ████████  ████    ███    ██    ██ ████████
██       ██     ██ ███   ██    ██            ██     ██   ██ ██   ██     ██  ██    ██ ██   ███   ██    ██
██       ██     ██ ████  ██    ██            ██     ██  ██   ██  ██     ██  ██   ██   ██  ████  ██    ██
██████   ██     ██ ██ ██ ██    ██    ███████ ██     ██ ██     ██ ████████   ██  ██     ██ ██ ██ ██    ██
██       ██     ██ ██  ████    ██             ██   ██  █████████ ██   ██    ██  █████████ ██  ████    ██
██       ██     ██ ██   ███    ██              ██ ██   ██     ██ ██    ██   ██  ██     ██ ██   ███    ██
██        ███████  ██    ██    ██               ███    ██     ██ ██     ██ ████ ██     ██ ██    ██    ██
-->

<h3 id="font-variant-prop">
Overall shorthand for font rendering: the 'font-variant!!property' property</h3>

	<pre class="propdef">
	Name: font-variant
	Value:	normal | none | [ [ <<common-lig-values>> || <<discretionary-lig-values>> || <<historical-lig-values>> || <<contextual-alt-values>> ] || [ small-caps | all-small-caps | petite-caps | all-petite-caps | unicase | titling-caps ] || [ stylistic(<<font-feature-value-name>>) || historical-forms || styleset(<<font-feature-value-name>>#) || character-variant(<<font-feature-value-name>>#) || swash(<<font-feature-value-name>>) || ornaments(<<font-feature-value-name>>) || annotation(<<font-feature-value-name>>) ] || [ <<numeric-figure-values>> || <<numeric-spacing-values>> || <<numeric-fraction-values>> || ordinal || slashed-zero ] || [ <<east-asian-variant-values>> || <<east-asian-width-values>> || ruby ] || [ sub | super ] || [ text | emoji | unicode ] ]
	Initial: normal
	Applies to: all elements and text
	Inherited: yes
	Percentages: n/a
	Computed value: as specified
	Animation type: discrete
	</pre>

	<wpt>
		font-variant-01.html
		font-variant-02.html
		font-variant-03.html
		font-variant-04.html
		parsing/font-shorthand-variant.html
		parsing/font-variant-invalid.html
		parsing/font-variant-valid.html
	</wpt>

	<p>The <span title="font-variant!!property">'font-variant!!property'</span> property
	is a shorthand for all font-variant subproperties:

		* 'font-variant-ligatures'
		* 'font-variant-position'
		* 'font-variant-caps'
		* 'font-variant-numeric'
		* 'font-variant-alternates'
		* 'font-variant-east-asian'
		* 'font-variant-emoji'

	The value <dfn id="font-variant-normal-value" title="normal!!font-variant"
	dfn-for="font-variant" dfn-type="value">normal</dfn>
	resets all subproperties of <span title="font-variant!!property">'font-variant!!property'</span>
	to their initial value.
	The <dfn id="font-variant-none-value" title="none!!font-variant"
	dfn-for="font-variant" dfn-type="value">none</dfn> value
	sets 'font-variant-ligatures' to 'font-variant-ligatures/none'
	and resets all other font feature properties to their initial value.
	Like other shorthands,
	using <span title="font-variant!!property">'font-variant'</span>
	resets unspecified <span title="font-variant!!property">'font-variant'</span> subproperties
	to their initial values.</p>

	<p>It does not reset the values of
	'font-language-override',
	<span title="font-feature-settings!!property">'font-feature-settings!!property'</span>
	or <span title="font-variation-settings!!property">'font-variation-settings!!property'</span>.</p>

<!--
████████ ████████  ██████
██       ██       ██    ██
██       ██       ██
██████   ██████    ██████
██       ██             ██
██       ██       ██    ██
██       ██        ██████
-->

<h3 id="font-feature-settings-prop">
Low-level font feature settings control: the 'font-feature-settings!!property' property</h3>

	<pre class="propdef">
	Name: font-feature-settings
	Value:	normal | <<feature-tag-value>>#
	Initial: normal
	Applies to: all elements and text
	Inherited: yes
	Percentages: n/a
	Computed value: as specified
	Animation type: discrete
	</pre>

	<wpt>
		font-features-across-space-1.html
		font-features-across-space-2.html
		font-features-across-space-3.html
		font-feature-settings-tibetan.html
		parsing/font-feature-settings-computed.html
		parsing/font-feature-settings-invalid.html
		parsing/font-feature-settings-valid.html
	</wpt>

	<p>This property provides
	low-level control over OpenType font features.
	It is intended as a way of providing access
	to font features
	that are not widely used
	but are needed for a particular use case.

	<div class="advisement">
		Authors should <em>not</em> use
		<span title="font-feature-settings!!property">'font-feature-settings!!property'</span> to set any of the font features in
		the table below. Instead, please use the higher-level replacement properties, because:

		<ol>
			<li>The higher-level properties cascade individually. You can set one without setting the whole 'font-feature-settings!!property' list
			<li>Some higher-level properties can be synthesized for fonts that do not support the font feature.
		</ol>

		<table id="ffs-replacements" class="data">
			<thead>
				<tr>
					<th>If you want to set this font feature
					<th>then use this <em>instead of</em> 'font-feature-settings!!property'
					<th>Notes
			<tbody>
				<tr><td>Kerning (<code>kern</code>) or Vertical Kerning (<code>vkrn</code>)<td>'font-kerning!!property': ''font-kerning/normal''<td>The 'font-kerning!!property' property will set the <code>kern</code> or <code>vkrn</code> feature depending on the 'writing-mode'.
				<tr><td>Standard Ligatures (<code>liga</code>) or Contextual Ligatures (<code>clig</code>)<td>'font-variant-ligatures!!property': ''font-variant-ligatures/common-ligatures''<td>
				<tr><td>Discretionary Ligatures (<code>dlig</code>)<td>'font-variant-ligatures!!property': ''font-variant-ligatures/discretionary-ligatures''<td>
				<tr><td>Historical Ligatures (<code>hlig</code>)<td>'font-variant-ligatures!!property': ''font-variant-ligatures/historical-ligatures''<td>
				<tr><td>Contextual Alternates (<code>calt</code>)<td>'font-variant-ligatures!!property': ''font-variant-ligatures/contextual''<td>
				<tr><td>Subscript (<code>subs</code>)<td>'font-variant-position!!property': ''font-variant-position/sub''<td>
				<tr><td>Superscript (<code>sups</code>)<td>'font-variant-position!!property': ''font-variant-position/super''<td>
				<tr><td>Small Capitals (<code>smcp</code>)<td>'font-variant-caps!!property': ''font-variant-caps/small-caps''<td>
				<tr><td>Small Capitals From Capitals (<code>c2sc</code>)<td>'font-variant-caps!!property': ''font-variant-caps/all-small-caps''<td>
				<tr><td>Petite Capitals (<code>pcap</code>)<td>'font-variant-caps!!property': ''font-variant-caps/petite-caps''<td>
				<tr><td>Petite Capitals From Capitals (<code>c2pc</code>)<td>'font-variant-caps!!property': ''font-variant-caps/all-petite-caps''<td>
				<tr><td>Unicase (<code>unic</code>)<td>'font-variant-caps!!property': ''font-variant-caps/unicase''<td>
				<tr><td>Titling (<code>titl</code>)<td>'font-variant-caps!!property': ''font-variant-caps/titling-caps''<td>
				<tr><td>Lining Figures (<code>lnum</code>)<td>'font-variant-numeric!!property': ''font-variant-numeric/lining-nums''<td>
				<tr><td>Oldstyle Figures (<code>onum</code>)<td>'font-variant-numeric!!property': ''font-variant-numeric/oldstyle-nums''<td>
				<tr><td>Proportional Figures (<code>pnum</code>)<td>'font-variant-numeric!!property': ''font-variant-numeric/proportional-nums''<td>
				<tr><td>Tabular Figures (<code>tnum</code>)<td>'font-variant-numeric!!property': ''font-variant-numeric/tabular-nums''<td>
				<tr><td>Fractions (<code>frac</code>)<td>'font-variant-numeric!!property': ''font-variant-numeric/diagonal-fractions''<td>
				<tr><td>Alternative Fractions (<code>afrc</code>)<td>'font-variant-numeric!!property': ''font-variant-numeric/stacked-fractions''<td>
				<tr><td>Ordinals (<code>ordn</code>)<td>'font-variant-numeric!!property': ''font-variant-numeric/ordinal''<td>
				<tr><td>Slashed Zero (<code>zero</code>)<td>'font-variant-numeric!!property': ''font-variant-numeric/slashed-zero''<td>
				<tr><td>Historical Forms (<code>hist</code>)<td>'font-variant-alternates!!property': ''font-variant-alternates/historical-forms''<td>
				<tr><td>Stylistic Alternates (<code>salt</code>)<td>'font-variant-alternates!!property': ''font-variant-alternates/stylistic()''<td>Define which alternate gets used by making an ''@font-feature-values'' rule
				<tr><td>Character Variant 1 - Character Variant 99 (<code>cv01</code> - <code>cv99</code>)<td>'font-variant-alternates!!property': ''font-variant-alternates/character-variant()''<td>Define which character variant gets used by making an ''@font-feature-values'' rule
				<tr><td>Swash (<code>swsh</code>) or Contextual Swash (<code>cswh</code>)<td>'font-variant-alternates!!property': ''font-variant-alternates/swash()''<td>Define which swash gets used by making an ''@font-feature-values'' rule
				<tr><td>Ornaments (<code>ornm</code>)<td>'font-variant-alternates!!property': ''font-variant-alternates/ornaments()''<td>Define which ornament gets used by making an ''@font-feature-values'' rule
				<tr><td>Alternate Annotation Forms (<code>nalt</code>)<td>'font-variant-alternates!!property': ''font-variant-alternates/annotation()''<td>Define which annotation gets used by making an ''@font-feature-values'' rule
				<tr><td>JIS78 Forms (<code>jp78</code>)<td>'font-variant-east-asian!!property': ''font-variant-east-asian/jis78''<td>
				<tr><td>JIS83 Forms (<code>jp83</code>)<td>'font-variant-east-asian!!property': ''font-variant-east-asian/jis83''<td>
				<tr><td>JIS90 Forms (<code>jp90</code>)<td>'font-variant-east-asian!!property': ''font-variant-east-asian/jis90''<td>
				<tr><td>JIS2004 Forms (<code>jp04</code>)<td>'font-variant-east-asian!!property': ''font-variant-east-asian/jis04''<td>
				<tr><td>Simplified Forms (<code>smpl</code>)<td>'font-variant-east-asian!!property': ''font-variant-east-asian/simplified''<td>
				<tr><td>Traditional Forms (<code>trad</code>)<td>'font-variant-east-asian!!property': ''font-variant-east-asian/traditional''<td>
				<tr><td>Full Widths (<code>fwid</code>)<td>'font-variant-east-asian!!property': ''font-variant-east-asian/full-width''<td>
				<tr><td>Proportional Widths (<code>pwid</code>)<td>'font-variant-east-asian!!property': ''font-variant-east-asian/proportional-width''<td>
				<tr><td>Ruby Notation Forms (<code>ruby</code>)<td>'font-variant-east-asian!!property': ''font-variant-east-asian/ruby''<td>
		</table>
	</div>

	<div class="example" id="ex-scientific-inferiors">
		<p>For example, there is no font-variant value to control
		Scientific Inferiors (small numerals used in chemical formulae).
		Readability is enhanced by using them, so they must be enabled
		using font-feature-settings:</p>

		<pre>
		.chem {
			font-feature-settings: 'sinf'
		}
		</pre>

		<figure>
			<img alt="scientific inferior numbers in a chemical formula" src="images/scientific-inferiors.png" width="775" height="210">
			<figcaption>Scientific inferiors improve readability of chemical formulae</figcaption>
		</figure>
	</div>

	<p class="note">The entire property value is set at once.
		Unlike the font-variant properties,
		there is no way to modify
		the inherited value
		by adding or removing individual features.
	</p>

	<p>A value of
	<dfn id="font-feature-settings-normal-value" dfn-for="font-feature-settings" dfn-type="value"
	title="normal!!font-feature-settings">normal</dfn>
	means that no change
	in glyph selection or positioning
	occurs due to this property.</p>

	<p>Feature tag values have the following syntax:</p>

	<pre class="prod">
		<dfn dfn-for="font-feature-settings" dfn-type="type" id="feature-tag-value">&lt;feature-tag-value&gt;</dfn> = &lt;opentype-tag&gt; [ &lt;integer [0,∞]&gt; | on | off ]?
		<dfn>&lt;opentype-tag&gt;</dfn> = &lt;string&gt;
	</pre>

	<p>The <<opentype-tag>> is a case-sensitive OpenType feature tag.
	As specified in the OpenType specification [[!OPENTYPE]],
	feature tags contain four ASCII characters.
	Tag strings longer or shorter than four characters,
	or containing characters outside the U+20&ndash;7E codepoint range
	are invalid.
	<!-- and what happens? ignored?
		they won't be found in the font anyway, so the next section applies -->
	Feature tags need only match
	a feature tag defined in the font,
	so they are not limited to
	explicitly registered OpenType features.
	Fonts defining custom feature tags
	should follow the
	<a href="https://www.microsoft.com/typography/otspec/featuretags.htm">tag name rules</a>
	defined in the OpenType specification [[!OPENTYPE-FEATURES]].

	<p id="must-not-synthesize-features">Feature tags
	not present in the font are ignored;
	a user agent must not attempt to synthesize fallback behavior
	based on these feature tags.
	The one exception is that
	user agents may synthetically support the <span class="tag">kern</span> feature
	with fonts that contain kerning data in the form of a <code>kern</code> table
	but lack <span class="tag">kern</span> feature support
	in the <code>GPOS</code> table.</p>

	<p class="note">In general, authors should
	use the 'font-kerning' property
	to explicitly enable or disable kerning
	since this property always affects fonts
	with either type of kerning data.</p>

	<p>If present,
	a value indicates an index used for glyph selection.
	An <<integer>> value must be 0 or greater.
	A value of 0 indicates that the feature is disabled.
	For boolean features,
	a value of 1 enables the feature.
	For non-boolean features,
	a value of 1 or greater enables the feature
	and indicates the feature selection index. A
	value of <dfn value for="<feature-tag-value>">on</dfn> is synonymous with 1
	and <dfn value for="<feature-tag-value>">off</dfn> is synonymous with 0.
	If the value is omitted, a value of 1 is assumed.
	</p>

	<p id="ffs-map">The computed value
	of font-feature-settings is a map,
	so any duplicates in the specified value
	must not be preserved.
	If the same feature tag appears more than once,
	the value associated with the last appearance supersedes
	any previous value for that axis.</p>

	<p id="ffs-sorted">The computed value contains the de-duplicated feature tags,
		sorted in ascending order by [=code unit=].
	</p>

	<div class="example" id="ex-font-feature-settings-map">
		<pre>
		font-feature-settings: "sinf" 1;       /* sinf=1 enable Scientific Inferiors */
		font-feature-settings: "sinf" on;      /* sinf=1 enable Scientific Inferiors */
		font-feature-settings: 'sinf';         /* sinf=1 enable Scientific Inferiors */
		font-feature-settings: "sinf" off;     /* sinf=0 disable Scientific Inferiors */
		font-feature-settings: "sinf", 'twid'; /* sinf=1, twid=1 enable Scientific Inferiors and Third Widths */
		font-feature-settings: "sinf" "twid";  /* invalid, need a comma-delimited list */
		font-feature-settings: "silly" off;    /* invalid, tag too long */
		font-feature-settings: "PKRN";         /* PKRN=1 enable custom feature */
		font-feature-settings: sinf;           /* invalid, tag must be a string */
		</pre>
	</div>

	<p>When values greater than the range
	supported by the font
	are specified,
	the behavior is explicitly undefined.
	For boolean features, in general these will enable the feature.
	For non-boolean features,
	out of range values will in general
	be equivalent to a 0 value.
	However,
	in both cases the exact behavior
	will depend upon the way the font is designed
	(specifically, which type of lookup is used
	to define the feature).</p>

	<p>Implementations may choose to ignore
	turning off features which
	the OpenType specification says are always required,
	such as required ligatures "rlig".</p>

	<wpt>
		font-variant-ligatures-11.optional.html
	</wpt>

	<p>Although specifically defined for OpenType feature tags,
	feature tags for other modern font formats
	that support font features
	may be added in the future.
	Where possible,
	features defined for other font formats
	should attempt to follow
	the pattern of registered OpenType tags.</p>

	<div class="example" id="ex-half-width-kana">
		<p>The Japanese text below will be rendered with half-width kana characters:</p>

		<pre lang="ja">
		body { font-feature-settings: "hwid"; /* Half-width OpenType feature */ }

		&lt;p>毎日<a href="https://example.com/?q=%E3%82%AB%E3%83%AC%E3%83%BC" style="text-decoration: none;">カレー</a>食べてるのに、飽きない&lt;/p>
		</pre>
	</div>

<!--
██          ███    ██    ██  ██████          ███████  ██     ██ ████████
██         ██ ██   ███   ██ ██    ██        ██     ██ ██     ██ ██     ██
██        ██   ██  ████  ██ ██              ██     ██ ██     ██ ██     ██
██       ██     ██ ██ ██ ██ ██   ████       ██     ██ ██     ██ ████████
██       █████████ ██  ████ ██    ██        ██     ██  ██   ██  ██   ██
██       ██     ██ ██   ███ ██    ██        ██     ██   ██ ██   ██    ██
████████ ██     ██ ██    ██  ██████          ███████     ███    ██     ██
-->

<h3 id="font-language-override-prop">Font language override: the 'font-language-override' property</h3>

	<pre class="propdef">
	Name: font-language-override
	Value: normal | <<string>>
	Initial: normal
	Applies to: all elements and text
	Inherited: yes
	Percentages: N/A
	Computed value: specified string or the keyword ''font-language-override/none''
	Animation type: discrete
	</pre>

	<wpt>
		font-language-override-01.html
		font-language-override-02.html
		font-language-override-03.html
		parsing/font-language-override-computed.html
		parsing/font-language-override-invalid.html
		parsing/font-language-override-valid.html
	</wpt>

	Normally, authors can control the use of language-specific glyph substitutions and positioning
	by setting the content language of an element, as <a href="#language-specific-support">described above</a>:

	<div class="example" id="ex-font-lang-override">
		<pre>&lt;!-- Display text using S'gaw Karen specific features -->

		&lt;p lang="ksw">...&lt;/p></pre>
	</div>

	In some cases, authors may need to specify a language system
	that differs from the content language, for example due to the need to mimic another language's
	typographic traditions. The 'font-language-override!!property' property allows authors to explicitly specify
	the language system of the font, overriding the language system implied by the content language.

	Values have the following meanings:

	<dl dfn-for="font-language override" dfn-type="value">
		<dt><dfn id="font-language-override-normal-value">normal</dfn></dt>
		<dd>specifies that when rendering with OpenType fonts,
			the content language of the element is used to infer the OpenType language system</dd>

		<dt><dfn data-dfn-type=value data-dfn-for=font-language-override id="font-language-override-string-value"><<string>></dfn></dt>
		<dd>single four-character case-sensitive OpenType <a href="https://www.microsoft.com/typography/otspec/languagetags.htm">language system tag</a>,
			specifies the OpenType language system to be used instead of the language system implied by the language of the element.
			If the string is shorter than four characters,
			it is padded at the end with space (U+0020) characters
			such that the length is 4, before being matched.
		</dd>
	</dl>

	<!-- For this level, string represents a single language code, there's no concept of "fallback"
	https://www.w3.org/2013/06/07-css-minutes.html#item04 -->

	<!-- this para replaced, https://github.com/w3c/csswg-drafts/issues/1104

	Use of invalid OpenType language system tags must not generate a
	parse error but must be ignored when doing glyph selection and
	placement.
	-->

	Unknown OpenType language system tags are silently ignored, and do not affect
	glyph selection and placement.

	<div class="example" id="ex-related-language">
		The <a href="https://www.un.org/en/about-us/universal-declaration-of-human-rights">Universal Declaration of
		Human Rights</a> has been translated into a wide variety of languages.  In Turkish,
		Article 9 of this document might be marked up as below:

		<pre lang="tr">&lt;body lang="tr">
		&lt;h4>Madde 9&lt;/h4>
		&lt;p>Hiç kimse keyfi olarak tutuklanamaz, alıkonulanamaz veya sürülemez.&lt;/p>
		</pre>

		Here the user agent uses the value of the <code>lang</code> attribute when rendering text and
		appropriately renders this text without &#39;fi&#39; ligatures. There is no need
		to use the 'font-language-override!!property' property.

		However, a given font may lack support for a specific language. In this
		situation authors may need to use the typographic conventions of a related language
		that are supported by that font:

		<pre lang="mk">&lt;body lang="mk">     &lt;!-- Macedonian lang code --&gt;
		body { font-language-override: "SRB"; /* Serbian OpenType language tag */ }

		&lt;h4>Члeн 9&lt;/h4>
		&lt;p>Никoj чoвeк нeмa дa бидe пoдлoжeн нa прoизвoлнo aпсeњe, притвoр или прoгoнувaњe.&lt;/p>
		</pre>

		As the content creator knows that font specified supports Serbian, the Macedonian text
		here will be rendered using Serbian typographic conventions.
	</div>

<h2 id="font-feature-variation-resolution">
Font Feature and Variation Resolution</h2>

	As described in the previous section,
	font features and variations can be enabled in a variety of ways,
	either via the use of 'font-variant!!property',
	'font-feature-settings!!property', or
	'font-variation-settings!!property' in a style rule
	or within an ''@font-face'' rule.
	The resolution order for the union of these settings is defined below.
	Features defined via CSS properties are applied on top of layout engine default features.

<!--
████████  ████████ ████████    ███    ██     ██ ██       ████████
██     ██ ██       ██         ██ ██   ██     ██ ██          ██
██     ██ ██       ██        ██   ██  ██     ██ ██          ██
██     ██ ██████   ██████   ██     ██ ██     ██ ██          ██
██     ██ ██       ██       █████████ ██     ██ ██          ██
██     ██ ██       ██       ██     ██ ██     ██ ██          ██
████████  ████████ ██       ██     ██  ███████  ████████    ██
-->

<h3 id="default-features">
Default features</h3>

	For OpenType fonts,
	user agents must enable the default features
	defined in the OpenType documentation
	for a given script and writing mode.
	Required ligatures, common ligatures and contextual forms
	must be enabled by default
	(OpenType features: <span class="tag">rlig, liga, clig, calt</span>),
	along with localized forms
	(OpenType feature: <span class="tag">locl</span>),
	and features required for proper display of composed characters and marks
	(OpenType features: <span class="tag">ccmp, mark, mkmk</span>).
	These features must always be enabled,
	even when the value of the 'font-variant!!property' and 'font-feature-settings!!property' properties is <css>normal</css>.
	Individual features are only disabled when explicitly overridden by the author,
	as when 'font-variant-ligatures!!property' is set to 'font-variant-ligatures/no-common-ligatures'.

	<wpt>
		font-default-01.html
		font-default-02.html
		font-default-03.html
		font-default-04.html
	</wpt>

	For handling complex scripts such as
	<a href="https://www.microsoft.com/typography/otfntdev/arabicot/features.aspx">Arabic</a>,
	<a href="https://www.microsoft.com/typography/otfntdev/mongolot/features.htm">Mongolian</a> or
	<a href="https://www.microsoft.com/typography/otfntdev/devanot/features.aspx">Devanagari</a>
	additional features are required.
	For upright text within vertical text runs,
	vertical alternates (OpenType feature: <span class="tag">vert</span>) must be enabled.

<!--
████████  ████████  ████████  ██████  ████████ ████████  ████████ ██    ██  ██████  ████████
██     ██ ██     ██ ██       ██    ██ ██       ██     ██ ██       ███   ██ ██    ██ ██
██     ██ ██     ██ ██       ██       ██       ██     ██ ██       ████  ██ ██       ██
████████  ████████  ██████   ██       ██████   ██     ██ ██████   ██ ██ ██ ██       ██████
██        ██   ██   ██       ██       ██       ██     ██ ██       ██  ████ ██       ██
██        ██    ██  ██       ██    ██ ██       ██     ██ ██       ██   ███ ██    ██ ██
██        ██     ██ ████████  ██████  ████████ ████████  ████████ ██    ██  ██████  ████████
-->

<h3 id="feature-variation-precedence">
Feature and variation precedence</h3>

	General and [=font specific=] font feature property settings are
	resolved in the order below, in ascending order of precedence.  This ordering is
	used to construct a combined list of font features that affect a given
	text run.

	1. Font features enabled by default are applied, including features required for a given script.
			See [[#default-features]] for a description of these.

	2. <span id="apply-font-matching-variations">Font variations as enabled by the 'font-weight!!property',
			'font-width!!property', and 'font-style!!property' properties are applied.</span>

		The application of the value enabled by
		'font-style!!property' is affected by font selection, because this property might select an
		italic or an oblique font. The value applied is the closest matching value as determined
		by the <a href="#font-style-matching">font matching algorithm</a>. User agents must apply
		at most one value due to the 'font-style!!property' property; both "ital" and "slnt" values must
		not be set together.

		If the selected font is defined in an ''@font-face'' rule, then the values applied at this step
		should be clamped to the value of the 'font-weight!!descriptor', 'font-width!!descriptor',
		and 'font-style!!descriptor'
		descriptors in that ''@font-face'' rule.

		Then, the values applied in this step should be clamped (possibly again) to the values
		that are supported by the font.

	3. The language specified by the inherited value of lang/xml:lang is applied.

	4. If the font is defined via an ''@font-face'' rule, the font language override
		implied by the 'font-language-override!!descriptor' descriptor in the ''@font-face'' rule is applied.

	5. If the font is defined via an ''@font-face'' rule, that ''@font-face'' rule includes
		at least one valid '@font-face/font-named-instance' descriptor
		with a value other than 'font-named-instance/none',
		and the loaded font resource includes a named instance with that name
		according to the [[#localized-name-matching]] rules,
		then all the variation values represented by that named instance are applied.
		These values are clamped to the values that are supported by the font.

	6. If the font is defined via an ''@font-face'' rule, the font variations
		implied by the 'font-variation-settings!!descriptor' descriptor in the ''@font-face'' rule are applied.

	7. If the font is defined via an ''@font-face'' rule, the font features
		implied by the 'font-feature-settings!!descriptor' descriptor in the ''@font-face'' rule are applied.

	8. The font language override implied by the value of the 'font-language-override!!property' property is applied.

	9. Font variations implied by the value of the 'font-optical-sizing!!property' property are applied.

	10. Font features implied by the value of the 'font-variant!!property' property,
		the related 'font-variant!!property' subproperties and any other CSS property
		that uses OpenType features (e.g. the 'font-kerning!!property' property) are applied.

		<!-- other CSS props override 'font-variant' but not 'font-feature-settings' -->
		<!-- http://lists.w3.org/Archives/Public/www-style/2013Aug/0110.html -->

	11. Feature settings determined by properties other than 'font-variant!!property' or
		'font-feature-settings!!property' are applied. For example, setting a
		non-default value for the 'letter-spacing' property disables optional ligatures.

	12. Font variations implied by the value of the 'font-variation-settings!!property' property are applied.
		These values should be clamped to the values that are supported by the font.

	13. Font features implied by the value of 'font-feature-settings!!property' property are applied.

	<wpt>
		font-feature-resolution-001.html
		font-feature-resolution-002.html
		lang-attribute-affects-rendering.html
		lang-attribute-affects-rendering-of-second-text-run.html
	</wpt>

	This ordering allows authors to set up a general set of defaults
	for fonts within their ''@font-face'' rules, then override them with
	property settings for specific elements. General property settings
	override the settings in ''@font-face'' rules and low-level font feature
	settings override 'font-variant!!property' property settings.

	For situations where the combined list of font feature settings
	contains more than one value for the same feature, the last value is
	used. When a font lacks support for a given underlying font feature,
	text is simply rendered as if that font feature was not enabled; font
	fallback does not occur and no attempt is made to synthesize the
	feature except where explicitly defined for specific properties.

<h3 id="feature-precedence-examples">
Feature precedence examples</h3>

	<div class="example" id="ex-tabular-prices">
		With the styles below, numbers are rendered proportionally when used within
		a paragraph but are shown in tabular form within tables of prices:

		<pre>
		body {
			font-variant-numeric: proportional-nums;
		}

		table.prices td {
			font-variant-numeric: tabular-nums;
		}
		</pre>
	</div>

	<div class="example" id="ex-features-local">
		The ''@font-face'' rule can also be used to access font features in locally available
		fonts via the use of <code>local()</code> in the 'src!!descriptor' descriptor of the ''@font-face'' definition:

		<pre>
		@font-face {
			font-family: BodyText;
			src: local("HiraMaruPro-W4");
			font-variant: proportional-width;
			font-feature-settings: "ital"; /* Latin italics within CJK text feature */
		}

		body { font-family: BodyText, serif; }
		</pre>

		If available, a Japanese font "Hiragino Maru Gothic" will be used.  When text
		rendering occurs, Japanese kana will be proportionally spaced and Latin text will
		be italicized.  Text rendered with the fallback serif font will use default
		rendering properties.
	</div>

	<div class="example" id="ex-no-dlig-in-special">
		In the example below, discretionary ligatures are enabled only for a downloadable font
		but are disabled within spans of class "special":

		<pre>
		@font-face {
			font-family: main;
			src: url(fonts/ffmeta.woff) format("woff");
			font-variant: discretionary-ligatures;
		}

		body         { font-family: main, Helvetica; }
		span.special { font-variant-ligatures: no-discretionary-ligatures; }
		</pre>

		Suppose one adds a rule using 'font-feature-settings' to enable discretionary ligatures:

		<pre>
		body         { font-family: main, Helvetica; }
		span         { font-feature-settings: "dlig"; }
		span.special { font-variant-ligatures: no-discretionary-ligatures; }
		</pre>

		In this case, discretionary ligatures <em>will</em> be rendered
		within spans of class "special".
		This is because both the 'font-feature-settings' and 'font-variant-ligatures' properties
		apply to these spans.
		Although the ''no-discretionary-ligatures'' setting of 'font-variant-ligatures'
		effectively disables the OpenType "dlig" feature,
		because the 'font-feature-settings' is resolved after that,
		the "dlig" value reenables discretionary ligatures.
	</div>

<h2 id="font-variation-props">
Font Variation Properties</h2>

	Note: The technology in use in this section is named "font variations."
	An instance of one such font as a "variable font."

<!--
 ███████  ████████  ████████ ████  ██████     ███    ██
██     ██ ██     ██    ██     ██  ██    ██   ██ ██   ██
██     ██ ██     ██    ██     ██  ██        ██   ██  ██
██     ██ ████████     ██     ██  ██       ██     ██ ██
██     ██ ██           ██     ██  ██       █████████ ██
██     ██ ██           ██     ██  ██    ██ ██     ██ ██
 ███████  ██           ██    ████  ██████  ██     ██ ████████
-->

<h3 id="font-optical-sizing-def">
Optical sizing control: the 'font-optical-sizing' property</h3>

	<pre class="propdef">
	Name: font-optical-sizing
	Value: auto | none
	Initial: auto
	Applies to: all elements and text
	Inherited: yes
	Percentages: n/a
	Computed value: specified keyword
	Animation type: discrete
	</pre>

	<wpt>
		parsing/font-optical-sizing-computed.html
		parsing/font-optical-sizing-invalid.html
		parsing/font-optical-sizing-valid.html
	</wpt>

	Typographically,
	text rendered at different sizes
	often benefits from slightly different visual representations.
	For example, to aid reading at small text sizes,
	strokes are often thicker with larger serifs.
	Larger text often has a more delicate figure
	with more contrast between thicker and thinner strokes.

	<dl dfn-type=value dfn-for=font-optical-sizing>
		<dt><dfn id="font-optical-sizing-auto-value">auto</dfn>
		<dd>
			The user agent may modify the shape of glyphs
			based on the font-size and the pixel density of the screen.
			For OpenType and TrueType fonts using font variations,
			this is often done by using the "opsz" font variation.

		<dt><dfn id="font-optical-sizing-none-value">none</dfn>
		<dd>
			The user agent must not modify the shape of glyphs for optical size.
	</dl>

	<figure id="optical-size-example">
		<img alt="text with different optical sizes, normalized to similar physical sizes" src="images/Century_Expanded-a-normalized.jpg" width="800" height="114">
		<figcaption>
			Each size of Century Expanded as it existed in analog metal form.
			The different optical sizes,
			normalized here to the same physical size,
			have design variations to maintain stylistic traits and improve readability.
		</figcaption>
	</figure>

	'font-size' must be considered when selecting a variation value for the "opsz" axis,
	but other signals may also be considered.

	Note: User agents are expected to supply a value for the "opsz" axis
	which is close to the used value for 'font-size'.
	However, user agents might wish to consider other factors
	such as pixel density of the screen,
	or the solid angle the text subtends in the viewer's retina.
	<a href="https://github.com/w3c/csswg-drafts/issues/807#issue-195683688">Experiments have shown</a>,
	however, that disregarding these other ancillary factors
	and using only 'font-size' might be the best way for a user agent to select this value.

	Pixel density as well as visual size of the text
	may influence the variation value chosen for 'font-optical-sizing'.
	When either pixel density or visual size of the text
	changes in response to a user operation or style change,
	user agents must not choose a new value for this variation value
	unless the change is layout-causing.
	User agents are free to determine which changes are layout-causing.

	Note: Some user operations,
	such as pinch-zoom,
	can be considered not-layout-causing
	if they do not cause text to reflow.
	However, other user operations,
	such as increasing text size for accessibility purposes,
	can be considered layout-causing because they cause text to reflow.
	Similarly, the 'transform' property can be considered not-layout-causing
	because transforms generally do not cause text to reflow.
	Each user-agent is free to decide
	whether or not each operation is layout-changing or not.

	User agents must not synthesize optical sizing
	when it is not performed by the font directly.

	User agents must not select a value for the "opsz" axis
	which is not supported by the font used for rendering the text.
	This can be accomplished by clamping a chosen value to the range supported by the font.

	'font-optical-sizing' interacts with 'font-size-adjust'. When applying optical sizing, User agents must
	apply an optical sizing value appropriate for the adjusted font size, subject to the above restrictions.

<!--
████████ ██     ██  ██████
██       ██     ██ ██    ██
██       ██     ██ ██
██████   ██     ██  ██████
██        ██   ██        ██
██         ██ ██   ██    ██
██          ███     ██████
-->

<h3 id="font-variation-settings-def">
Low-level font variation settings control: the 'font-variation-settings' property</h3>

	<pre class="propdef">
	Name: font-variation-settings
	Value: normal | [ <<opentype-tag>> <<number>> ]#
	Initial: normal
	Applies to: all elements and text
	Inherited: yes
	Percentages: n/a
	Computed value: the keyword ''font-variation-settings/normal'' or a list, each item a string paired with a number
	Animation type: see prose
	</pre>

	<wpt>
		font-variation-settings-calc.html
		variable-in-font-variation-settings.html
		variations/variable-box-font.html
		variations/variable-gpos-m2b.html
		variations/variable-gsub.html
		variations/variable-opsz-size-adjust.html
		variations/variable-opsz.html
	</wpt>

	This property provides low-level control
	over OpenType or TrueType font variations.
	It is intended as a way of providing access to font variations
	that are not widely used but are needed for a particular use case.

	<div class="advisement">Authors should <em>not</em> use
		<span title="font-variation-settings!!property">'font-variation-settings!!property'</span> to set any of the variation axes in
		the table below. Instead, please use the higher-level replacement properties, because:

		<ol>
			<li>The higher-level properties cascade individually. You can set one without setting the whole 'font-variation-settings!!property' list
			<li>Some higher-level properties can be synthesized for fonts that do not support the font variation.
		</ol>

		<table id="fvs-replacements" class="data">
			<thead>
				<tr>
					<th>If you want to set this variation axis
					<th>then use this <em>instead of</em> 'font-variation-settings!!property'
					<th>Notes
			<tbody>
				<tr><td>Weight (<code>wght</code>)<td>'font-weight!!property'<td>The 'font-weight!!property' property will set the <code>wght</code> axis if one is present.
				<tr><td>Width (<code>wdth</code>)<td>'font-width!!property'<td>The 'font-width!!property' property will set the <code>wdth</code> axis if one is present.
				<tr><td>Slant (<code>slnt</code>) or Italic (<code>ital</code>)<td>'font-style!!property'<td>The 'font-style!!property' property will set the <code>slnt</code> or <code>ital</code> axis, depending on its value.
				<tr><td>Optical size (<code>opsz</code>)<td>'font-optical-sizing!!property'<td>The 'font-optical-sizing!!property' property will set the <code>opsz</code> axis if one is present.
		</table>
	</div>

	The use of font variation settings
	does not affect font selection
	where a fallback font is to be used,
	where using font properties for the same axis
	would have an effect on font selection.

	When possible,
	authors should generally use the other properties related to font variations
	(such as 'font-optical-sizing'),
	and only use this property for special cases
	where its use is the only way of accessing a particular infrequently used font variation.

	For example,
	it is preferable to use 'font-weight!!property': 700
	rather than 'font-variation-settings': "wght" 700.

	A value of ''font-variation-settings/normal'' means that no change in glyph shape, matching, or positioning occurs due to this property.

	The <<opentype-tag>> is a case-sensitive OpenType or TrueType variation axis name.
	As specified in the OpenType / TrueType specifications,
	axis names contain four ASCII characters.
	Axis name strings longer or shorter than four characters,
	or containing characters outside the U+20&ndash;7E codepoint range
	are invalid.
	Axis names need only match an axis tag defined in the font,
	so they are not limited to explicitly registered OpenType / TrueType variation axes.
	Fonts defining custom axis names
	should follow the <a href="https://www.microsoft.com/typography/otspec/fvar.htm">name rules</a> defined in the OpenType specification.

	If a given axis is not supported by a font,
	its value setting is ignored and therefore has no effect;
	a user agent must not attempt to synthesize fallback behavior based on these axis tags.
	Other axis values within the same CSS 'font-variation-settings' statement are not ignored.

	If a variation axis is supported by a font
	but its set value is greater or less than the predefined font range,
	it will be clamped to the closest value supported by the font.

	Values are allowed to be fractional or negative.

	Note: it is preferable to obtain slanted faces
	by using the 'font-style!!property' property.
	However, if using the <code>slnt</code> axis directly,
	via 'font-variation-settings',
	remember that it is defined
	with a positive angle meaning a counter-clockwise slant,
	the opposite direction to CSS.

	If the same axis name appears more than once, the value associated with the last appearance supersedes any previous value for that axis. This deduplication is observable by accessing the computed value of this property.

	<p id="fvs-sorted">The computed value contains the de-duplicated axis names,
	sorted in ascending order by [=code unit=].</p>

	Although specifically defined for OpenType / TrueType variations,
	variation axes for other modern font formats that support font variations
	might be added in the future.
	Where possible,
	variations defined for other font formats
	should attempt to follow the pattern of registered variation axes.

	Animating font-variation-settings is possible
	using the following mechanism. Two declarations of font-feature-settings can be animated between if they are "like".
	"Like" declarations are ones where the same set of properties appear (in any order). Because successive duplicate properties are applied instead of prior duplicate properties, two declarations can be "like" even if they have differing number of properties.
	If two declarations are "like"
	then animation occurs pairwise between corresponding values in the declarations.
	Otherwise, animation is not possible.
	In this situation,
	the "from" values of the animation are swapped to the "to" values
	at an unspecified time during the animation.

<h2 id="color-font-support">
Color Font Support</h2>

	Color fonts allow for font files to describe,
	not just the contours describing the edges of glyphs,
	but also the colors present inside the glyphs.

	<figure id="multicolore">
		<img src="images/multicolore.png" width="800" height="178" alt="an example multicolored font">
		<figcaption>Multicolore, by Ivan Filipov</figcaption>
	</figure>

	<figure id="magicalunicorn">
		<img src="images/please.png" width="800" height="320" alt="an example multicolored font">
		<figcaption>Magical Unicorn Neue Pro, by Arthur Reinders Folmer</figcaption>
	</figure>

	<figure id="reemkufi">
		<img src="./images/Reem-Kufi.png" width="800" height="99" alt="an example multicolored font">
		<figcaption>Reem Kufi Ink, by Khaled Hosny and Santiago Orozco </figcaption>
	</figure>

	For some uses, such as emoji,
	having the colors fixed in the font is appropriate.
	For others, there is a need to control the colors used from a stylesheet.

	<wpt>
		font-colorization.html
	</wpt>

	CSS provides two ways to do this.
	The 'font-palette' property allows selecting
	one of several different palettes
	contained in the font.
	The ''@font-palette-values'' rule allows overriding
	one or more colors from within a palette
	or even
	the creation of an entirely different palette.

<!--
████████     ███    ██       ████████ ████████ ████████ ████████
██     ██   ██ ██   ██       ██          ██       ██    ██
██     ██  ██   ██  ██       ██          ██       ██    ██
████████  ██     ██ ██       ██████      ██       ██    ██████
██        █████████ ██       ██          ██       ██    ██
██        ██     ██ ██       ██          ██       ██    ██
██        ██     ██ ████████ ████████    ██       ██    ████████
-->

<!--
	Implementations:

	Chromium Issue 1170794: Support font-palette
	https://bugs.chromium.org/p/chromium/issues/detail?id=1170794
-->

<h3 id="font-palette-prop">
Controlling Color Font Palettes: The 'font-palette' property</h3>

	Many color font file formats allow colors within glyphs to be parameterized.
	In these fonts, colors are referenced by index when describing the geometry of each glyph.
	These indices are resolved within a current active palette
	using a lookup table present inside the font.
	However, many fonts contain multiple palettes,
	each containing a set of complementary colors
	chosen by the font designer to provide pleasing visual results.

	In addition, some color font file formats
	provide a regular, uncolored glyph outline
	as well as the colored versions.

	<pre class="propdef">
	Name: font-palette
	Value: normal | light | dark | <<palette-identifier>> | <<palette-mix()>>
	Initial: normal
	Applies to: all elements and text
	Inherited: yes
	Percentages: N/a
	Computed value: specified keyword, identifier or <<palette-mix()>> function.
		<<palette-mix()>> must be simplified to a single keyword or identifier if resulting palette is equivalent.
	Animation type: by computed value
	</pre>

	<wpt>
		font-palette-10.html
		font-palette-11.html
		font-palette-12.html
		font-palette-13.html
		font-palette-14.html
		font-palette-15.html
		font-palette-16.html
		font-palette-17.html
		font-palette-18.html
		font-palette-19.html
		font-palette-2.html
		font-palette-20.html
		font-palette-21.html
		font-palette-22.html
		font-palette-23.html
		font-palette-23b.html
		font-palette-24.html
		font-palette-25.html
		font-palette-26.html
		font-palette-27.html
		font-palette-28.html
		font-palette-29.html
		font-palette-3.html
		font-palette-30.html
		font-palette-31.html
		font-palette-32.html
		font-palette-33.html
		font-palette-34.html
		font-palette-35.html
		font-palette-36.html
		font-palette-4.html
		font-palette-5.html
		font-palette-6.html
		font-palette-7.html
		font-palette-8.html
		font-palette-9.html
		font-palette-add-2.html
		font-palette-add.html
		font-palette-empty-font-family.html
		font-palette-modify-2.html
		font-palette-modify.html
		font-palette-non-ident-font-family.html
		font-palette-relative-color-crash.html
		font-palette-remove-2.html
		font-palette-remove.html
		font-palette.html
		font-palette-values-relative-colors.html
		animations/font-palette-interpolation.html
		font-palette-vs-shorthand.html
		parsing/font-palette-computed.html
		parsing/font-palette-invalid.html
		parsing/font-palette-valid.html
	</wpt>

	With the <dfn>palette-mix()</dfn> function defined as follows:

	<pre class="prod def" nohighlight>
	<l><<palette-mix()>></l> = palette-mix(<<color-interpolation-method>> , [ [normal | light | dark | <<palette-identifier>> | <<palette-mix()>> ] && <<percentage [0,100]>>? ]#{2})
	</pre>

	<dl dfn-for=font-palette dfn-type=value>
		<dt><dfn>normal</dfn>
		<dd>
			If the 'color-scheme' property is set to a value other than ''color-scheme/normal''',
			user-agents should select the first light or dark palette as appropriate.
			Otherwise, user-agents display the color font with the default palette
			or default glyph colorisation.

			User-agents should take the computed value of the 'color' property into consideration
			when a color font format requires use of the foreground color

			<div class="example" id="ex-FFFF-means-color">In the <code>COLR</code> [[!OPENTYPE]] table, color index 0xFFFF should be rendered according the 'color' property.</div>

			<div class="example" id="ex-normal-is-index-0">For <code>COLR</code>/<code>CPAL</code> [[!OPENTYPE]] fonts, 'font-palette': ''font-palette/normal'' usually means rendering the font with the palette in the font at index 0.</div>

		<dt><dfn>light</dfn>
		<dd>
			Some color font formats include metadata
			marking certain palettes as applicable on a light (close to white) background.
			This keyword causes the user-agent
			to use the first available palette in the font file marked this way.
			If the font file format does not account for this metadata,
			or no palette in the font is marked this way,
			this value behaves as ''font-palette/normal''.

		<dt><dfn>dark</dfn>
		<dd>
			Some color font formats include metadata
			marking certain palettes as applicable on a dark (close to black) background.
			This keyword causes the user-agent
			to use the first available palette in the font file marked this way.
			If the font file format does not account for this metadata,
			or no palette in the font is marked this way,
			this value behaves as ''font-palette/normal''.

		<dt><dfn type><<palette-identifier>></dfn>
		<dd>
			This value identifies an CSS-defined palette to use.
			Users can define a palette by using the ''@font-palette-values'' rule.
			If no applicable ''@font-palette-values'' rule is present,
			this value behaves as ''font-palette/normal''.

			<<palette-identifier>> is parsed as a <<dashed-ident>>.

			Note: Such a CSS-defined palette may
			be a reference to an existing palette already present in the font,
			be a modification of an existing palette already present in the font,
			or be an entirely new palette.

		<dt><dfn type><<palette-mix()>></dfn>
		<dd>
			This value defines a position in the interpolation between two palette values,
			identified by <<palette-identifier>>, by the palette keywords
			''font-palette/normal'', ''font-palette/light'', ''font-palette/dark'',
			or by another <<palette-mix()>> value.

			The glyphs of the font must be rendered with a palette that is created by
			interpolating for each palette color index between the matching color indices
			of the first and second palette specified as arguments,
			recursively resolving <<palette-mix()>> functions if needed.

			For each palette color, the interpolation follows
			the rules of the <<color-mix()>> function.

			Percentages are normalized according to [[css-color-5#color-mix-percent-norm]].
	</dl>

	<wpt>
		palette-mix-computed.html
	</wpt>

	Note: The names 'font-palette/light' and 'font-palette/dark' describe the <i>background</i> the color palette is usable on,
		not the colors in the color palette themselves.

	<div class="example" id="ex-dark-mode-palette">When dark mode is in effect, use a dark mode palette
		<pre>@media (prefers-color-scheme: dark) {
				.banner {font-palette: dark;
			}
		}
		</pre>
	</div>

	<div class="example" id="ex-bixa-palette-anim">
		Animate between palettes.

		<pre>
		@font-palette-values --pink {
			font-family: Nabla;
			base-palette: 1;
		}

		@font-palette-values --yellow {
			font-family: Nabla;
			base-palette: 7;
		}

		@keyframes animate-palette {
			from {
				font-palette: --yellow;
			}
			to {
				font-palette: --pink;
			}
		}

		p {
			font-family: Nabla;
			animation: animate-palette 1.4s infinite alternate linear;
		}
		</pre>

		<figure>
			<img src="images/nabla-animated.webp" width="705" height="350" alt="The word Animate animated between a pink and a yellow palette.">
			<figcaption>Nabla Color by typearture.com - animating between palettes 1 and 7 in the font.</figcaption>
		</figure>
	</div>

	<wpt>
		animations/font-palette-animation-not-specified-endpoints.html
		animations/multiple-elements-font-palette-animation.html
	</wpt>

	Issue: Add more examples and pictures.

<!--
████████     ███    ██       ██       ████████ ████████ ████████ ████████  ██████
██     ██   ██ ██   ██       ██       ██          ██       ██    ██       ██    ██
██     ██  ██   ██  ██       ██       ██          ██       ██    ██       ██
████████  ██     ██ ██       ██       ██████      ██       ██    ██████    ██████
██        █████████ ██       ██       ██          ██       ██    ██             ██
██        ██     ██ ██       ██       ██          ██       ██    ██       ██    ██
██        ██     ██ ████████ ████████ ████████    ██       ██    ████████  ██████
-->

<h3 id="font-palette-values">
User-defined font color palettes: The ''@font-palette-values'' rule</h3>

	The <dfn>@font-palette-values</dfn> rule defines a color palette
	and associates that color palette with a specific font.
	This allows a web author to select arbitrary <<color>>s to use inside a color font
	rather than being limited to the preexisting palettes inside font files.

	Note: The OpenType <code><a href="https://docs.microsoft.com/en-us/typography/opentype/spec/cpal">CPAL</a></code> table is restricted to sRGB colors.
	The <<color>>s in ''@font-palette-values'' allow any CSS color.
	Some implementations currently use APIs which are restricted to sRGB
	and may therefore map the specified colors to sRGB.
	This is expected to be a temporary limitation.
	Authors should not rely on this mapping to sRGB.

	In addition, this rule's association with a specific font
	allows a name of a palette to apply differently to different fonts,
	which allows similar colors to be used across multiple fonts
	when multiple fonts are used in an element
	(i.e. for font fallback).

	Note: A web author might wish to create multiple palettes for a single font
	in order to create multiple themes for their web content.
	A web author might also wish to create matching palettes for multiple fonts
	to achieve a consistent design across a collection of different fonts.

	A ''@font-palette-values'' rule represents a palette of colors used in a font.
	A palette consists of an ordered collection of colors.
	Using the ''@font-palette-values'' allows a web author
	to reference a palette existing within a font
	as well as creating a palette populated with author-defined colors.
	In addition, it allows overriding a set of colors from a palette in the font
	with colors described by the web author.

	A palette is always <i>complete</i>, meaning that it is impossible to describe
	a palette which has missing colors. If colors would be missing, they are taken
	from the palette within the font identified by the 'base-palette!!descriptor' descriptor.

	[=Math functions=], such as ''calc()'',
	and also ''var()'', and ''env()'',
	are valid within descriptor values in a
	''@font-palette-values'' rule. They are evaluated within the context of the root
	element. Relative units are also evaluated within the context of the root element.

	The ''@font-palette-values'' rule consists of the ''@font-palette-values'' at-keyword
	followed by a block of descriptor declarations.
	It has the following syntax:

	<pre class=prod>
		@font-palette-values <<dashed-ident>> {
			<<declaration-list>>
		}
	</pre>

	<wpt>
		palette-values-rule-add-2.html
		palette-values-rule-add.html
		palette-values-rule-delete-2.html
		palette-values-rule-delete.html
		parsing/font-palette-values-invalid.html
		parsing/font-palette-values-valid.html
	</wpt>

	The ''@font-palette-values'' rule accepts the descriptors defined in this specification.

	If multiple ''@font-palette-values'' rules are defined with the same name,
	the last one in document order wins, and all preceding ones are ignored.

	<div class="example" id="ex-bixa-palette">
		Modify Bixa Color's color palette.

		<pre>
		@font-palette-values --Cooler {
			font-family: Bixa;
			base-palette: 1;
			override-colors:
				1 #7EB7E4;
		}
		</pre>

		<figure>
			<img src="images/bixa-colors.png" width="775" height="340" alt="overriding a color">
			<figcaption>Bixa Color by Novo Typo. Above, using the colors in the font;
				below, the orange changed to a blue.</figcaption>
		</figure>
	</div>

	<div class="example" id="ex-handover-palette">
		Modify Handover Sans's color palette

		<pre>
		@font-palette-values --Augusta {
			font-family: Handover Sans;
			base-palette: 3;
			override-colors:
				1 rgb(43, 12, 9),
				3 var(--highlight);
		}
		</pre>
	</div>

	These descriptors apply solely within the context of the ''@font-palette-values'' rule in which they are defined,
	and do not apply to document language elements.
	When a given descriptor occurs multiple times in a given ''@font-palette-values'' rule,
	only the last descriptor declaration is used
	and all prior declarations for that descriptor are ignored.

	Each of these palettes are applied
	to each @font-face that share a family name.

	<div class="example" id="ex-greenish-two-fonts">
		I want to use two color fonts in a greenish palette.
		The first font, Bixxxa, already has palette that I can use,
		but for Bungeehee I need to overwrite one color
		to get my green palette.

		<pre class="lang-css">
			@font-face {
				font-family: Bixxxa;
				src: url('./bixxxa.woff') format('woff');
			}

			@font-face {
				font-family: Bungeehee;
				src: url('./bungeehee.woff') format('woff');
			}

			@font-palette-values --ToxicGreen {
				font-family: Bixxxa;
				base-palette: 3; /* This is Bixxxa's green palette */
			}


			@font-palette-values --ToxicGreen {
				font-family: Bungeehee;
				base-palette: 7; /* This is Bungeehee's green palette... */
				override-colors: 2 lime; /* ...except this is pink, which I overwrite to lime */
			}

			h1 {
				font-family: Bixxxa;
				font-palette: --ToxicGreen;
			}

			h2 {
				font-family: Bungeehee;
				font-palette: --ToxicGreen;
			}
		</pre>

		<em>Example by Roel Nieskens</em>
	</div>

	Note: In the case where a family name is shared
	between multiple physical fonts,
	(such as when a compound font is created, using 'unicode-range!!descriptor'),
	and if those fonts have different palettes,
	the result of specifying a partial palette
	using ''@font-palette-values''
	is unlikely to be what the author intended.
	In this case,
	it is better to supply a complete palette definition.

	<div class="example" id="ex-named-palettes">
		In the above example,
		since two different font families have been set up
		to have compatible named palettes,
		one could go on to write

		<pre class="lang-css">
			h3 {
				font-family: Bixxxa, Bungeehee;
				font-palette: --ToxicGreen;
			}
		</pre>

		Which would correctly apply the desired palette
		in each font
		even though they have different palette numbers.
	</div>

	A given set of ''@font-palette-values'' rules
	define which author-defined palettes are available for use
	within the documents that contain these rules.

	An author-defined font color palette
	must only be available to the documents that reference it.
	Using an author-defined color palette outside of the documents that reference it
	would constitute a security leak
	since the contents of one page would be able to affect other pages,
	something an attacker could use as an attack vector.

	This at-rule follows the forward-compatible parsing rules of CSS.
	Like properties in a declaration block,
	declarations of any descriptors that are not supported by the user agent
	must be ignored.
	''@font-palette-values'' rules require a '@font-palette-values/font-family' descriptor;
	if it is missing,
	the ''@font-palette-values'' rule is invalid and must be ignored entirely.

	In cases where user agents have limited platform resources,
	do not implement support for color fonts,
	or implement the ability to disable color fonts,
	''@font-palette-values'' rules must simply be ignored;
	the behavior of individual descriptors as defined in this specification should not be altered.

<h4 id="font-family-2-desc">
Font family: the '@font-palette-values/font-family' descriptor</h4>

	<pre class='descdef'>
	Name: font-family
	Value: <<font-family-name>>#
	For: @font-palette-values
	Initial: N/A
	</pre>

	This descriptor defines the font families that this palette applies to,
	using the same list of font families as [[#font-matching-algorithm]].
	This palette will only ever be applied to the fonts with these family names.
	The value of this descriptor  means that only named font families are allowed
	and rules that include generic fonts in the list of font families
	are syntax errors.
	If syntax errors occur within the font family list,
	the descriptor must be ignored
	(will still be in the CSS OM, but will not match any font families).

<h4 id="base-palette-desc">
Specifying the base palette: the 'base-palette!!descriptor' descriptor</h4>

	<pre class='descdef'>
	Name: base-palette
	Value: light | dark | <<integer [0, ∞]>>
	For: @font-palette-values
	Initial: N/A
	</pre>

	<dl dfn-for=base-palette dfn-type=value>
		<dt><dfn>light</dfn>
		<dd>
			Some color font formats include metadata
			marking certain palettes as applicable on a light (close to white) background.
			This keyword identifies the first available palette in the font file marked this way.
			If the font file format does not account for this metadata,
			or no palette in the font is marked this way,
			this value behaves as 0.

		<dt><dfn>dark</dfn>
		<dd>
			Some color font formats include metadata
			marking certain palettes as applicable on a dark (close to black) background.
			This keyword identifies the first available palette in the font file marked this way.
			If the font file format does not account for this metadata,
			or no palette in the font is marked this way,
			this value behaves as 0.

		<dt><dfn><<integer [0, ∞]>></dfn>
		<dd>
			Identifies a (zero-based) numerical palette index within the font.
	</dl>

	<div class="example" id="ex-banner-palette">
		Modify Banner Flag's color palette

		<pre>
		@font-palette-values --Festival {
			font-family: Banner Flag;
			base-palette: 1;
			override-colors:
				0 rgb(123, 64, 27),
				1 darkblue,
				2 var(--highlight);
		}
		</pre>
	</div>

	This descriptor specifies a palette in the font
	which the containing ''@font-palette-values'' rule uses as an initial value.
	If no 'override-colors!!descriptor' key is present in the ''@font-palette-values'' rule,
	then the ''@font-palette-values'' rule represents the palette in the font
	with the same index as the value of this descriptor.
	If a 'override-colors!!descriptor' key is present in the ''@font-palette-values'' rule,
	each item in the value of that descriptor overrides a single color
	in the color palette represented by this ''@font-palette-values'' block.

	<div class="example" id="ex-handover-3rd">
		Rename Handover Sans's 3rd color palette

		<pre>
		@font-palette-values --Augusta {
			font-family: Handover Sans;
			base-palette: 3;
		}
		</pre>
	</div>

	If this descriptor is not present in the ''@font-palette-values'',
	or if the font does not contain a palette at the index of the value of 'base-palette!!descriptor',
	it behaves as if ''0'' were specified.
	If a font does not contain any color palettes,
	no colors are included in the initial color palette
	represented by this ''@font-palette-values'' rule.
	Colors in the palette can be overridden
	by using the 'override-colors!!descriptor' descriptor in the ''@font-palette-values'' rule.

<h4 id="override-color">
Overriding a colors from a palette: The 'override-colors!!descriptor' descriptor</h4>

	<pre class='descdef'>
	Name: override-colors
	Value: [ <<integer [0, ∞]>> <<color>> ]#
	For: @font-palette-values
	Initial: N/A
	</pre>

	This descriptor overrides colors
	to the initial color palette represented by this ''@font-palette-values'' rule.

	The '@font-palette-values/override-colors' descriptor takes
	a comma-separated list of palette index entries and colors.
	Each item in the comma-separated list represents a tuple of
	an entry into the palette and a color to replace it with.

	Each specified <<color>> must be an
	[=absolute color=],
	otherwise the descriptor is invalid.

	For each key/value pair in the value of this descriptor,
	the color with that key in the initial palette (i.e. by using the 'base-palette!!descriptor' descriptor)
	is overwritten by the color specified in this descriptor's value.
	A key that is outside the range of indices of the initial palette is ignored,
	but does not make the descriptor invalid.

	Palette index entries
	in the ''@font-palette-values/override-colors'' descriptor
	are a (zero-based) palette index entry.

	Integer values are zero-indexed.

	If the keys of multiple distinct key/value pairs identify the same color index (either by name or by integer),
	the last key is used for the purposes of rendering. However, for serialization purposes, both
	key/value pairs are present.

	Note: This means that using 'font-palette' with the same value on two different elements
	might result in different used palettes
	because the value of variables inside the ''@font-palette-values'' rule
	might apply differently in the context of those two elements.

	Colors provided from CSS
	(as overrides, or as new entries)
	may use any supported colorspace.

	<div class="example" id="ex-palette-anycolorspace">
		Modify Blaka Ink's color palette

		<pre>
		@font-palette-values --Festival {
			font-family: Blaka Ink;
			base-palette: 0;
			override-colors:
				0 oklch(0.63 0.12 105.7),
				1 color(display-p3 0.23 0.22 0.04),
				2 color(prophoto-rgb 0.37 0.27 0.09);
		}
		</pre>
	</div>

	Note: The colors specified in versions 0 and 1 of the CPAL table are in sRGB.

<!--
████████ ██     ██  ███████        ██ ████
██       ███   ███ ██     ██       ██  ██
██       ████ ████ ██     ██       ██  ██
██████   ██ ███ ██ ██     ██       ██  ██
██       ██     ██ ██     ██ ██    ██  ██
██       ██     ██ ██     ██ ██    ██  ██
████████ ██     ██  ███████   ██████  ████
-->

<h3 id="font-variant-emoji-prop">
Selecting the text presentation style: The 'font-variant-emoji' property</h3>

	<pre class="propdef">
	Name: font-variant-emoji
	Value: normal | text | emoji | unicode
	Initial: normal
	Applies to: all elements and text
	Inherited: yes
	Percentages: N/a
	Computed value: specified keyword
	Animation type: discrete
	</pre>

	<wpt>
		font-variant-emoji-1.html
		font-variant-emoji-2.html
		font-variant-emoji-003.html
		font-variant-emoji-004.html
		font-variant-emoji-005.html
		variation-sequences.html
		matching/font-unicode-presented-as-emoji-outline.html
		parsing/font-variant-emoji-computed.html
		parsing/font-variant-emoji-invalid.html
		parsing/font-variant-emoji-valid.html
	</wpt>

	This property allows web authors to select
	whether emoji presentation or text presentation is used
	for certain emoji code points.
	Traditionally, these presentation styles were selected
	by appending Variation Selector 15 (U+FE0E) or Variation Selector 16 (U+FE0F)
	to certain code points.
	However, 'font-variant-emoji' allows web authors to set a default presentation style
	which can replace the variation selectors.

	Only the code points <a href="http://www.unicode.org/emoji/charts/emoji-variants.html">listed</a> by Unicode
	as contributing to a Unicode emoji presentation sequence
	are affected by this property.
	Within this CSS specification,
	these characters are referred to as <dfn id="emoji-presentation-participating-code-points">Emoji Presentation Participating Code Points</dfn>.
	This property has no effect on any other characters.

	This property is expected to affect font fallback;
	however, the exact nature of the interaction of font fallback with 'font-variant-emoji'
	is explicitly unspecified.
	However, a variation selector must be included in a previous cluster
	as defined by the <a href="#cluster-matching">cluster matching</a> section above.
	A natural result of this behavior
	is that a variation selector must not be rendered in a different font than the previous character.
	It thus causes font fallback to behave
	as if the respective variation selector was intended
	(as in the values description);
	then font fallback, including the cluster fallback rules, is performed,
	which must take the presentation preference
	of these "appended" variation selectors into account.

	Even when 'font-variant-emoji' is used,
	the presence of Variation Selector 15 (U+FE0E) or Variation Selector 16 (U+FE0F)
	in the contents of an element
	override the rendering specified in 'font-variant-emoji'.
	Therefore, 'font-variant-emoji' sets a default presentation
	which the text being rendered can opt out of.

	Note: Different platforms have different conventions about how to handle emoji presentation sequences.
	A cross-platform UA might wish to follow the conventions of each individual platform,
	or it might wish to use the same approach on all platforms.
	When tasked with a request for an emoji style rendering,
	a UA might wish to disregard fonts which do not include color tables.
	A different UA might wish instead to use the same mechanical cluster fallback algorithm
	that it would use for any arbitrary cluster.

	Variation selectors other than FE0E VARIATION SELECTOR-15 and U+FE0F VARIATION SELECTOR-16
	must not have any effect on font selection.
	If one of these variation selectors is present,
	but unsupported by the font previously selected,
	the variation selector is ignored.

	BCP47's <code>-u-</code> extension to the language tag accepted by <code>lang</code> or <code>xml:lang</code> should not be
	considered when the user-agent decides whether to use emoji presentation or text presentation for a particular character.

	<dl dfn-for=font-variant-emoji dfn-type=value>
		<dt><dfn>normal</dfn>
		<dd>
			User agents can choose to draw a <a>Emoji Presentation Participating Code Point</a>
			in either emoji style or text style.
			User agents typically follow platform conventions when performing this decision.

		<dt><dfn>text</dfn>
		<dd>
			Code points are rendered as if U+FE0E VARIATION SELECTOR-15
			was appended to every <a>Emoji Presentation Participating Code Point</a>.

		<dt><dfn>emoji</dfn>
		<dd>
			Code points are rendered as if U+FE0F VARIATION SELECTOR-16
			was appended to every <a>Emoji Presentation Participating Code Point</a>.

		<dt><dfn>unicode</dfn></dt>
		<dd>
			Code points are rendered in accordance with [[!UTS51]]
			as either emoji-default, text-default, or text-only,
			depending on the values of the Emoji and Emoji_Presentation
			properties for each
			<a>Emoji Presentation Participating Code Point</a>.
			If present, FE0E VARIATION SELECTOR-15 and U+FE0F VARIATION SELECTOR-16
			will override the default presentation of individual
			<a>Emoji Presentation Participating Code Points</a>.
		</dd>
	</dl>

	<div class="example" id="ex-emoji-variant">
		To show the emoji form of U+1F6CB COUCH AND LAMP,
		let CustomEmoji.ttf obey the user agent's notion
		of supporting the emoji form of this character,
		and use the following:

		<pre>
		@font-face {
			font-family: "Custom Emoji";
			src: url("CustomEmoji.ttf") format("truetype");
		}
		...
		&lt;div style="font-family: 'Custom Emoji'; font-variant-emoji: emoji;"&gt;&amp;#x1F6CB;&lt;/div&gt;
		</pre>
	</div>

<!--
████████    ███    ██     ██  ███████  ██    ██  ███████  ██     ██ ██    ██
   ██      ██ ██    ██   ██  ██     ██ ███   ██ ██     ██ ███   ███  ██  ██
   ██     ██   ██    ██ ██   ██     ██ ████  ██ ██     ██ ████ ████   ████
   ██    ██     ██    ███    ██     ██ ██ ██ ██ ██     ██ ██ ███ ██    ██
   ██    █████████   ██ ██   ██     ██ ██  ████ ██     ██ ██     ██    ██
   ██    ██     ██  ██   ██  ██     ██ ██   ███ ██     ██ ██     ██    ██
   ██    ██     ██ ██     ██  ███████  ██    ██  ███████  ██     ██    ██
-->

<h2 id="font-taxonomy">
Font Taxonomy</h2>

	A given font may belong in one or more of the following categories:

<h3 id="installed-fonts">
Installed Fonts</h3>

	A font may be installed globally on a device. Such fonts are generally accessible in any application, even applications which have no concept of CSS. The file or files backing the font object exist on the user's device, not as a remote resource.

Installed Fonts must not be Web Fonts, and Web Fonts must not be Installed Fonts.

<h3 id="web-fonts">
Web Fonts</h3>

	A font may be backed by a remote resource, which must be requested using the user agent's resource fetching infrastructure. Web Fonts are represented by one of two mechanisms:

	- ''@font-face'' rules
	- A ''FontFace'' member of the Document's ''FontFaceSet''

	A Web Font must not be accessible in any other Document from the one which either is associated with the ''@font-face'' rule or owns the ''FontFaceSet''. Other applications on the device must not be able to access Web Fonts.

	Installed Fonts must not be Web Fonts, and Web Fonts must not be Installed Fonts.

	Web Fonts shadow Installed Fonts, so if an Installed Font has the same family name as a Web Font, the Installed Font is not accessible.

<h3 id="preinstalled-and-user-installed-fonts">
Preinstalled Fonts and User-Installed Fonts</h3>

	Users can choose to install fonts on their devices.
	User-Installed Fonts are installed by an explicit action by the user,
	such as clicking an "Install" button
	or copying a file into a particular directory on their device.
	Such fonts are User-Installed Fonts and also are Installed Fonts.
	Web content authors should not count on the presence of user-installed fonts,
	because there is no guarantee any user will have
	performed the action to install a specific font.

	Please see the <a href="#font-matching-algorithm">Font Matching Algorithm</a>
	description of how user-installed fonts may interact with the font matching algorithm.

	Any Installed Font which is not a User-Installed font is a Preinstalled Font. It is likely that all users of a particular version of a particular Operating System will have the same set of Preinstalled Fonts installed. As such, Web content authors targeting these Operating Systems may wish to use these fonts' family names inside 'font-family!!property' properties.

<h3 id="system-font">
System Font</h3>

	The System Font is the font which is used by the ''system-ui'' <a href="#system-ui-def">generic font family name</a>. It is an example of a Preinstalled Font.

	Additional font styles may also be provided as ''ui-sans-serif'', ''ui-serif'', ''ui-monospace'',
	and ''ui-rounded'' which are also Preinstalled Font(s) if the system provides them.

	<wpt>
		system-ui-ar.html
		system-ui-ja-vs-zh.html
		system-ui-ja.html
		system-ui-mixed.html
		system-ui-ur-vs-ar.html
		system-ui-ur.html
		system-ui-zh.html
		system-ui.html
	</wpt>

<h2 id="font-technologies-formats">
	Font Technologies and Formats
</h2>

<h3 id="font-tech-definitions">Font tech</h3>

	The <dfn value for="<font-features-tech>">features-opentype</dfn>, <dfn value for="<font-features-tech>">features-aat</dfn> and <dfn value for="<font-features-tech>">features-graphite</dfn> techs
	refer to support for font features,
	commonly implemented in [[!OPENTYPE]] with the
	<code><a href="https://docs.microsoft.com/en-us/typography/opentype/spec/gsub">GSUB</a></code> and the
	<code><a href="https://docs.microsoft.com/en-us/typography/opentype/spec/gpos">GPOS</a></code> tables,
	as well as in [[!AAT-FEATURES]] using the
	<code><a href="https://developer.apple.com/fonts/TrueType-Reference-Manual/RM06/Chap6morx.html">morx</a></code> and
	<code><a href="https://developer.apple.com/fonts/TrueType-Reference-Manual/RM06/Chap6kerx.html">kerx</a></code> tables
	and [[!GRAPHITE]] with the
	<code>Silf</code>,
	<code>Glat </code>,
	<code>Gloc </code>,
	<code>Feat </code> and
	<code>Sill </code> tables
	as documented in the
	<a href="https://graphite.sil.org/">Graphite Table Format</a>.
	The section on [[#font-rend-props]] describes properties that interact with these facilities.

	The <dfn value for="<font-tech>">variations</dfn> tech refers to the support of font variations,
	commonly implemented in [[!OPENTYPE]] with the
	<code><a href="https://docs.microsoft.com/en-us/typography/opentype/spec/avar">avar</a></code>,
	<code><a href="https://docs.microsoft.com/en-us/typography/opentype/spec/cvar">cvar</a></code>,
	<code><a href="https://docs.microsoft.com/en-us/typography/opentype/spec/fvar">fvar</a></code>,
	<code><a href="https://docs.microsoft.com/en-us/typography/opentype/spec/gvar">gvar</a></code>,
	<code><a href="https://docs.microsoft.com/en-us/typography/opentype/spec/hvar">HVAR</a></code>,
	<code><a href="https://docs.microsoft.com/en-us/typography/opentype/spec/mvar">MVAR</a></code>,
	<code><a href="https://docs.microsoft.com/en-us/typography/opentype/spec/stat">STAT</a></code>, and
	<code><a href="https://docs.microsoft.com/en-us/typography/opentype/spec/vvar">VVAR</a></code> tables,
	as well as in [[!AAT-FEATURES]] using the
	<code><a href="https://docs.microsoft.com/en-us/typography/opentype/spec/avar">avar</a></code>,
	<code><a href="https://docs.microsoft.com/en-us/typography/opentype/spec/cvar">cvar</a></code>,
	<code><a href="https://docs.microsoft.com/en-us/typography/opentype/spec/fvar">fvar</a></code>,
	<code><a href="https://docs.microsoft.com/en-us/typography/opentype/spec/gvar">gvar</a></code> tables.
	The section on [[#basic-font-props]] as well as the section on [[#font-variation-props]]
	describe properties that interact with these facilities.

	The <dfn value for="<color-font-tech>">color-colrv0</dfn>, <dfn value for="<color-font-tech>">color-colrv1</dfn>, <dfn value for="<color-font-tech>">color-svg</dfn>, <dfn value for="<color-font-tech>">color-sbix</dfn> and <dfn value for="<color-font-tech>">color-cbdt</dfn>
	technologies refers to various types of color font file technologies.
	Each one represents a table
	(<code><a href="https://docs.microsoft.com/en-us/typography/opentype/spec/colr">COLR</a></code>,
	<code><a href="https://docs.microsoft.com/en-us/typography/opentype/spec/svg">SVG</a></code>,
	<code><a href="https://docs.microsoft.com/en-us/typography/opentype/spec/sbix">sbix</a></code> or
	<code><a href="https://docs.microsoft.com/en-us/typography/opentype/spec/cbdt">CBDT</a></code>)
	inside [[!OPENTYPE]] or [[!AAT-FEATURES]] fonts which must be supported
	to satisfy this requirement.

	The <dfn value for="<font-tech>">palettes</dfn> tech refers to support for font palettes,
	commonly implemented in the [[!OPENTYPE]] and [[!AAT-FEATURES]]
	with the
	<code><a href="https://docs.microsoft.com/en-us/typography/opentype/spec/cpal">CPAL</a></code> table.
	The section on [[#color-font-support]] describes properties that interact with these facilities.

	The <dfn value for="<font-tech>">incremental</dfn> tech
	refers to client support for incremental font transfer [[IFT]].

	<p class="informative">For background on these, see [[PFE-report]].</p>

	Web authors can specify the ''@font-face/src/tech()'' function
	inside an ''@font-face'' 'src!!descriptor' descriptor
	to indicate that support is
	required for correct rendering of a font.
	This mechanism can be used for gracefully falling back
	to an ancillary font
	when requested support is not present.

	<div class="example" id="ex-color-if-supported">
		This ''@font-face'' block shows how to use a color font if support is present on the user agent,
		and falls back to a non-color-font if support is not present.

		<pre>
		@font-face {
			font-family: "Trickster";
			src: url("trickster-COLRv1.otf") format(opentype) tech(color-COLRv1),
			url("trickster-outline.otf") format(opentype);
		}
		</pre>
	</div>

<h3 id="font-format-definitions">Font formats</h3>

	Format strings defined by this specification are as follows.
	The <<font-format>> values are synonyms for the formats below.

	<table class="data" id="fontformats">
		<thead>
			<tr>
				<th>String
				<th>Font Format
				<th>Common extensions
				<th>Common media types
		<tbody>
			<tr>
				<th>"collection"</th>
				<td><a href="https://docs.microsoft.com/en-us/typography/opentype/spec/otff#collections">OpenType Collection</a></td>
				<td>.otc,.ttc</td>
				<td><a href="https://www.iana.org/assignments/media-types/font/collection">font/collection</a></td>
			<tr>
				<th>"embedded-opentype"
				<td><a href="https://www.w3.org/Submission/2008/SUBM-EOT-20080305/">Embedded OpenType</a>
				<td>.eot
				<td><a href="https://www.iana.org/assignments/media-types/application/vnd.ms-fontobject">application/vnd.ms-fontobject</a></td>
			<tr>
				<th>"opentype"
				<td><a href="https://www.microsoft.com/typography/otspec/default.htm">OpenType</a>
				<td>.ttf, .otf
				<td><a href="https://www.iana.org/assignments/media-types/font/otf">font/otf</a>,
				<a href="https://www.iana.org/assignments/media-types/font/ttf">font/ttf</a>
				</td>
			<tr>
				<th>"svg"
				<td><a href="https://www.w3.org/TR/SVG11/fonts.html">SVG Font</a> (deprecated)
				<td>.svg, .svgz
				<td><a href="https://www.iana.org/assignments/media-types/image/svg+xml">image/svg+xml</a></td>
			<tr>
				<th>"truetype"
				<td><a href="https://www.microsoft.com/typography/otspec/default.htm">TrueType</a>
				<td>.ttf
				<td><a href="https://www.iana.org/assignments/media-types/font/ttf">font/ttf</a></td>
			<tr>
				<th>"woff"
				<td><a href="https://www.w3.org/TR/WOFF/">WOFF 1.0 (Web Open Font Format)</a>
				<td>.woff
					<td><a href="https://www.iana.org/assignments/media-types/font/woff">font/woff</a></td>
			<tr>
				<th>"woff2"
				<td><a href="https://www.w3.org/TR/WOFF2/">WOFF 2.0 (Web Open Font Format)</a>
				<td>.woff2
				<td><a href="https://www.iana.org/assignments/media-types/font/woff2">font/woff2</a></td>
	</table>

	<wpt>
		format-specifiers-variations.html
	</wpt>

	Given the overlap in common usage between TrueType and OpenType,
	the format hints "truetype" and "opentype"
	must be considered as synonymous;
	a format hint of "opentype" does not imply
	that the font contains Postscript CFF style glyph data
	or that it contains OpenType layout information
	(see <a href="#platform-props-to-css">Appendix A</a> for more background on this).

<!--
 ███████  ████████        ██ ████████  ██████  ████████       ██     ██  ███████  ████████  ████████ ██
██     ██ ██     ██       ██ ██       ██    ██    ██          ███   ███ ██     ██ ██     ██ ██       ██
██     ██ ██     ██       ██ ██       ██          ██          ████ ████ ██     ██ ██     ██ ██       ██
██     ██ ████████        ██ ██████   ██          ██          ██ ███ ██ ██     ██ ██     ██ ██████   ██
██     ██ ██     ██ ██    ██ ██       ██          ██          ██     ██ ██     ██ ██     ██ ██       ██
██     ██ ██     ██ ██    ██ ██       ██    ██    ██          ██     ██ ██     ██ ██     ██ ██       ██
 ███████  ████████   ██████  ████████  ██████     ██          ██     ██  ███████  ████████  ████████ ████████
-->

<h2 id="object-model">
Object Model</h2>

	The contents of ''@font-face'' and ''@font-feature-values'' rules
	can be accessed via the following extensions to the CSS Object Model.

	<wpt>
		idlharness.html
	</wpt>

<h3 id="om-fontface">
The <code id="cssfontfacerule2">CSSFontFaceRule</code> interface</h3>

	The <dfn export id="cssfontfacerule-interface">CSSFontFaceRule</dfn> interface represents a <<@font-face>> rule.

	<pre class="idl">
	[Exposed=Window]
	interface CSSFontFaceDescriptors : CSSStyleDeclaration {
		attribute [LegacyNullToEmptyString] CSSOMString src;
		attribute [LegacyNullToEmptyString] CSSOMString fontFamily;
		attribute [LegacyNullToEmptyString] CSSOMString font-family;
		attribute [LegacyNullToEmptyString] CSSOMString fontStyle;
		attribute [LegacyNullToEmptyString] CSSOMString font-style;
		attribute [LegacyNullToEmptyString] CSSOMString fontWeight;
		attribute [LegacyNullToEmptyString] CSSOMString font-weight;
		attribute [LegacyNullToEmptyString] CSSOMString fontStretch;
		attribute [LegacyNullToEmptyString] CSSOMString font-stretch;
		attribute [LegacyNullToEmptyString] CSSOMString fontWidth;
		attribute [LegacyNullToEmptyString] CSSOMString font-width;
		attribute [LegacyNullToEmptyString] CSSOMString unicodeRange;
		attribute [LegacyNullToEmptyString] CSSOMString unicode-range;
		attribute [LegacyNullToEmptyString] CSSOMString fontFeatureSettings;
		attribute [LegacyNullToEmptyString] CSSOMString font-feature-settings;
		attribute [LegacyNullToEmptyString] CSSOMString fontVariationSettings;
		attribute [LegacyNullToEmptyString] CSSOMString font-variation-settings;
		attribute [LegacyNullToEmptyString] CSSOMString fontNamedInstance;
		attribute [LegacyNullToEmptyString] CSSOMString font-named-instance;
		attribute [LegacyNullToEmptyString] CSSOMString fontDisplay;
		attribute [LegacyNullToEmptyString] CSSOMString font-display;
		attribute [LegacyNullToEmptyString] CSSOMString fontLanguageOverride;
		attribute [LegacyNullToEmptyString] CSSOMString font-language-override;
		attribute [LegacyNullToEmptyString] CSSOMString ascentOverride;
		attribute [LegacyNullToEmptyString] CSSOMString ascent-override;
		attribute [LegacyNullToEmptyString] CSSOMString descentOverride;
		attribute [LegacyNullToEmptyString] CSSOMString descent-override;
		attribute [LegacyNullToEmptyString] CSSOMString lineGapOverride;
		attribute [LegacyNullToEmptyString] CSSOMString line-gap-override;
	};

	[Exposed=Window]
	interface CSSFontFaceRule : CSSRule {
		[SameObject, PutForwards=cssText] readonly attribute CSSFontFaceDescriptors style;
	};
	</pre>

<h3 id="om-fontfeaturevalues">
The <code id="cssfontfeaturevaluesrule-interface">CSSFontFeatureValuesRule</code> interface</h3>

	<p>The <code>CSSRule</code> interface is extended as follows:</p>

	<pre class='idl'>partial interface CSSRule {
		const unsigned short FONT_FEATURE_VALUES_RULE = 14;
	};</pre>

	<p>The <dfn export id="cssfontfeaturevaluesrule-dfn">CSSFontFeatureValuesRule</dfn> interface represents a <code>@font-feature-values</code> rule.</p>

	<pre class='idl'>
	[Exposed=Window]
	interface CSSFontFeatureValuesRule : CSSRule {
		attribute CSSOMString fontFamily;
		readonly attribute CSSFontFeatureValuesMap annotation;
		readonly attribute CSSFontFeatureValuesMap ornaments;
		readonly attribute CSSFontFeatureValuesMap stylistic;
		readonly attribute CSSFontFeatureValuesMap swash;
		readonly attribute CSSFontFeatureValuesMap characterVariant;
		readonly attribute CSSFontFeatureValuesMap styleset;
		readonly attribute CSSFontFeatureValuesMap historicalForms;
	};

	[Exposed=Window]
	interface CSSFontFeatureValuesMap {
		maplike&lt;CSSOMString, sequence&lt;unsigned long&gt;&gt;;
		undefined set(CSSOMString featureValueName,
			(unsigned long or sequence&lt;unsigned long&gt;) values);
	};
	</pre>

	<dl class='idl-attributes'>
		<dt><var ignore>fontFamily</var> of type <code>CSSOMString</code>
		<dd>The list of one or more font families for which a given set of feature values is defined.</dd>
		<dt>value maps of type <code>CSSFontFeatureValuesMap</code>, readonly
		<dd>Maps of feature values associated with feature value names for a given 'font-variant-alternates' value type</dd>
	</dl>

	Each value map attribute of <code>CSSFontFeatureValuesRule</code> reflects the values
	defined via a corresponding <i title="feature_value_block">feature value block</i>.
	Thus, the <var title="annotation attribute" ignore>annotation</var> attribute
	contains the values contained within a <code title="&#64;annotation">@annotation</code>
	<i title="feature_value_block">feature value block</i>, the
	<var title="ornaments attribute" ignore>ornaments</var> attribute contains the
	values contained with a <code title="&#64;ornaments">@ornaments</code>
	<i title="feature_value_block">feature value block</i> and so forth.

	The <code>CSSFontFeatureValuesMap</code> interface uses the
	<a href="https://webidl.spec.whatwg.org/#js-maplike">default map class methods</a>
	but the <code>set</code> method has different behavior.  It takes a sequence of unsigned integers and
	associates it with a given <code>featureValueName</code>. The method
	behaves the same as the default map class method
	except that a single unsigned long value is treated as a sequence of a
	single value. The method throws an exception if an invalid number of
	values is passed in.  If the associated
	<i title="feature_value_block">feature value block</i>
	only allows a limited number of values, the <code>set</code> method
	throws an <code>InvalidAccessError</code> exception when the input
	sequence to <code>set</code> contains more than the limited number of
	values.  See the
	description of <a href="#multi-value-features">multi-valued feature value definitions</a>
	for details on the maximum number of values allowed for a given type
	of <i title="feature_value_block">feature value block</i>.  The <code>get</code>
	method always returns a sequence of values, even if the sequence only contains
	a single value.

<h3 id="om-fontpalettevalues">
The <code id="cssfontpalettevaluesrule2">CSSFontPaletteValuesRule</code> interface</h3>

	<pre class='idl'>[Exposed=Window]
	interface CSSFontPaletteValuesRule : CSSRule {
		readonly attribute CSSOMString name;
		readonly attribute CSSOMString fontFamily;
		readonly attribute CSSOMString basePalette;
		readonly attribute CSSOMString overrideColors;
	};</pre>

	The <code>fontFamily</code> and <code>basePalette</code> interfaces are parsed according to the appropriate CSS property syntax.

<!--
 ██████  ████████ ████████  ████    ███    ██
██    ██ ██       ██     ██  ██    ██ ██   ██
██       ██       ██     ██  ██   ██   ██  ██
 ██████  ██████   ████████   ██  ██     ██ ██
      ██ ██       ██   ██    ██  █████████ ██
██    ██ ██       ██    ██   ██  ██     ██ ██
 ██████  ████████ ██     ██ ████ ██     ██ ████████
-->

<h2 id="serializing">
Serializing</h2>

<h3 id="serializing-properties">
Serializing font-related properties</h3>

	Unless specifically noted for individual properties,
	the properties defined in this module
	follow the principles of
	[[cssom#serializing-css-values]].

	<wpt>
		parsing/font-variant-serialization.html
	</wpt>

<h3 id="serializing-at-rules">
Serializing font-related at-rules</h3>

	Unless specifically noted
	for individual descriptors,
	the descriptors defined for at-rules in this module
	follow the principles of
	[[cssom#serializing-css-values]].

	In particular,
	following the principle of shorter representation:
	for descriptors which accept a range of values,
	if the start and end values are the same
	(the range is zero)
	the descriptor is serialized as a single value, not a range.

	<wpt>
		variations/at-font-face-descriptors.html
	</wpt>

	<div class="example" id="ex-zero-range">
		For example, the rule

		<pre>
		@font-face {
			font-family: "foo";
			font-weight: 200 200;
		}
		</pre>

		would serialize as

		<pre>
		@font-face {
			font-family: "foo";
			font-weight: 200;
		}
		</pre>
	</div>

	Also,
	following the principle of retaining only the last-defined value,
	as well as the principle of shortest representation,
	multiply-specified tuples and multiple blocks
	are serialized as a single block
	containing only the last-defined value.

	<div class=example id="ex-serialize-same-font-feature-values">
		For example, the declaration:

		<pre class="highlight-css">
		/* Repeated declaration names, and multiple blocks of the same type*/
		@font-feature-values foo {
			@swash { pretty: 0; cool: 2; }
			@swash { pretty: 1; }
		}
		</pre>

		would be serialized as:

		<pre>
		/* Canonical serialization */
		@font-feature-values foo {
			@swash { cool: 2; pretty: 1; }
		}
		</pre>

		<wpt>
			font_feature_values_map_iteration.html
		</wpt>
	</div>

<h2 id="platform-props-to-css" class="no-num">
Appendix A: Mapping platform font properties to CSS properties</h2>

	<em>This appendix is included as background for some of the problems and
	situations that are described in other sections.  It should be viewed as
	informative only.</em>

	Font properties in CSS are designed to be
	independent of the underlying font formats used;
	they can be used to specify bitmap fonts,
	Type1 fonts,
	SVG fonts
	in addition to the common TrueType and OpenType fonts.
	But there are facets of the TrueType and OpenType formats
	that often cause confusion for authors
	and present challenges to implementers
	on different platforms.

	Originally developed at Apple,
	TrueType [[TRUETYPE]] was designed as an outline font format
	for both screen and print.
	Microsoft joined Apple
	in developing the TrueType format
	and both platforms have supported
	TrueType fonts since then.
	Font data in the TrueType format consists of
	a set of tables distinguished with common four-letter tag names,
	each containing a specific type of data.
	For example,
	naming information,
	including copyright and license information,
	is stored in the <css>name</css> table.
	The <a>character map</a> (<css>cmap</css>) table
	contains a mapping
	of character encodings to glyphs.
	Apple later added additional tables
	for supporting enhanced typographic functionality;
	these are now called Apple Advanced Typography, or AAT, fonts.
	Microsoft and Adobe developed
	a separate set of tables for advanced typography
	and called their format OpenType [[OPENTYPE]].
	The OpenType specification is standardized at ISO as the
	Open Font Format [[OPEN-FONT-FORMAT]].

	In many cases the font data used under Microsoft Windows
	or Linux
	is slightly different from the data used under Apple's Mac OS X
	because the TrueType format allowed for
	explicit variation across platforms.
	This includes font metrics,
	names and
	<a>character map</a> data.

	Specifically,
	font family name data is handled differently
	across platforms.
	For TrueType and OpenType fonts
	these names are contained in the <css>name</css> table,
	in name records with name ID 1.
	Multiple names can be stored for different locales,
	but Microsoft recommends fonts
	always include at least a US English version of the name.
	On Windows,
	Microsoft made the decision for backwards compatibility
	to limit this family name to a maximum of four faces;
	for larger groupings the
	"preferred family" (name ID 16) or
	"WWS family" (name ID 21)
	can be used.
	Other platforms such as OSX don't have this limitation,
	so the family name is used to define all possible groupings.

	Other name table data provides names used
	to uniquely identify a specific face within a family.
	The full font name (name ID 4) and
	the Postscript name (name ID 6)
	describe a single face uniquely.
	For example,
	the bold face of the Gill Sans family
	has a fullname of "Gill Sans Bold" and
	a Postscript name of "GillSans-Bold".
	There can be multiple localized versions of the fullname for a given face,
	but the Postscript name is always a unique name
	made from a limited set of ASCII characters.

	On various platforms,
	different names are used to search for a font.
	For example,
	with the Windows GDI CreateIndirectFont API,
	either a family or fullname can be used to lookup a face,
	while on Mac OS X the CTFontCreateWithName API call is used
	to lookup a given face
	using the fullname and Postscript name.
	Under Linux,
	the fontconfig API allows
	fonts to be searched using any of these names.
	In situations where platform API's
	automatically substitute other font choices,
	it may be necessary to
	verify a returned font matches a given name.

	The weight of a given face can be determined
	via the usWeightClass field of the OS/2 table
	or inferred from the style name (name ID 2).
	Likewise, the width can be determined
	via the usWidthClass of the OS/2 table
	or inferred from the style name.
	For historical reasons
	related to synthetic bolding at weights 200 or lower with the Windows GDI API,
	font designers have sometimes skewed values in the OS/2 table
	to avoid these weights.

	Rendering complex scripts that use contextual shaping
	such as Thai,
	Arabic
	and Devanagari
	requires features present only in OpenType or AAT fonts.
	Currently,
	complex script rendering is supported
	on Windows and Linux using OpenType font features
	while both OpenType and AAT font features are used
	under Mac OS X.

<!--
 ██████  ████████  ██████  ██     ██ ████████  ████ ████████ ██    ██
██    ██ ██       ██    ██ ██     ██ ██     ██  ██     ██     ██  ██
██       ██       ██       ██     ██ ██     ██  ██     ██      ████
 ██████  ██████   ██       ██     ██ ████████   ██     ██       ██
      ██ ██       ██       ██     ██ ██   ██    ██     ██       ██
██    ██ ██       ██    ██ ██     ██ ██    ██   ██     ██       ██
 ██████  ████████  ██████   ███████  ██     ██ ████    ██       ██
-->

<h2 id="security">
Security Considerations</h2>

	See items <a href="#sp209">9</a>, <a href="#sp216">16</a> and <a href="#sp217">17</a> in the self-review questionnaire below.

<h2 id="privacy">
Privacy Considerations</h2>

	Following <a href="https://www.w3.org/TR/security-privacy-questionnaire/#questions">Self-Review Questionnaire: Security and Privacy</a>,
	and using the [[#font-taxonomy]]:

<h3 id="sp201">What information might this feature expose to Web sites or other parties, and for what purposes is that exposure necessary?</h3>

	This specification allows the use of Web Fonts,
	which are requested on demand
	but are not installed.
	In the case where the document or stylesheet has a different origin to the Web Font,
	this network request exposes information in the Referer header,
	which may be harvested by font providers.

	In addition to Web Fonts, this specification continues to allow
	the use of Installed Fonts (both  Preinstalled Fonts and User-Installed Fonts)
	as introduced in CSS1.

	While Web Fonts have the advantage of consistency across platforms,
	Installed Fonts have the advantage of zero download time.

	In some cases, and particularly for poorly-supported or minority languages,
	Installed Fonts allow information to be displayed which could not otherwise be displayed
	because there is no freely licensable Web Font which supports that language
	or because the latency or download time would make it's use infeasible,
	particularly for languages with a large character repertoire,
	or on slow or metered connections.

	Note: The set of <a href="#installed-fonts">installed fonts</a>
	available in the <a href="#font-matching-algorithm">Font Matching Algorithm</a>
	is explicitly undefined.
	The available set of fonts <a href="https://panopticlick.eff.org">is</a>
	used by trackers to fingerprint users and reduce their privacy.
	However, some <a href="#installed-fonts">installed fonts</a>,
	even some <a href="#preinstalled-and-user-installed-fonts">user-installed fonts</a>,
	are required to make languages readable.
	User agents may choose to make all installed fonts available
	for language support and design integrity reasons,
	or may choose to make some fonts unavailable for privacy reasons.
	In addition, user agents may have additional facilities for fine-tuning this balance,
	such as interfaces which prompt users to explicitly make
	certain requested fonts available or unavailable
	(perhaps on a per-site basis).
	Different user agents, even running on the same Operating System,
	are expected to strike different balances here.

	In the case of user agents which perform rendering of local resources
	(such as an HTML and CSS to PDF renderer,
	or a Web-based wordprocessor)
	access to all Installed Fonts
	(both  Preinstalled Fonts and User-Installed Fonts)
	is necessary to provide the expected functionality.

	An attacker may obtain fingerprinting information by querying the Installed Fonts.
	In contrast to older technologies
	(notably Adobe Flash, which provided a complete list of Installed Fonts
	and sent this information in HTTP headers)
	such probing must be done one font at a time,
	providing the font family name
	and then checking
	(either via script,
	or by using unicode-range to selectively download webfonts
	depending on whether the user has a font by a certain name
	that supports a certain character)
	whether the font was loaded.
	This takes time, and checking for more than a few hundred fonts
	introduces a noticeable delay in page rendering.

	For <em>especially privacy-sensitive contexts</em>,
	options would include never downloading any webfonts
	(at the risk that some characters may be rendered incorrectly, or not at all),
	or always downloading all webfonts whether needed or not
	(ignoring unicode-range,
	and potentially downloading vast quantities of unused fonts
	each time the page is viewed).

<h3 id="sp202">Is this specification exposing the minimum amount of information necessary to power the feature?</h3>

	An emerging consensus is that a user agent must expose Preinstalled Fonts
	for correct functioning,
	but there is no consensus on exposing User-Installed Fonts.
	This specification <a href="#preinstalled-and-user-installed-fonts"> allows a user agent</a>
	to ignore User-Installed Fonts for the purpose of the Font Matching Algorithm.
	Several existing user agents already do this.

	The minimum amount varies by type of user and is <a href="https://github.com/w3c/csswg-drafts/issues/4497">currently being debated</a>.
	There is a useful <a href="https://github.com/w3c/csswg-drafts/issues/4055#issuecomment-536169515">taxonomy of User-Installed Font users</a>
	which has been <a href="https://github.com/w3c/csswg-drafts/issues/4055#issuecomment-536815201"> slightly extended</a>.

	A permissive amount of information exposes potentially more fingerprinting information;
	a restrictive amount of information reduces fingerprinting but also reduces functionality
	and in some cases, for minority languages, would break the Web completely for those users.

	The possibility of a configurable, per-user opt-in to exposing some or all User-Installed Fonts,
	or a per-origin opt-in, is being discussed.

	The possibility of a privacy budget, which would penalize or disable
	a malicious web page which tested a large number of fonts,
	but allow a harmless page which tested a much smaller number,
	has also been discussed.

	Some user agents expose a more restricted set of Preinstalled Fonts
	in their Private Browsing, Incognito, or Resist Fingerprinting modes,
	compared to their normal mode.

<h3 id="sp203">How does this specification deal with personal information or personally-identifiable information or information derived thereof?</h3>

	Personal information is not exposed by this specification.

	Personally identifiable information may be exposed in some cases.
	For example, for someone in Japan, having conditionally-enabled Japanese fonts
	enumerable probably isn't a substantial fingerprinting vector.
	For someone in Europe who has a Japanese IME in the text input menu, they are.

<h3 id="sp204">How does this specification deal with sensitive information?</h3>

	Fingerprinting on Installed Fonts may expose sensitive information in some cases.
	For example, persecuted minorities risk leaking sensitive information
	by exposing that they use fonts required for a persecuted minority language;
	either by requesting a Web Font from a third party service,
	or exposing Preinstalled Fonts or User-Installed Fonts associated with that language.

<h3 id="sp205">Does this specification introduce new state for an origin that persists across browsing sessions?</h3>

	No.

	Specifically, Web Fonts <a href="#web-fonts">must not be accessible
	in any other Document from the one which either is associated with the @font-face rule
	or owns the FontFaceSet.
	Other applications on the device must not be able to access Web Fonts.</a>
	This avoids information leaking across origins.

	Similarly, font palette values
	<a href="#font-palette-values">must only be available to the documents that reference it</a>.
	Using an author-defined color palette outside of the documents that reference it
	would constitute a security leak since the contents of one page
	would be able to affect other pages,
	something an attacker could use as an attack vector.

<h3 id="sp206">What information from the underlying platform, e.g. configuration data, is exposed by this specification to an origin?</h3>

	The ''system-ui'' keyword exposes the operating system's default system UI font to fingerprinting mechanisms.

<h3 id="sp207">Does this specification allow an origin access to sensors on a user’s device</h3>

	No.

<h3 id="sp208">What data does this specification expose to an origin? Please also document what data is identical to data exposed by other features, in the same or different contexts.</h3>

	For third-party Web Fonts loaded via a stylesheet,
	the stylesheet origin may be exposed to the third party in the Referer header.
	In addition, careful pairing of unicode-range and distinct src urls
	allows the third-party to see which characters are used on a page,
	which is a privacy risk for large character repertoire scripts
	such as CJK.

	For third-party Web Fonts preloaded in the HTML,
	the document origin may be similarly exposed.

<h3 id="sp209">Does this specification enable new script execution/loading mechanisms?</h3>

	No.

	Specifically, for SVG-in-OpenType color fonts,
	the SVG used for glyph definitions should not contain script elements,
	and any script elements that do occur will not be executed.

<h3 id="sp210">Does this specification allow an origin to access other devices?</h3>

	No.

<h3 id="sp211">Does this specification allow an origin some measure of control over a user agent’s native UI?</h3>

	There is some risk that an attacker can spoof a native UI feature
	by determining the Operating System
	and using native-looking fonts appropriate to that Operating System.

<h3 id="sp212">What temporary identifiers might this specification create or expose to the web?</h3>

	None.

<h3 id="sp213">How does this specification distinguish between behavior in first-party and third-party contexts?</h3>

	<a href="#font-fetching-requirements">For font loads</a>, user agents must use the
	potentially CORS-enabled fetch method defined by the [[!HTML]] specification
	for URLs defined within @font-face rules.
	When fetching, user agents must use "Anonymous" mode,
	set the referrer source to the stylesheet’s URL
	and set the origin to the URL of the containing document.

	Thus, fonts will typically not be loaded cross-origin
	unless authors specifically take steps to permit cross-origin loads.

<h3 id="sp214">How does this specification work in the context of a user agent’s Private Browsing or "incognito" mode?</h3>

	The specification makes no distinction.

	Some user agents may expose a more restricted set of Installed Fonts in these modes.

<h3 id="sp215">Does this specification have a "Security Considerations" and "Privacy Considerations" section?</h3>

	Yes.

<h3 id="sp216">Does this specification allow downgrading default security characteristics?</h3>

	No.

<h3 id="sp217">What should this questionnaire have asked?</h3>

	It should have asked whether a malicious payload could crash the application,
	or indeed the entire Operating System,
	or even cause remote code execution.

	This possibility does exist for suitably crafted fonts
	on some platforms
	when fonts are installed and rendered,
	and this has been exploited in the wild.

	In practice, user agents running on Operating Systems with this vulnerability
	use a font sanitizer to detect such malformed or malicious fonts
	and prevent their being used.

<h2 id="a11y">
Accessibility Considerations</h2>

	The use of fonts to provide a visual rendering of text should not, in general, impact accessibility.
	For example, people using a screen reader to render text to speech will not download fonts,
	and are unaffected by what those fonts would have contained.

	However, this assumes that the semantics conveyed by the font glyphs
	and the semantics conveyed by the characters
	are the same.

	Historically, this has not always been the case.
	For example, in the early days of the Web it was common to use fonts
	(such as "Symbol", though others were used)
	to make Latin letters have Greek glyphs;
	while this worked visually,
	it would not work with a screen reader
	and text was also hard to search or index
	because the mapping was font-specific.
	With the rise of Unicode, it is now standard practice to use Greek characters for Greek text,
	and for Greek glyphs in fonts to map to Greek characters.

	Sadly, but avoidably, this practice persists
	with badly designed icon fonts.
	For example, such a font might put a "printer" icon on the Latin letter "P".
	This practice scatters meaningless letters through the text,
	which negatively affects text searching and indexing,
	gives hard to understand rendering if the icon font does not load,
	and impedes screen readers.
	A well designed font must assign such icons to semantically meaningful characters.
	For example, the printer icon might be assigned to the string "printer"
	or to the Unicode character 🖨 U+1F5A8 (PRINTER).

<h2 id="acknowledgments">
Acknowledgments</h2>

	The CSS Working group would like to thank:

	Peter Constable for assorted language fixes.

	Optical sizing <a href="#optical-size-example">image</a> prepared by Nick Sherman.

	Urdu samples prepared by Richard Ishida.

	Munira Tursunova and Dominik Röttsches developed the features for animating font-palette.

	John Hudson was kind enough to take the time to explain the subtleties of OpenType language tags
	and provided the example of character variant usage for displaying text on Byzantine seals.

	Elika Etemad supplied some of the initial design ideas for the '@font-feature-values' rule.

	Special thanks to Tab Atkins Jr.
	for providing the text for the section on <a href="#font-rendering-controls">Font Rendering Controls</a>
	as well as the section on the '@font-face/font-display!!descriptor' descriptor.
	Special thanks to Ilya Grigorik and David Kuettel for their help in developing these sections.

<!--
 ██████  ██     ██    ███    ██    ██  ██████   ████████  ██████
██    ██ ██     ██   ██ ██   ███   ██ ██    ██  ██       ██    ██
██       ██     ██  ██   ██  ████  ██ ██        ██       ██
██       █████████ ██     ██ ██ ██ ██ ██   ████ ██████    ██████
██       ██     ██ █████████ ██  ████ ██    ██  ██             ██
██    ██ ██     ██ ██     ██ ██   ███ ██    ██  ██       ██    ██
 ██████  ██     ██ ██     ██ ██    ██  ██████   ████████  ██████
-->

<h2 id="changes">
Changes</h2>

<h3 id="changes-20240201">
Changes from the <a href="https://www.w3.org/TR/2024/WD-css-fonts-4-20240201/">1 February 2024 working draft</a></h3>

	<ul>
		<!-- to 22 April 2026 -->
		<li>Clarified range constraints on descriptor values in <<font-feature-value-type>>
			(<a href="https://github.com/w3c/csswg-drafts/pull/13324">Issue 13324</a>)</li>
		<li>Added font- prefix to production names to avoid ambiguity
			(<a href="https://github.com/w3c/csswg-drafts/issues/13263">Issue 13263</a>, 
				<a href="https://github.com/w3c/csswg-drafts/pull/13272">PR 13272</a>)</li>
		<li>Created proper types for &lt;absolute-size> and &lt;relative-size>
			(<a href="https://github.com/w3c/webref/issues/1794">Issue 1794</a>)
		</li>
		<li>Defined that if there are multiple @font-palette-values rules, the last one wins
			(<a href="https://github.com/w3c/csswg-drafts/issues/12981">Issue 12981</a>)
		</li>
		<li>Clarified that clamping to the variable range also affects implied variation axes
			(<a href="https://github.com/w3c/csswg-drafts/issues/7999">Issue 7999</a>)
		</li>
		<li>Add some more clarifications on the other ui-* generic font families
			(<a href="https://github.com/w3c/csswg-drafts/issues/3658">Issue 3658</a>)
		</li>
		<li>Add notes for the system-ui generic font family
			(<a href="https://github.com/w3c/csswg-drafts/pull/12831">PR 12831</a>),
			(<a href="https://github.com/w3c/csswg-drafts/issues/3658">Issue 3658</a>)
		</li>
		<li>Cleaned up fetching of font resources
			(<a href="https://github.com/w3c/csswg-drafts/pull/12261">Issue 12261</a>)
		</li>
		<li>Clarify that non-absolute colors in override-colors 
			make the whole descriptor invalid, 
			not just the individual color
			(<a href="https://github.com/w3c/csswg-drafts/issues/9555">Issue 9555</a>)
		</li>
		<li>Add left and right to font-style descriptor
			(<a href="https://github.com/w3c/csswg-drafts/issues/9392">Issue 9392</a>)
		</li>
		<li>Add left and right to font-style property
			(<a href="https://github.com/w3c/csswg-drafts/issues/9392">Issue 9392</a>)
		</li>
		<li>Added oblique-only as a value of font-synthesis-style
			(<a href="https://github.com/w3c/csswg-drafts/issues/9390">Issue 9390</a>)
		</li>
		<li>Refered to Cascade 5 for reset-only sub-property, 
			rather than defining it independently
			(<a href="https://github.com/w3c/csswg-drafts/issues/11904">Issue 11904</a>)
		</li>
		<li>Clarified that override-colors are invalid if an absolute color is not specified
			(<a href="https://github.com/w3c/csswg-drafts/issues/9555">Issue 9555</a>)
		</li>
		<li>Fixed typo in Font Feature and Variation Resolution</li>
		<li>Used better fonts for the Khmer example</li>
		<!-- to 22 Jan 2025 -->
		<li>Added generic(khmer-mul)</li>
		<li>Used unicode-range-token instead of urange</li>
		<li>Clarified requirement for user addition/removal of fonts</li>
		<li>Made CSSFontFaceRule.style consistent with other CSS*Rule.style</li>
		<li>Fixed 'font' syntax, simplified font-variant-css2 and font-width-css3 syntaxes</li>
		<li>Restored monospace as generic font family (it had been accidentally deleted)</li>
		<li>Corrected syntax of generic-family</li>
		<li>Improved wording on PostScript names as fragment identifiers for font collections</li>
		<li>Added missing @font-face descriptors</li>
		<li>Used different interfaces for declarations blocks that expose a different set of descriptors or properties</li>
		<li>Updated incremental font example to latest IFT specification</li>
		<li>Defined CSSFontFeatureValuesRule.historicalForms</li>
	</ul>

<h3 id="changes-2021-12-21">
Changes from the <a href="https://www.w3.org/TR/2021/WD-css-fonts-4-20211221/">21 December 2021 Working Draft</a></h3>

	<ul>
		<li>Corrected some broken links</li>
		<li>In font matching algorithm, distinguished use of varfont slnt axis from synthetic obliquing</li>
		<li> Clarified that font variations do not count as font synthesis</li>
		<li>Clarified the effect of auto values on @font-face is to select the appropriate "normal" value</li>
		<li>Improved font fallback on font-variant-emoji with variation selectors</li>
		<li>Clarified that the oblique angle must be the same sign as requested</li>
		<li>Defined synthetic oblique in vertical text</li>
		<li>Used CSS Color 5 absolute color definition for override-colors</li>
		<li>Made font-stretch a legacy name alias for font-width</li>
		<li>The palette-mix() grammar requires color-interpolation-method, so removed leftover prose defining what to do if it is omitted</li>
		<li>Add more generics samples, for fang song and kai</li>
		<li>Listed fonts used for Urdu samples</li>
		<li>Users must be able to modify the set of installed fonts available for rendering web pages</li>
		<li>Added examples of Urdu text in nastaliq and in fallback naskh fonts</li>
		<!-- to  5 Dec 2023 -->
		<li>Clarified that keywords inside local() are an error</li>
		<li>Clarified that the system-ui generic font family may be composite, and is affected by unicode coverage and content language</li>
		<li>Removed culturally specific claims that particular typographic styles universally convey concepts such as formality or playfulness</li>
		<li>Added a new generic(nastaliq) family, for Urdu, Persian, and other languages</li>
		<li>Added a new generic(kai) family, for Simplified and Traditional Chinese</li>
		<li>No longer claim that cursive and kaiti have identical meanings</li>
		<li>Added a note on the historical reasons for the serif and sans-serif generic font families</li>
		<li>Dropped the emoji generic font-family, because the font-variant-emoji property covers the desired functionality better</li>
		<li>Added Internet Media Types to the table of font formats</li>
		<li>Moved the consequences of installed fonts out of Taxonomy and into Font Matching Algorithm</li>
		<li>Clarified that the font-family and src descriptors are no longer required for validity, as they can be added later by script.</li>
		<li>Consistently use generic(fangsong) instead of fangsong, as the generic font family name. Note that it is script-specific</li>
		<li>Defined a third type of font family name, &lt;system-family-name> which has some constraints on how it can be specified</li>
		<li>Added a missing at-keword in the production of @font-feature-values</li>
		<li>Refactored the @font-feature-values grammar</li>
		<li>Restored some acknowlegements which had been dropped when porting CSS Fonts 3 into this specification</li>
		<li>Redefined the grammar of the src attribute to use a &lt;font-src-list> production, rather than "see prose"</li>
		<li>Deleted broken link to an informative reference which no longer exists</li>
		<li>Described three classes of generic font families, including whether they are writing system (script) specific and whether they are always required to match to a locally installed font</li>
		<li>Added a new functional notation, generic(), for new generic font families</li>
		<li>Added a clarifying note about platform API limitations which might restrict color font rendering to sRGB</li>
		<li>Removed leftover, no-longer applicable mention of "forcing colored glyphs not to be used"</li>
		<li>Refined the font-palette computed value</li>
		<li>Added an example of Nabla font with an animated palette</li>
		<li>Described modified font-palette syntax and rules for interpolation
			and percentage normalization, referencing the CSS Color specification</li>
		<li>Clarified that the used color-scheme affects font-palette: normal</li>
		<li>Added missing numeric range annotations for slope angle and font-feature-settings integer</li>
		<li>Defined a production for &lt;family-name> </li>
		<li>For locally installed fonts, used local(&lt;family-name>) </li>
		<li>Fixed ambiguous descriptor auto-links </li>
		<li>Fixed markup of the &lt;family-name> production </li>
		<li>Defined feature and variation names with &lt;opentype-tag> rather than bare strings</li>
		<li>Clarified that general math functions (not just calc) are allowed in @font-palette-values descriptors</li>
		<li>Added the ''font-synthesis-position'' property </li>
		<li>Added an example of a non-sRGB color in override-colors</li>
		<li>Use rule-list rather than stylesheet in productions</li>
		<!-- to 7 Mar 2023 -->
		<li>Added URL request modifiers for crossorigin, referrerpolicy &amp; integrity</li>
		<li>Aligned the incremental tech keywords to match the latest Incremental Font Transfer specification</li>
		<li>Use last-defined value for font-feature-values</li>
		<li>font-feature-values and font-feature-settings are now de-duplicated, and sorted</li>
		<li>Suggested user agents prompt users to make certain user-installed fonts available, or unavailable</li>
		<li>Improved the Privacy Considerations, balancing privacy and legibility trade-offs for user-installed fonts</li>
		<li>Clarified the font shorthand, using the terms set explicitly, reset implicitly and cascade implicitly</li>
		<li>Clarified shorter representation for zero ranged descriptors</li>
		<li>Tightened definition of first available font</li>
		<li>Added emoji as a keyword to unicode-range</li>
		<li>Allowed implementations to ignore requests to turn off font features which the OpenType specification says are always required</li>
		<li>Gave clearer advice to authors about font-feature-settings and font-variation-settings </li>
		<li>Readability improvements to the grammar for font-variant sub-properties</li>
		<li>Corrections to some examples so they again match the specification</li>
		<li>Clarified what it means to ignore an invalid font-family descriptor </li>
		<li>Allowed the font-family descriptor of @font-palette-values to take a list</li>
		<li>Added Web Platform Tests coverage</li>
		<li>'font-palette' and '@font-palette-values' no longer at risk</li>
		<li>Allowed limited set of string-form format specifies, for Web compatibility</li>
		<li>Make feature-* features-* for consistency</li>
		<li>Changed initial value of font-variant-emoji from auto to normal, for consistency with other font-variant-* properties
		<li>Added values from font-variant-emoji to font-variant shorthand
		<li>Added canonical list of font-variant-* properties affected by font-variant shorthand
		<li>Renamed "system font fallback" to "installed font fallback to avoid confusion with system font
		<li>Updated property and descriptor values to use the range notation
		<li>Fixed some examples which did not match the specification
		<li>Clarified that color fonts are not enabled by default
		<li>Added some more explanation to font-palette:light|dark
		<li>Use last declaration of key/palette index in override-colors
		<li>Removed currentColor from override-colors example
		<li>Clarified that out of range palette indexes are ignored
		<li>Assorted typo corrections and markup fixes</li>
	</ul>

<h3 id="changes-2021-07-29">
Changes from the <a href="https://www.w3.org/TR/2021/WD-css-fonts-4-20210729/">29 July 2021 Working Draft</a></h3>

	<ul>
		<!--  to 17 Dec 2021 -->
		<li>Clarified that functions and relative lengths in palettes are evaluated
			within the root element's context</li>
		<li>Added new section, overall changes since CSS Fonts 3</li>
		<li>Added more font-palette-values examples</li>
		<li>Renamed technology to tech</li>
		<!-- to 03 Dec 2021 -->
		<li>New ''font-size/math'' value added to 'font-size'</li>
		<li>Security and Privacy are now separate sections</li>
		<li>Linked to OpenType, TrueType and Graphite table definitions</li>
		<li>Updated examples which had used "supports"</li>
		<li>Removed old "supports" from format in src descriptor, replaced with new technology production</li>
		<li>Moved font-technology & font-format to a new section </li>
		<li>Formalized fetching and resource timing reporting, applied to fetching fonts</li>
		<li>Removed the &lt;string> values from override-color and base-palette</li>
		<li>Defined correct processing of conflicting override-colors</li>
		<li>Introduced concept of complete palettes</li>
		<li>Clearer description of override-colors</li>
		<li>Removed conflict between FONT_PALETTE_VALUES_RULE and VIEWPORT_RULE</li>
		<li>Defined context for resolving override-color colors, no longer per-element</li>
		<li>Allowed base-palette to reference dark and light palettes</li>
		<li>Changed properties in CSSFontPaletteValuesRule to be read-only</li>
		<li>The palette-identifier parses as a dashed-ident rather than custom-ident, for extensibility</li>
		<li>Renamed override-color descriptor to override-colors, because it accepts a list of colors</li>
		<li>Clarified that base-palette and override-color take non-negative integers</li>
		<li>Corrected grammar of the font shorthand property</li>
		<li>Several corrections to the IDL for CSSFontPaletteValuesRule</li>
		<li>Removed the "none" value from font-palette </li>
		<!-- to 16 Aug 2021 -->
		<li>Clarified incremental requirement</li>
		<li>A few more examples</li>
		<li>Added incremental font technology to supports</li>
		<li>Reduced the critical angle for oblique font matching from 20deg to 11deg, per WG resolution</li>
		<li>Allowed font-display in @font-feature-values (the prose allowed it but the grammar did not)</li>
	</ul>

<h3 id="changes-2020-11-17">
Changes from the <a href="https://www.w3.org/TR/2020/WD-css-fonts-4-20201117/">17 November 2020 Working Draft</a></h3><!-- See https://github.com/w3c/csswg-drafts/commits/main/css-fonts-4/Overview.bs -->
<!-- new ones at the top -->

	<ul>
		<li>Added Graphite reference</li>
		<li>Added font feature technology keywords opentype, aat, and graphite</li>
		<!-- to 9 June 2021 -->
		<li>Removed scary wording about variable fonts being new and experimental</li>
		<li>Reference to CSS Fonts 3 in introduction is informative</li>
		<li>Differentiated COLRv1 from COLRv0</li>
		<li>Clarify well-designed vs badly-designed icon fonts in terms of Unicode codepoints</li>
		<li>Added Accessibility Considerations section</li>
		<li>Clarified that font-optical-sizing interacts with font-size-adjust</li>
		<li>Used consistent capitalization for "user agent"</li>
		<li>Clarified that font-stretch should serialize to a number/percentage, not a keyword</li>
		<li>Suggested heuristics for loading ''font-display/optional'' fonts</li>
		<li>Clarified repeated items in grammars</li>
		<li>Replaced obsolete “potentially CORS-enabled fetch” with reference to Fetch</li>
		<li>Added missing small-caps value to font-synthesis</li>
		<li>Be explicit about which properties apply to text</li>
		<li>Updated links</li>
		<li>Fixed typos, syntax errors</li>
	</ul>

<h3 id="changes-2019-11-13">
Changes from the <a href="https://www.w3.org/TR/2019/WD-css-fonts-4-20191113/">13 November 2019 Working Draft</a></h3>

	<ul>
		<!-- to Nov 12 2020 -->
		<li>Clarified that JS-free probing of Unicode support of fonts is possible</li>
		<li>Clarified OpenType feature tags are 4 characters, trailing-space padded</li>
		<li>Added font metric override descriptors</li>
		<li>Added link to font features enabled by default</li>
		<li>Aligned with ebIDL specification (undefined, not void)</li>
		<li>Corrected cross-origin example to use http not https</li>
		<li>Clarified that font-range, per OpenType, is between 1 and 999</li>
		<li>(Privacy) added mention of unicode-range privacy exploit</li>
		<li>Clarified use of kern vs. vkrn</li>
		<li>Added font collection format, example of Font Collection</li>
		<li>Added CBDT color fonts</li>
		<li>Added Security &amp; Privacy appendix</li>
		<li>Added palette examples, including dark mode</li>
		<li>Clarified colorspace of font palette entries</li>
		<li>Avoiding cross-site font leakage amde RFC-2119 MUST</li>
		<li>Clarified monochromatic fallback on color fonts</li>
		<li>Removed remaining references to min-font-size, max-font-size</li>
		<li>Clarified that color names are ASCII case insensitive</li>
		<li>Added the value none to font-palette</li>
		<li>Marked font-palette and @font-palette-values as at-risk</li>
		<li>Aligned value definition reference across all specs.</li>
		<li>Further clarified the behavior of ''font-display/optional''</li>
		<li>Clarified that not all generic font families have to map to a font</li>
		<li>Reorganized generic font family introduction</li>
		<li>Added some motivation for generic font families</li>
		<li>Added a note about the generic emoji family and character support</li>
		<li>Clarified that italic is not a fallback for oblique </li>
		<li>Added warning on too large x-height</li>
		<li>Added better example for 'font-size-adjust'</li>
		<li>Added example for ui-sans-serif </li>
		<li>Miscellaneous editorial improvements, typo fixes, broken link fixes and markup improvements</li>
	</ul>

<h3 id="changes-2018-09-20">
Changes from the <a href="https://www.w3.org/TR/2018/WD-css-fonts-4-20180920/">20 September 2018 Working Draft</a></h3>

	<ul>
		<li>Add note encouraging UAs to also implement platform-specific names for standard font families</li>
		<li>Add ui-serif, ui-sans-serif, ui-monospace, and ui-rounded generic font families</li>
		<li>Remove font-variant @font-face descriptor per WG resolution</li>
		<li>Remove font-min-size and font-max-size per WG resolution</li>
		<li>Clarify that font-style ''font-style/normal'' animates as ''oblique 0deg''</li>
		<li>Clarify why specifying incomplete color palettes for compound fonts is a bad idea</li>
		<li>Add explicit [Exposed=Window] on interfaces</li>
		<li>Use correct terms, Unicode emoji presentation sequence and Emoji Presentation Participating Code Points</li>
		<li>Clarify that each string in font-variation-settings is paired with a single number</li>
		<li>Remove stray titling-caps from definition of font-variant-numeric property</li>
		<li>Better introduction to color fonts</li>
		<li>Add basic multicolor example</li>
		<li>Clarify that font variation settings do no affect font selection of fallback fonts</li>
		<li>Clarify italic angle wrt direction of slnt axis</li>
		<li>Better define emoji and math generic font families</li>
		<li>Add font-size: xxx-large </li>
		<li>Link to CSS Values definition of ex units</li>
		<li>Add scientific inferiors example of font-feature-settings</li>
		<li>Clarify that letter-spacing disables optional ligatures</li>
		<li>Port font-feature-settings property from CSS Fonts 3</li>
		<li>Port font-variant shorthand property from CSS Fonts 3</li>
		<li>Port font-variant-east-asian property from CSS Fonts 3</li>
		<li>Port font-variant-numeric property from CSS Fonts 3</li>
		<li>Port font-variant-caps property from CSS Fonts 3</li>
		<li>Port font-variant-position property from CSS Fonts 3</li>
		<li>Port font-variant-ligatures property from CSS Fonts 3</li>
		<li>Port font-kerning property from CSS Fonts 3</li>
		<li>Update IDL of The CSSFontPaletteValuesRule interface</li>
		<li>Changed initial value of font property descriptors from normal to auto</li>
		<li>Update syntax for font-stretch in font matching section</li>
		<li>Update font style matching examples </li>
		<li>Clarify description of font palettes</li>
		<li>Stop claiming that ''ch'' uses the first available font</li>
		<li>Assorted formatting and markup fixes, link fixes, removal of inline closed issues</li>
		<li>Linking to latest versions of normative references</li>
	</ul>

<h3 id="changes-2018-04-10">
Changes from the <a	href="https://www.w3.org/TR/2018/WD-css-fonts-4-20180410/">10 April 2018 Working Draft</a></h3>

	<ul>
		<!-- last update 2018 Sept 16 -->

		<li>Added unicode value to font-variant-emoji</li>
		<li>Removed the media entry from property descriptions</li>
		<li>Broke up font-synthesis into longhands, for future extensibility</li>
		<li>Added override-color descriptor for color palettes</li>
		<li>Defined feature-value-name for font-variant-alternates </li>
		<li>Clarified @font-face src parsing rules</li>
		<li>Allow named instances from variable fonts to be used </li>
		<li>Appendix A: Mapping platform font properties to CSS properties ported over from CSS Fonts 3</li>
		<li>Character handling issues ported over from CSS Fonts 3</li>
		<li>Cluster matching ported over from CSS Fonts 3</li>
		<li>Add new auto value for font-weight, font-style and font-stretch descriptors</li>
		<li>Clarified font-display descriptor value names</li>
		<li>Support named palette entries</li>
		<li>More details on Fang Song generic family</li>
		<li>Changed default angle of oblique fonts to 14deg.</li>
		<li>font-feature-values ported over from CSS Fonts 3</li>
		<li>Clarified handling of unknown or unsupported fragment identifiers</li>
		<li>Clarified that color records in font palettes are zero-indexed</li>
		<li>Consistently use the new generic font families</li>
		<li>Editorial cleanup, clarifying examples, markup improvements, linkfixes,
			updating to latest references, and so on</li>
	</ul>

<h3 id="changes-fonts-3">
Changes from the 20 September 2018 <a href="https://www.w3.org/TR/2018/REC-css-fonts-3-20180920/">CSS Fonts 3 Recommendation</a></h3>

	This summarizes the changes in CSS Fonts 4, compared to CSS Fonts 3.
	<!--
		to 13 Dec 2021 see
		https://github.com/w3c/csswg-drafts/issues/6882
	-->

	<ul>
		<li>Added font-display descriptor for @font-face</li>
		<li>Added @font-feature-values rule</li>
		<li>Added font variation properties, including font-optical-sizing and font-variation-settings</li>
		<li>Added color font support</li>
		<li>Defined feature-value-name for font-variant-alternates</li>
		<li>Added new auto value for font-weight, font-style and font-stretch descriptors</li>
		<li>Added ui-serif, ui-sans-serif, ui-monospace, and ui-rounded generic font families</li>
		<li>Added font-size: xxx-large</li>
		<li>Added font metric override descriptors</li>
		<li>Added some motivation for generic font families</li>
		<li>Added font feature technology keywords opentype, aat, and graphite</li>
		<li>Added math value to font-size</li>
	</ul>

<!--
	Avoid crash tests :)
-->

<wpt hidden>
	crash-font-face-invalid-descriptor.html
	crash-large-grapheme-cluster.html
	font-face-local-css-wide-keyword-crash.html
	infinite-size-crash.html
	math-script-level-and-math-style/math-depth-001-crash.html
	font-features-two-stylesheets-crash.html
	variable-in-feature-crash.html
</wpt>

<!--
	Also tests where it is completely unclear
	what spec section, if any, they are testing.
-->

<wpt hidden>
	font-size-monospace-adjust.html
	discrete-no-interpolation.html
	separators.html
	font-size-adjust-generic-font-fallback-crash.html
	font-size-adjust-nan-crash.html
	size-adjust-unicode-range-system-fallback.html
	font-size-adjust-text-orientation.html
</wpt>

<!--
	CSS Fonts 5 tests
-->

<wpt hidden>
	animations/font-size-adjust-composition.html
	animations/font-size-adjust-interpolation.html
	font-size-adjust-013.html
	font-size-adjust-014.html
	font-size-adjust-ic-height.html
	font-size-adjust-metrics-override.html
	font-size-adjust-text-orientation.html
	font-size-adjust-units-001.html
	parsing/font-size-adjust-computed.html
	parsing/font-size-adjust-invalid.html
	parsing/font-size-adjust-valid.html
	size-adjust-01.html
	size-adjust-02.html
	size-adjust-03.html
	ascent-descent-override.html
	line-gap-override.html
	metrics-override-normal-keyword.html
</wpt>

<!--
	WPT backlog. Add these to the appropriate sections.
	Hidden for now so bikeshed gives less warnings.
-->
<wpt hidden>
	rcap-in-monospace.html
	rch-in-monospace.html
	rex-in-monospace.html
	ric-in-monospace.html
	rlh-in-monospace.html
</wpt>

<!--
	WPT references that Bikeshed nags about but shouldn't actually be here.
	Hidden for now so bikeshed gives less warnings.
-->
<wpt hidden>
	font-size-zero-1-ref.html
</wpt>
