使用网络字体,我想使用字体功能设置:CSS 中的选项以及跨度类HTML 中,以便使用字体集中的特定替代字形。
我需要以正确的语法使用哪些值(GID、Unicode?)才能定位特定的目标glyph
内glyph
备择方案?
这些功能使用 OpenType Stylistic Alternates(盐)。从 Illustrator 中的字形面板中,我们可以看到这是 Stylistic Alt 编号 4(当然,如果没有额外的上下文,我们并不清楚这意味着什么)。
如果您使用 CSS,您可以为每个 Stylistic Alternate 添加一个类:
/* OpenType Stylistic Alternates */
.salt,
.salt-1 { font-feature-settings: "salt"; }
.salt-2 { font-feature-settings: "salt" 2; }
.salt-3 { font-feature-settings: "salt" 3; }
.salt-4 { font-feature-settings: "salt" 4; }
然后,在您的 HTML 中:
<h1>
<span class="salt">C</span>offee
</h1>
并使用特定的数字:
<h1>
<span class="salt-4">C</span>offee
</h1>
您也可能决定将 Stylistic Alt 应用于整个单词,但这可能会产生不同的结果,具体取决于字体:
<!-- Apply the OpenType feature to specific letters -->
<div>
<span class="salt-1">C</span>offee
</div>
<div>
<span class="salt-2">C</span>offee
</div>
<div>
<span class="salt-3">C</span>offee
</div>
<div>
<span class="salt-4">C</span>offee
</div>
<!-- Apply the OpenType feature to whole words -->
<div class="salt-1">
Coffee
</div>
<div class="salt-2">
Coffee
</div>
<div class="salt-3">
Coffee
</div>
<div class="salt-4">
Coffee
</div>
如果您想了解有关网络上 OpenType 功能的更多信息,您可以查看我的实用 OpenType CSS 库 https://github.com/kennethormandy/utility-opentype,以及“进一步阅读”的其他资源文档底部 http://utility-opentype.kennethormandy.com/.
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)