我无法使用网络字体从普通字体样式切换到斜体。
当我使用字体变化设置时,我只能得到正常样式:
font-variation-settings: 'wght' 400, 'ital' 1;
我在 @font-ace
中使用了一种名为 Petrona 的 Google 字体。
这是我在 CSS 中调用字体的方式:
@font-face {
font-family: 'Petrona';
src: url('fonts/petrona/Petrona-VariableFont_wght.ttf') format('woff2 supports variations'),
url('fonts/petrona/Petrona-VariableFont_wght.ttf') format('woff2-variations');
font-weight: 1 900;
font-style: normal;
}
@font-face {
font-family: 'Petrona';
src: url('fonts/petrona/Petrona-Italic-VariableFont_wght.ttf') format('woff2 supports variations'),
url('fonts/petrona/Petrona-Italic-VariableFont_wght.ttf') format('woff2-variations');
font-weight: 1 900;
font-style: italic;
}
body {
font-family: Petrona;
font-variation-settings: 'wght' 400, 'ital' 1;
}
如果我删除第一个 @font-face
声明,我会得到我的斜体...但是如果我尝试:
font-variation-settings: 'wght' 400, 'ital' 0;
我仍然得到斜体...
我已阅读this article,但我似乎看不出哪里出错了。