@font-feature-values - CSS(层叠样式表) 编辑

概要

@font-feature-values CSS at-rule 允许作者在font-variant-alternates 中使用通用名称,用于在OpenType中以不同方式激活功能。它允许在使用几种字体时简化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-alternates: 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

Feature value blocks

@swash
Specifies a feature name that will work with the swash() functional notation of 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 annotation() functional notation of 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 ornaments() functional notation of 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 stylistic() functional notation of 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 styleset() functional notation of 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 character-variant() functional notation of 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.

Formal syntax

@font-feature-values <family-name># {
  <feature-value-block-list>
}

where
<family-name> = <string> | <custom-ident>+
<feature-value-block-list> = <feature-value-block>+

where
<feature-value-block> = <feature-type> '{' <feature-value-declaration-list> '}'

where
<feature-type> = @stylistic | @historical-forms | @styleset | @character-variant | @swash | @ornaments | @annotation
<feature-value-declaration-list> = <feature-value-declaration>

where
<feature-value-declaration> = <custom-ident>: <integer>+;

Specifications

SpecificationStatusComment
CSS Fonts Module Level 3
@font-feature-values
Candidate RecommendationInitial definition

Browser compatibility

We're converting our compatibility data into a machine-readable JSON format. This compatibility table still uses the old format, because we haven't yet converted the data it contains. Find out how you can help!
FeatureChromeFirefox (Gecko)Internet ExplorerOperaSafari (WebKit)
Basic support?34 (34) [1]???
FeatureAndroidFirefox Mobile (Gecko)IE PhoneOpera MobileSafari Mobile
Basic support?34.0 (34) [1]???

[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

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据

词条统计

浏览:74 次

字数:12193

最后编辑:7 年前

编辑次数:0 次

    我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
    原文