提问人:Philipp 提问时间:7/24/2019 更新时间:7/24/2019 访问量:163
有没有办法使用 Javascript 读取字体的可用字体功能设置?
Is there a way to read available font feature settings of a typeface with Javascript?
问:
如何读取字体文件的现有 fontFeatureSettings / fontVariationSettings(例如 'ss01'、'liga'、'WGHT' 等)及其范围和值?我知道如何使用 javascript 访问和更改功能,但我想根据每种字体提供的设置动态渲染推子。我很确定这是可能的,但也许我正在寻找错误的关键字? 我也对带有 node.js 的服务器端解决方案感到满意,如果不可能的话。
谢谢!
我尝试使用 javascript 动态导入字体文件,但在 documents.fonts 中找不到我需要的信息:
async function loadFonts() {
const font = new FontFace('Variable', 'url(NobotoFlex-VF.ttf)');
await font.load();
document.fonts.add(font);
// I can't find the information I am looking for:
console.log(document.fonts);
}
loadFonts()
答: 暂无答案
评论