Please note, this is a STATIC archive of website developer.mozilla.org from 03 Nov 2016, cach3.com does not collect or store any user information, there is no "phishing" involved.

Revision 676097 of @font-feature-values

  • Revision slug: Web/CSS/@font-feature-values
  • Revision title: @font-feature-values
  • Revision id: 676097
  • Created:
  • Creator: HTMLValidator
  • Is current revision? No
  • Comment Fixed comma syntax in two comments

Revision Content

{{CSSRef}}

Summary

The @font-feature-values CSS at-rule allows authors to use a common name in {{cssxref("font-variant-alternate")}} for feature activated differently in OpenType. It allows to simplify the CSS when using several fonts.

@font-feature-values Font One { /* How to activate nice-style in Font One */  @styleset {
    nice-style: 12;
  }
}
 
@font-feature-values Font Two { /* How to activate nice-style in Font Two */
  @styleset {
    nice-style: 4;
  }
} 

…

.nice-look { font-variant-alternate: styleset(nice-style); } /* Independent of the font */

The @font-feature-values at-rule may be used at the top level of a CSS, but also inside any CSS conditional-group at-rule.

Syntax

@font-feature-values <font-family> {
      [  @swash | @ornaments | @annotation | @stylistic | @styleset | @character-variant 
        {
           [ <IDENT>: <integer>+ ]?
        } 
      ]?
}

At-rules

Example

TBD

@swash
Specifies a feature name that will work with the {{cssxref("font-variant-alternates", "swash()", "#swash()")}} functional notation of {{cssxref("font-variant-alternates")}}. A swash feature value definition allows only one value: ident1: 2 is valid when ident2: 2 4 isn't.
@annotation
Specifies a feature name that will work with the {{cssxref("font-variant-alternates", "annotation()", "#annotation()")}} functional notation of {{cssxref("font-variant-alternates")}}. An annotation feature value definition allows only one value: ident1: 2 is valid when ident2: 2 4 isn't.
@ornaments
Specifies a feature name that will work with the {{cssxref("font-variant-alternates", "ornaments()", "#ornaments()")}} functional notation of {{cssxref("font-variant-alternates")}}. An ornaments feature value definition allows only one value: ident1: 2 is valid when ident2: 2 4 isn't.
@stylistic
Specifies a feature name that will work with the {{cssxref("font-variant-alternates", "stylistic()", "#stylistic()")}} functional notation of {{cssxref("font-variant-alternates")}}. A stylistice feature value definition allows only one value: ident1: 2 is valid when ident2: 2 4 isn't.
@styleset
Specifies a feature name that will work with the {{cssxref("font-variant-alternates", "styleset()", "#styleset()")}} functional notation of {{cssxref("font-variant-alternates")}}. A stylset feature value definition allows and illimited amount of values: ident1: 2 4 12 1maps to the OpenType values ss02, ss04, ss12, ss01. Note that values higher than 99 are valid, but doesn't map to any OpenType values and are ignored.
@character-variant
Specifies a feature name that will work with the {{cssxref("font-variant-alternates", "character-variant()", "#character-variant()")}} functional notation of {{cssxref("font-variant-alternates")}}. A character-variant feature value definition allows one or two values: ident1: 2  maps to cv02=1 and ident2: 2 4 maps to cv02)4 and ident2: 2 4 5 isn't valid.

Specifications

Specification Status Comment
{{SpecName('CSS3 Fonts', '#propdef-font-variant', 'font-variant')}} {{Spec2('CSS3 Fonts')}} Initial definition

Browser compatibility

{{CompatibilityTable}}
Feature Chrome Firefox (Gecko) Internet Explorer Opera Safari (WebKit)
Basic support {{CompatUnknown}} {{CompatGeckoDesktop("34")}} [1] {{CompatUnknown}} {{CompatUnknown}} {{CompatUnknown}}
Feature Android Firefox Mobile (Gecko) IE Phone Opera Mobile Safari Mobile
Basic support {{CompatUnknown}} {{CompatGeckoMobile("34")}} [1] {{CompatUnknown}} {{CompatUnknown}} {{CompatUnknown}}

[1] Experimental implementation of the CSS Fonts Level 3 extensions was available since Gecko 24. It was governed by the preference layout.css.font-features.enabled defaulting to true on Nightly and Aurora only.

See also

  • The {{cssxref("font-variant-alternates")}} property that uses values that this at-rule defines.
  • {{CSS_Reference:Fonts}}

Revision Source

<div>
 {{CSSRef}}</div>
<h2 id="Summary">Summary</h2>
<p>The <code>@font-feature-values</code> <a href="/en-US/docs/Web/CSS" title="CSS">CSS</a> <a href="/en-US/docs/Web/CSS/At-rule" title="At-rule">at-rule</a> allows authors to use a common name in {{cssxref("font-variant-alternate")}} for feature activated differently in OpenType. It allows to simplify the CSS when using several fonts.</p>
<pre class="brush: css">
@font-feature-values Font One { /* How to activate nice-style in Font One */  @styleset {
    nice-style: 12;
  }
}
 
@font-feature-values Font Two { /* How to activate nice-style in Font Two */
  @styleset {
    nice-style: 4;
  }
} 

…

.nice-look { font-variant-alternate: styleset(nice-style); } /* Independent of the font */
</pre>
<p>The <code>@<code>font-feature-values</code></code> at-rule may be used at the top level of a CSS, but also inside any <a href="/en-US/docs/Web/CSS/At-rule#Conditional_Group_Rules" title="CSS/At-rule#Conditional_Group_Rules">CSS conditional-group at-rule</a>.</p>
<h2 id="Syntax">Syntax</h2>
<pre>
@font-feature-values &lt;font-family&gt; {
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[  @swash | @ornaments | @annotation | @stylistic | @styleset | @character-variant 
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[ &lt;IDENT&gt;: &lt;integer&gt;+ ]?
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;} 
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;]?
}
</pre>
<h3 id="At-rules">At-rules</h3>
<h2 id="Example">Example</h2>
<p>TBD</p>
<dl>
 <dt>
  <a name="@swash"><code>@swash</code></a></dt>
 <dd>
  Specifies a feature name that will work with the {{cssxref("font-variant-alternates", "swash()", "#swash()")}} functional notation of {{cssxref("font-variant-alternates")}}. A swash feature value definition allows only one value: <code>ident1: 2</code> is valid when <code>ident2: 2 4</code> isn't.</dd>
 <dt>
  <a name="@annotation"><code>@annotation</code></a></dt>
 <dd>
  Specifies a feature name that will work with the {{cssxref("font-variant-alternates", "annotation()", "#annotation()")}} functional notation of {{cssxref("font-variant-alternates")}}. An annotation feature value definition allows only one value: <code>ident1: 2</code> is valid when <code>ident2: 2 4</code> isn't.</dd>
 <dt>
  <a name="@ornaments"><code>@ornaments</code></a></dt>
 <dd>
  Specifies a feature name that will work with the {{cssxref("font-variant-alternates", "ornaments()", "#ornaments()")}} functional notation of {{cssxref("font-variant-alternates")}}. An ornaments feature value definition allows only one value: <code>ident1: 2</code> is valid when <code>ident2: 2 4</code> isn't.</dd>
 <dt>
  <a name="@stylistic"><code>@stylistic</code></a></dt>
 <dd>
  Specifies a feature name that will work with the {{cssxref("font-variant-alternates", "stylistic()", "#stylistic()")}} functional notation of {{cssxref("font-variant-alternates")}}. A stylistice feature value definition allows only one value: <code>ident1: 2</code> is valid when <code>ident2: 2 4</code> isn't.</dd>
 <dt>
  <a name="@styleset"><code>@styleset</code></a></dt>
 <dd>
  Specifies a feature name that will work with the {{cssxref("font-variant-alternates", "styleset()", "#styleset()")}} functional notation of {{cssxref("font-variant-alternates")}}. A stylset feature value definition allows and illimited amount of values: <code>ident1: 2 4 12 1</code>maps to the OpenType values <code>ss02</code>, <code>ss04</code>, <code>ss12</code>, <code>ss01</code>. Note that values higher than <code>99</code> are valid, but doesn't map to any OpenType values and are ignored.</dd>
 <dt>
  <a name="@character-variant"><code>@character-variant</code></a></dt>
 <dd>
  Specifies a feature name that will work with the {{cssxref("font-variant-alternates", "character-variant()", "#character-variant()")}} functional notation of {{cssxref("font-variant-alternates")}}. A character-variant feature value definition allows one or two values: <code>ident1: 2</code>&nbsp; maps to <code>cv02=1</code> and <code>ident2: 2 4</code> maps to <code>cv02)4</code> and <code>ident2: 2 4 5</code> isn't valid.</dd>
</dl>
<h2 id="Specifications">Specifications</h2>
<table class="standard-table">
 <thead>
  <tr>
   <th scope="col">Specification</th>
   <th scope="col">Status</th>
   <th scope="col">Comment</th>
  </tr>
 </thead>
 <tbody>
  <tr>
   <td>{{SpecName('CSS3 Fonts', '#propdef-font-variant', 'font-variant')}}</td>
   <td>{{Spec2('CSS3 Fonts')}}</td>
   <td>Initial definition</td>
  </tr>
 </tbody>
</table>
<h2 id="Browser_compatibility" name="Browser_compatibility">Browser compatibility</h2>
<div>
 {{CompatibilityTable}}</div>
<div id="compat-desktop">
 <table class="compat-table">
  <tbody>
   <tr>
    <th>Feature</th>
    <th>Chrome</th>
    <th>Firefox (Gecko)</th>
    <th>Internet Explorer</th>
    <th>Opera</th>
    <th>Safari (WebKit)</th>
   </tr>
   <tr>
    <td>Basic support</td>
    <td>{{CompatUnknown}}</td>
    <td>{{CompatGeckoDesktop("34")}} [1]</td>
    <td>{{CompatUnknown}}</td>
    <td>{{CompatUnknown}}</td>
    <td>{{CompatUnknown}}</td>
   </tr>
  </tbody>
 </table>
</div>
<div id="compat-mobile">
 <table class="compat-table">
  <tbody>
   <tr>
    <th>Feature</th>
    <th>Android</th>
    <th>Firefox Mobile (Gecko)</th>
    <th>IE Phone</th>
    <th>Opera Mobile</th>
    <th>Safari Mobile</th>
   </tr>
   <tr>
    <td>Basic support</td>
    <td>{{CompatUnknown}}</td>
    <td>{{CompatGeckoMobile("34")}} [1]</td>
    <td>{{CompatUnknown}}</td>
    <td>{{CompatUnknown}}</td>
    <td>{{CompatUnknown}}</td>
   </tr>
  </tbody>
 </table>
</div>
<p>[1] Experimental implementation of the CSS Fonts Level 3 extensions was available since Gecko 24. It was governed by the preference <code>layout.css.font-features.enabled</code> defaulting to <code>true</code> on Nightly and Aurora only.</p>
<h2 id="See_also">See also</h2>
<ul>
 <li>The {{cssxref("font-variant-alternates")}} property that uses values that this at-rule defines.</li>
 <li>{{CSS_Reference:Fonts}}</li>
</ul>
Revert to this revision