aboutsummaryrefslogtreecommitdiff
path: root/files/zh-cn/web/css/font-feature-settings
diff options
context:
space:
mode:
authorPeter Bengtsson <mail@peterbe.com>2020-12-08 14:40:17 -0500
committerPeter Bengtsson <mail@peterbe.com>2020-12-08 14:40:17 -0500
commit33058f2b292b3a581333bdfb21b8f671898c5060 (patch)
tree51c3e392513ec574331b2d3f85c394445ea803c6 /files/zh-cn/web/css/font-feature-settings
parent8b66d724f7caf0157093fb09cfec8fbd0c6ad50a (diff)
downloadtranslated-content-33058f2b292b3a581333bdfb21b8f671898c5060.tar.gz
translated-content-33058f2b292b3a581333bdfb21b8f671898c5060.tar.bz2
translated-content-33058f2b292b3a581333bdfb21b8f671898c5060.zip
initial commit
Diffstat (limited to 'files/zh-cn/web/css/font-feature-settings')
-rw-r--r--files/zh-cn/web/css/font-feature-settings/index.html121
1 files changed, 121 insertions, 0 deletions
diff --git a/files/zh-cn/web/css/font-feature-settings/index.html b/files/zh-cn/web/css/font-feature-settings/index.html
new file mode 100644
index 0000000000..ee6c1cffa4
--- /dev/null
+++ b/files/zh-cn/web/css/font-feature-settings/index.html
@@ -0,0 +1,121 @@
+---
+title: font-feature-settings
+slug: Web/CSS/font-feature-settings
+tags:
+ - CSS
+ - CSS 字体
+ - CSS 属性
+ - 参考
+translation_of: Web/CSS/font-feature-settings
+---
+<div>{{CSSRef}}</div>
+
+<p><strong><code>font-feature-settings</code></strong> 属性用于控制OpenType字体中的高级印刷功能。</p>
+
+<div>{{EmbedInteractiveExample("pages/css/font-feature-settings.html")}}</div>
+
+
+
+<h2 id="语法">语法</h2>
+
+<pre class="brush:css no-line-numbers">/* 默认设置 */
+font-feature-settings: normal;
+
+/* 设置 OpenType 功能标签的值 */
+font-feature-settings: "smcp";
+font-feature-settings: "smcp" on;
+font-feature-settings: "swsh" 2;
+font-feature-settings: "smcp", "swsh" 2;
+
+/* 全局值 */
+font-feature-settings: inherit;
+font-feature-settings: initial;
+font-feature-settings: unset;
+</pre>
+
+<div class="note"><strong>Note:</strong> Web开发者应该尽可能的使用类似 {{cssxref("font-variant")}} 这样的短标记属性或者相关的速记标识属性等, 类似 {{cssxref("font-variant-ligatures")}}, {{cssxref("font-variant-caps")}}, {{cssxref("font-variant-east-asian")}}, {{cssxref("font-variant-alternates")}}, {{cssxref("font-variant-numeric")}} or {{cssxref("font-variant-position")}}.<br>
+<br>
+该属性是一个比较偏底层的功能接口,用于解决由于没有其他方法去访问和设置OpenType字体某些特性而无法解决一些特殊功能需求.<br>
+<br>
+特别需要注意的是,该CSS属性不应该用来开启大写字母转换.</div>
+
+<p>{{cssinfo}}</p>
+
+<h3 id="值">值</h3>
+
+<dl>
+ <dt><code>normal</code></dt>
+ <dd>文本使用默认设置进行布局。</dd>
+ <dt><code>&lt;feature-tag-value&gt;</code></dt>
+ <dd>在呈现文本时,OpenType要素标记值的列表被传递到文本布局引擎以启用或禁用字体特征。标签始终是4个ASCII字符的 {{cssxref("&lt;string&gt;")}} 。如果是U + 20 - U + 7E代码点范围以外的字符或字符个数不对,则整个属性无效。 <br>
+ 值是一个正整数。两个关键字on和off分别是1和0的同义词。如果未设置任何值,则默认值为1。对于非布尔型OpenType功能(例如,文体替代 <a href="http://www.microsoft.com/typography/otspec/features_pt.htm#salt" title="http://www.microsoft.com/typography/otspec/features_pt.htm#salt">stylistic alternates</a>),该值意味着要选择特定的字形;对于布尔值,它是一个开关。</dd>
+</dl>
+
+<h3 id="形式语法">形式语法</h3>
+
+<pre class="syntaxbox">{{csssyntax}}</pre>
+
+<h2 id="实例">实例</h2>
+
+<pre class="brush:css">/* use small-cap alternate glyphs */
+.smallcaps { font-feature-settings: "smcp" on; }
+
+/* convert both upper and lowercase to small caps (affects punctuation also) */
+.allsmallcaps { font-feature-settings: "c2sc", "smcp"; }
+
+/* enable historical forms */
+.hist { font-feature-settings: "hist"; }
+
+/* disable common ligatures, usually on by default */
+.noligs { font-feature-settings: "liga" 0; }
+
+/* enable tabular (monospaced) figures */
+td.tabular { font-feature-settings: "tnum"; }
+
+/* enable automatic fractions */
+.fractions { font-feature-settings: "frac"; }
+
+/* use the second available swash character */
+.swash { font-feature-settings: "swsh" 2; }
+
+/* enable stylistic set 7 */
+.fancystyle {
+ font-family: Gabriola; /* available on Windows 7, and on Mac OS */
+ font-feature-settings: "ss07";
+}
+</pre>
+
+<h2 id="规范">规范</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-feature-settings', 'font-feature-settings')}}</td>
+ <td>{{Spec2('CSS3 Fonts')}}</td>
+ <td>Initial definition</td>
+ </tr>
+ </tbody>
+</table>
+
+<h2 id="浏览器兼容性">浏览器兼容性</h2>
+
+<div>
+
+
+<p>{{Compat("css.properties.font-feature-settings")}}</p>
+</div>
+
+<h2 id="其他参考">其他参考</h2>
+
+<ul>
+ <li><a href="https://www.fontfont.com/staticcontent/downloads/FF_OT_User_Guide.pdf" title="http://www.fontfont.com/opentype/FF_OT_UserGuide_v2.pdf">FontFont OpenType User Guide (pdf)</a></li>
+ <li><a href="http://www.microsoft.com/typography/otspec/featurelist.htm" title="http://www.microsoft.com/typography/otspec/featurelist.htm">OpenType Feature Tags</a> 列表</li>
+ <li><a href="http://blogs.msdn.com/b/ie/archive/2012/01/09/css-corner-using-the-whole-font.aspx" title="http://blogs.msdn.com/b/ie/archive/2012/01/09/css-corner-using-the-whole-font.aspx">Using the whole font</a> ( -moz语法是旧的。在Gecko上,使用-ms语法,但使用-moz ).</li>
+</ul>