字体式不适用于字体式特定 @font-face后备
我有一个webfont在正常和斜体之间具有非常不同的宽度。作为后备,我正在为每个尺寸调整而实施Arial。由于某种原因,斜体版本不会显示斜体。
基于输出,第二次后备明显起作用,除了字体风格。也许我错过了什么?
当我从斜体后备中删除字体风格的声明时,它可以使用,但是普通版本继承了同一后备。我该如何解决?
@font-face {
font-family: 'fallback';
font-style: normal;
font-weight: 400;
src: local(Arial);
size-adjust: 110%;
}
@font-face {
font-family: 'fallback';
font-style: italic;
font-weight: 400;
src: local(Arial);
size-adjust: 125%;
}
div {
display: flex;
}
p {
font-size: 2rem;
font-family: fallback;
font-style: normal;
color: green;
}
p + p {
font-size: 2rem;
font-family: fallback;
font-style: italic;
color: orange;
}
<div>
<p>Sweet sweet marzipan dolor sweet marzipan candy croissant orange biscuit sugar cream sweet marzipan lollipop apple sprinkles sprinkles cake ipsum. Croissant pastry biscuit pastry sweet cake cream jelly croissant muffin ipsum biscuit tiramisu jelly sweet ipsum sweet dolor vanilla ipsum.</p>
<p>Sweet sweet marzipan dolor sweet marzipan candy croissant orange biscuit sugar cream sweet marzipan lollipop apple sprinkles sprinkles cake ipsum. Croissant pastry biscuit pastry sweet cake cream jelly croissant muffin ipsum biscuit tiramisu jelly sweet ipsum sweet dolor vanilla ipsum.</p>
</div>
I have a webfont that has very different widths between normal and italic. As a fallback I'm implementing Arial with a size-adjust for each. For some reason the italic version does not show up italic.
Based on the output the second fallback clearly works, except for the font-style. Maybe I'm missing something?
When I remove the font-style declaration from the italic fallback it works, but the normal version inherits the same fallback. How do I get around this?
@font-face {
font-family: 'fallback';
font-style: normal;
font-weight: 400;
src: local(Arial);
size-adjust: 110%;
}
@font-face {
font-family: 'fallback';
font-style: italic;
font-weight: 400;
src: local(Arial);
size-adjust: 125%;
}
div {
display: flex;
}
p {
font-size: 2rem;
font-family: fallback;
font-style: normal;
color: green;
}
p + p {
font-size: 2rem;
font-family: fallback;
font-style: italic;
color: orange;
}
<div>
<p>Sweet sweet marzipan dolor sweet marzipan candy croissant orange biscuit sugar cream sweet marzipan lollipop apple sprinkles sprinkles cake ipsum. Croissant pastry biscuit pastry sweet cake cream jelly croissant muffin ipsum biscuit tiramisu jelly sweet ipsum sweet dolor vanilla ipsum.</p>
<p>Sweet sweet marzipan dolor sweet marzipan candy croissant orange biscuit sugar cream sweet marzipan lollipop apple sprinkles sprinkles cake ipsum. Croissant pastry biscuit pastry sweet cake cream jelly croissant muffin ipsum biscuit tiramisu jelly sweet ipsum sweet dolor vanilla ipsum.</p>
</div>
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
@font-face SRC是指特定的字体资源。因此,斜体版本应引用Arial斜体字体,例如
src:local(arial Italic)
@font-face src refers to a specific font resource. Therefore the italic version should reference to the arial italic font e.g.
src: local(Arial Italic)