E84D updated font-feature-settings syntax · w3c/csswg-drafts@19c3530 · GitHub
Skip to content

Commit 19c3530

Browse files
author
John Daggett
committed
updated font-feature-settings syntax
1 parent 57e9f05 commit 19c3530

1 file changed

Lines changed: 68 additions & 55 deletions

File tree

css3-fonts/Fonts.html

Lines changed: 68 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -111,14 +111,14 @@
111111

112112
<h1>CSS Fonts Module Level 3</h1>
113113

114-
<h2 class="no-num no-toc" id=editors>Editor's Draft 3 March 2011</h2>
114+
<h2 class="no-num no-toc" id=editors>Editor's Draft 4 March 2011</h2>
115115

116116
<dl id=authors>
117117
<dt>This version:
118118

119119
<dd><a
120120
href="http://dev.w3.org/csswg/css3-fonts/">http://dev.w3.org/csswg/css3-fonts/</a>
121-
<!-- <dd><a href="http://www.w3.org/TR/2011/ED-css3-fonts-20110303">http://www.w3.org/TR/2011/ED-css3-fonts-20110303</a> -->
121+
<!-- <dd><a href="http://www.w3.org/TR/2011/ED-css3-fonts-20110304">http://www.w3.org/TR/2011/ED-css3-fonts-20110304</a> -->
122122

123123

124124
<dt>Latest version:
@@ -4191,7 +4191,7 @@ <h3 id=font-feature-settings-prop><span class=secno>6.12 </span>Low-level
41914191
<tr>
41924192
<td>Value:
41934193

4194-
<td>normal | &lt;string&gt;
4194+
<td>normal | [&lt;featuretag&gt;]+
41954195

41964196
<tr>
41974197
FBC8 <td>Initial:
@@ -4223,54 +4223,76 @@ <h3 id=font-feature-settings-prop><span class=secno>6.12 </span>Low-level
42234223

42244224
<td>as specified
42254225
</table>
4226-
<!-- ...they are not well-suited for use in a general use property. -->
4227-
4228-
<p>This property provides low-level control over font features. It is
4229-
intended as a way of providing access to font features that are not widely
4230-
used but are needed for a particular use case. A value of ‘<code
4231-
class=property>normal</code>’ means that no change in rendering occurs
4232-
due to this property while a string value defines a specific set of font
4233-
settings to be used when rendering. A null string is equivalent to
4234-
specifying a value of ‘<code class=property>normal</code>’. This
4235-
property only affects font rendering, its value does not affect font
4236-
selection.
4237-
4238-
<p>The string used is specific to the type of font used. For OpenType
4239-
fonts, the value of ‘<code class=css>&lt;string&gt;</code>’ is a
4240-
comma-separated list of &lt;feature-name&gt;=&lt;integer&gt; paired
4241-
values, where ‘<code class=css>&lt;feature-name&gt;</code>’ is the
4242-
case-sensitive name of an OpenType feature defined in <a
4226+
4227+
<p>This property provides low-level control over OpenType font features. It
4228+
is intended as a way of providing access to font features that are not
4229+
widely used but are needed for a particular use case. A value of ‘<code
4230+
class=property>normal</code>’ means that no change in glyph selection or
4231+
positioning occurs due to this property.
4232+
4233+
<p>
4234+
4235+
<pre>/* enable small caps and use second swash alternate */
4236+
font-feature-settings: smcp swsh(2);</pre>
4237+
4238+
<p>Feature tags are used with the following syntax:
4239+
4240+
<pre
4241+
class=prod><dfn id=ltfeaturetaggt><var>&lt;featuretag&gt;</var></dfn> = [ot-]ident[( &lt;integer&gt; | on | off )]?</pre>
4242+
4243+
<p>The identifier indicates a case-sensitive OpenType feature tag. For it
4244+
to match an OpenType feature contained in a font, it must follow the
4245+
syntax rules for tags. OpenType feature tags that are not valid CSS
4246+< FF8 div class="diff-text-inner"> identifiers or conflict with CSS keywords must be prefixed with ‘<code
4247+
class=property>ot-</code>’. In this case the ‘<code
4248+
class=property>ot-</code>’ prefex is removed and the remaining portion
4249+
of the identifier is used to lookup the feature tag in the font. Feature
4250+
tags need only match a feature tag defined in the font, they are not
4251+
limited to explicitly registered OpenType features. Fonts defining custom
4252+
feature tags should follow the <a
4253+
href="http://www.microsoft.com/typography/otspec/featuretags.htm">tag name
4254+
rules</a> defined in the OpenType specification <a
42434255
href="#OPENTYPE-FEATURES"
4244-
rel=biblioentry>[OPENTYPE-FEATURES]<!--{{!OPENTYPE-FEATURES}}--></a> and
4245-
<code class=css>&lt;integer&gt;</code>’ is 0 or a positive integer.
4246-
For OpenType features that are boolean in nature, a value of 0 disables
4247-
the feature and a non-zero value enables the feature. Value pairs that
4248-
refer to non-existent features or use values not appropriate for the
4249-
feature are ignored. Whitespace within the string is ignored.
4256+
rel=biblioentry>[OPENTYPE-FEATURES]<!--{{!OPENTYPE-FEATURES}}--></a>.
4257+
Feature tags not present in the font are ignored; a user agent must not
4258+
attempt to synthesize fallback behavior based on these feature tags.
4259+
4260+
<p>If present, a value in parentheses indicates an index used for glyph
4261+
selection. An &lt;integer&gt; value must be 0 or greater. A value of 0
4262+
indicates that the feature is disabled. For boolean features, a value of 1
4263+
enables the feature. For non-boolean features, a value of 1 or greater
4264+
enables the feature and indicates the feature selection index. A value of
4265+
<code class=property>on</code>’ is synonymous with 1 and ‘<code
4266+
class=property>off</code>’ is synonymous with 0. If the value in
4267+
parentheses is omitted, a value of 1 is assumed.
4268+
4269+
<pre>
4270+
font-feature-settings: dlig(1); /* dlig=1 enable discretionary ligatures */
4271+
font-feature-settings: smcp(on); /* smcp=1 enable small caps */
4272+
font-feature-settings: ot-c2sc; /* c2sc=1 enable caps to small caps */
4273+
font-feature-settings: liga(off); /* liga=0 no common ligatures */
4274+
font-feature-settings: tnum hist; /* tnum=1, hist=1 enabled tabular numbers and historical forms */
4275+
font-feature-settings: 3piX(1); /* invalid syntax, feature tag not identifier */
4276+
font-feature-settings: ot-3piX; /* 3piX=1 (this feature not defined) */
4277+
font-feature-settings: PKRN; /* PKRN=1 enable custom feature */
4278+
</pre>
42504279

42514280
<p>Authors should generally use ‘<code class=property><a
42524281
href="#propdef-font-variant">font-variant</a></code>’ and its related
42534282
subproperties whenever possible and only use this property for special
42544283
cases where its use is the only way of accessing a particular infrequently
4255-
used font feature.</p>
4256-
<!--
4284+
used font feature.
42574285

4258-
Substitute epigraphy example below.
4259-
4260-
Scholars studying Greek coin inscriptions often come across many
4261-
different variations for individual Greek letters found on ancient
4262-
coinage. Using a font containing character variants found in these
4263-
inscriptions, an author can describe precisely the appearance of
4264-
the underlying Greek text without using Unicode private-user codepoints.
4265-
4266-
-->
4286+
<p>Although specifically defined for OpenType feature tags, feature tags
4287+
for other modern font formats that support font features may be added in
4288+
the future.
42674289

42684290
<div class=example>
42694291
<p>The Japanese text below will be rendered with half-width kana
42704292
characters:</p>
42714293

42724294
<pre lang=ja>
4273-
body { font-feature-settings: "hwid=1"; /* Half-width OpenType feature */ }
4295+
body { font-feature-settings: hwid; /* Half-width OpenType feature */ }
42744296

42754297
&lt;p>毎日<a href="http://images.google.com/images?q=%E3%82%AB%E3%83%AC%E3%83%BC" style="text-decoration: none;">カレー</a>食べてるのに、飽きない&lt;/p>
42764298
</pre>
@@ -4686,10 +4708,8 @@ <h3 class=no-num id=recent-changes> Changes from the <a
46864708

46874709
<li>Revised font matching algorithm
46884710

4689-
<li>Added font-weight-synthetic, font-style-synthetic properties
4690-
4691-
<li>Added specific requirements and guidelines for dealing with OpenType
4692-
names
4711+
<li>Added font-weight-synthetic, font-style-synthetic properties</li>
4712+
<!-- Added specific requirements and guidelines for dealing with OpenType names -->
46934713
</ul>
46944714

46954715
<h2 class=no-num id=acknowledgments>Acknowledgments</h2>
@@ -4989,6 +5009,9 @@ <h2 class=no-num id=index>Index</h2>
49895009
<li><var>&lt;feature-index&gt;</var>, <a href="#ltfeature-indexgt"
49905010
title="&lt;feature-index&gt;"><strong>6.9</strong></a>
49915011

5012+
<li><var>&lt;featuretag&gt;</var>, <a href="#ltfeaturetaggt"
5013+
title="&lt;featuretag&gt;"><strong>6.12</strong></a>
5014+
49925015
<li><var>&lt;feature-value-list&gt;</var>, <a
49935016
href="#ltfeature-value-listgt"
49945017
title="&lt;feature-value-list&gt;"><strong>6.9</strong></a>
@@ -5294,7 +5317,7 @@ <h2 class=no-num id=property-index>Property index</h2>
52945317
<td><a class=property
52955318
href="#propdef-font-feature-settings">font-feature-settings</a>
52965319

5297-
<td>normal | &lt;string&gt;
5320+
<td>normal | [&lt;featuretag&gt;]+
52985321

52995322
<td>normal
53005323

@@ -5448,8 +5471,8 @@ <h2 class=no-num id=property-index>Property index</h2>
54485471

54495472
<td>normal | inherit | [ &lt;contextual-alt-values&gt; ||
54505473
stylistic(&lt;feature-value-name&gt;) || historical-forms ||
5451-
styleset(&lt;;feature-value-name&gt; [, &lt;feature-value-name&gt;]*)
5452-
|| character-variant(&lt;feature-value-name&gt;
5474+
styleset(&lt;feature-value-name&gt; [, &lt;feature-value-name&gt;]*) ||
5475+
character-variant(&lt;feature-value-name&gt;
54535476
[,&lt;feature-value-name&gt;]*) || swash(&lt;feature-value-name&gt;) ||
54545477
contextual-swash(&lt;feature-value-name&gt;) ||
54555478
ornament(&lt;feature-value-name&gt;) ||
@@ -5609,18 +5632,8 @@ <h2 class=no-num id=property-index>Property index</h2>
56095632
56105633
to do:
56115634
5612-
- rework intro to font features
5613-
- describe how font-variant values do *not* apply for system-wide fallback
5614-
- rework syntax of font-feature-settings
5615-
- define on/off as aliases for 1/0 when numeric selectors are used for font-feature-settings
5616-
- wording for superscript/subscript handling
56175635
- wordi 5B77 ng of OpenType family name handling
5618-
- font-stretch matching
56195636
- handling combining sequences in the font matching algorithm
56205637
- fix-up fi ligature example
56215638
5622-
done:
5623-
5624-
* add character-variant
5625-
56265639
-->

0 commit comments

Comments
 (0)