Skip to content

Commit 5cd13bb

Browse files
committed
[css-fonts-4] Move font-feature-settings from CSS Fonts 4 w3c#1653
1 parent 6a6133b commit 5cd13bb

File tree

1 file changed

+150
-1
lines changed

1 file changed

+150
-1
lines changed

css-fonts-4/Overview.bs

Lines changed: 150 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4717,7 +4717,155 @@ to their initial values.</p>
47174717
or <span title="font-variation-settings!!property">'font-variation-settings!!property'</span>.</p>
47184718

47194719
<h3 id="font-feature-settings-prop">
4720-
Low-level font feature settings control: the 'font-feature-settings' property</h3>
4720+
Low-level font feature settings control: the 'font-feature-settings!!property' property</h3>
4721+
4722+
4723+
<pre class="propdef">
4724+
Name: font-feature-settings
4725+
4726+
Value: normal | <<feature-tag-value>> #
4727+
Initial: normal
4728+
Applies to: all elements
4729+
Inherited: yes
4730+
Percentages: n/a
4731+
Computed value: as specified
4732+
Animation type: discrete
4733+
</pre>
4734+
4735+
<p>This property provides
4736+
low-level control over OpenType font features.
4737+
It is intended as a way of providing access
4738+
to font features
4739+
that are not widely used
4740+
but are needed for a particular use case.
4741+
4742+
<p class="advisement">Authors should generally
4743+
use <span title="font-variant!!property">'font-variant!!property'</span>
4744+
and its related subproperties
4745+
whenever possible
4746+
and only use this property
4747+
for special cases
4748+
where its use is the only way
4749+
of accessing
4750+
a particular infrequently used font feature.</p>
4751+
4752+
<div class="example">
4753+
<pre>/* enable small caps and use second swash alternate */
4754+
font-feature-settings: "smcp", "swsh" 2;</pre>
4755+
</div>
4756+
4757+
<p>A value of
4758+
<dfn id="font-feature-settings-normal-value" dfn-for="font-feature-settings" dfn-type="value"
4759+
title="normal!!font-feature-settings">''font-feature-settings/normal''</dfn>
4760+
means that no change
4761+
in glyph selection or positioning
4762+
occurs due to this property.</p>
4763+
4764+
<p>Feature tag values have the following syntax:</p>
4765+
4766+
<pre class="prod"><dfn dfn-for="font-feature-settings" dfn-type="value" id="feature-tag-value"><var>&lt;feature-tag-value&gt;</var></dfn> = &lt;string&gt; [ &lt;integer&gt; | on | off ]?</pre>
4767+
4768+
<p>The &lt;string&gt; is a case-sensitive OpenType feature tag.
4769+
As specified in the OpenType specification [[!OPENTYPE]],
4770+
feature tags contain four ASCII characters.
4771+
Tag strings longer or shorter than four characters,
4772+
or containing characters outside the U+20&ndash;7E codepoint range
4773+
are invalid.
4774+
<!-- and what happens? ignored?
4775+
they won't be found in the font anyway, so the next section applies -->
4776+
Feature tags need only match
4777+
a feature tag defined in the font,
4778+
so they are not limited to
4779+
explicitly registered OpenType features.
4780+
Fonts defining custom feature tags
4781+
should follow the
4782+
<a href="https://www.microsoft.com/typography/otspec/featuretags.htm">tag name rules</a>
4783+
defined in the OpenType specification [[!OPENTYPE-FEATURES]].
4784+
4785+
<p id="must-not-synthesize-features">Feature tags
4786+
not present in the font are ignored;
4787+
a user agent must not attempt to synthesize fallback behavior
4788+
based on these feature tags.
4789+
The one exception is that
4790+
user agents may synthetically support the <span class="tag">kern</span> feature
4791+
with fonts that contain kerning data in the form of a 'kern' table
4792+
but lack <span class="tag">kern</span> feature support
4793+
in the 'GPOS' table.</p>
4794+
4795+
<p class="note">In general, authors should
4796+
use the 'font-kerning' property
4797+
to explicitly enable or disable kerning
4798+
since this property always affects fonts
4799+
with either type of kerning data.</p>
4800+
4801+
<p>If present,
4802+
a value indicates an index used for glyph selection.
4803+
An &lt;integer&gt; value must be 0 or greater.
4804+
A value of 0 indicates that the feature is disabled.
4805+
For boolean features,
4806+
a value of 1 enables the feature.
4807+
For non-boolean features,
4808+
a value of 1 or greater enables the feature
4809+
and indicates the feature selection index. A
4810+
value of 'on' is synonymous with 1
4811+
and 'off' is synonymous with 0.
4812+
If the value is omitted, a value of 1 is assumed.
4813+
</p>
4814+
4815+
<p id="ffs-map">The computed value
4816+
of font-feature-settings is a map,
4817+
so any duplicates in the specified value
4818+
must not be preserved.
4819+
If the same axis name appears more than once,
4820+
the value associated with the last appearance supersedes
4821+
any previous value for that axis.</p>
4822+
4823+
<div class="example">
4824+
<pre>
4825+
font-feature-settings: "dlig" 1; /* dlig=1 enable discretionary ligatures */
4826+
font-feature-settings: "smcp" on; /* smcp=1 enable small caps */
4827+
font-feature-settings: 'c2sc'; /* c2sc=1 enable caps to small caps */
4828+
font-feature-settings: "liga" off; /* liga=0 no common ligatures */
4829+
font-feature-settings: "tnum", 'hist'; /* tnum=1, hist=1 enable tabular numbers and historical forms */
4830+
font-feature-settings: "tnum" "hist"; /* invalid, need a comma-delimited list */
4831+
font-feature-settings: "silly" off; /* invalid, tag too long */
4832+
font-feature-settings: "PKRN"; /* PKRN=1 enable custom feature */
4833+
font-feature-settings: dlig; /* invalid, tag must be a string */
4834+
</pre>
4835+
</div>
4836+
4837+
<p>When values greater than the range
4838+
supported by the font
4839+
are specified,
4840+
the behavior is explicitly undefined.
4841+
For boolean features, in general these will enable the feature.
4842+
For non-boolean features,
4843+
out of range values will in general
4844+
be equivalent to a 0 value.
4845+
However,
4846+
in both cases the exact behavior
4847+
will depend upon the way the font is designed
4848+
(specifically, which type of lookup is used
4849+
to define the feature).</p>
4850+
4851+
<p>Although specifically defined for OpenType feature tags,
4852+
feature tags for other modern font formats
4853+
that support font features
4854+
may be added in the future.
4855+
Where possible,
4856+
features defined for other font formats
4857+
should attempt to follow
4858+
the pattern of registered OpenType tags.</p>
4859+
4860+
<div class="example">
4861+
<p>The Japanese text below will be rendered with half-width kana characters:</p>
4862+
4863+
<pre lang="ja">
4864+
body { font-feature-settings: "hwid"; /* Half-width OpenType feature */ }
4865+
4866+
&lt;p>毎日<a href="https://example.com/?q=%E3%82%AB%E3%83%AC%E3%83%BC" style="text-decoration: none;">カレー</a>食べてるのに、飽きない&lt;/p>
4867+
</pre>
4868+
</div>
47214869

47224870

47234871
<h3 id="font-language-override-prop">Font language override: the 'font-language-override' property</h3>
@@ -5879,6 +6027,7 @@ Changes
58796027
<!-- new ones at the top -->
58806028

58816029
<ul>
6030+
<li>Port font-feature-settings property from CSS Fonts 3</li>
58826031
<li>Port font-variant shorthand property from CSS Fonts 3</li>
58836032
<li>Port font-variant-east-asian property from CSS Fonts 3</li>
58846033
<li>Port font-variant-numeric property from CSS Fonts 3</li>

0 commit comments

Comments
 (0)