问题标签 [font-feature-settings]

For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.

0 投票
1 回答
333 浏览

javascript - 使用 javascript 检测可变字体支持

我知道 woff2 检测以及基于 css 的@supports可变字体支持检测,但是有没有办法纯粹在 Javascript 中检测可变字体支持?

0 投票
0 回答
65 浏览

javascript - 有没有办法使用 Javascript 读取字体的可用字体功能设置?

如何读取字体文件(例如“ss01”、“liga”、“WGHT”等)的现有 fontFeatureSettings / fontVariationSettings 以及它们的范围和值?我知道如何使用 javascript 访问和更改功能,但我想根据每种字体提供的设置动态呈现推子。我很确定这是可能的,但也许我正在寻找错误的关键字?如果不可能的话,我也对使用 node.js 的服务器端解决方案感到满意。

谢谢!

我尝试使用javascript动态导入字体文件,但在documents.fonts中找不到我需要的信息:

0 投票
1 回答
137 浏览

css - 没有字体功能设置的CSS中的OpenType大写间距(cpsp)?

有没有办法在cpsp不影响应用于它的其他 OpenType 功能的情况下为元素设置大写间距 ()?

使用font-feature-settings不是一个选项:例如font-feature-settings: 'cpsp'打开大写间距,但如果其他所有 OpenType 功能有效,它们也会重置

一些 CSS 属性允许设置 OpenType 标签而不影响其他属性;例如font-variant-numericforonumlnum,或font-variant-capsfor smpcand c2sc。但我没有看到cpsp标签的专用属性。

0 投票
1 回答
62 浏览

javascript - 有没有办法使用 JavaScript 找到字体中可用的所有功能

我正在用 Nuxt 和 Contentful 开发一个网站。我使用FontFace加载了一些字体。我需要以这种方式加载它们,因为它是一个 Type 设计俱乐部网站,他们需要在发布新字体时加载他们的字体。

他们要求我展示这些加载字体的所有功能,例如连字、风格替代品等。

JavaScript 中有没有办法知道哪些功能可用于字体?

0 投票
1 回答
72 浏览

css - font-feature-settings : 'tnum' , 'lnum' : Not Working

I am trying to use font-feature-settings: 'tnum' on, 'lnum' on; style on a custom font, but I am unable to see any visible effect of this property on the font.

Moreover, in my JSFiddle snippet, I am getting css compile error

"Expected no more than 1 declaration"

  1. Is this css font-feature-property correct?
  2. Is there any specific css property which is needed for this to take effect?