如何为后备字体设置不同的字体粗细? [英] How to set different font-weight for fallback font?

查看:79
本文介绍了如何为后备字体设置不同的字体粗细?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我遇到了我用于网站的自定义字体的问题。

I've came across a problem with custom font i use for my website.

因此,我使用以下CSS作为文本。

So i use following CSS for text.

font-family: "Open Sans",Helvetica,Arial;
font-weight:600;

由于网站是使用我的母语构建的,因此我必须使用UTF-8符号, t似乎已包含在Open Sans中,因此将它们显示在Helvetica中,但问题是它们的重量更大。

As website is built in my native language, i have to use UTF-8 symbols, that doesn't seems to be included in Open Sans, so they are being shown in Helvetica instead, but the problem is that they have more weight.

是否有任何可行的解决方案可以设置

Is there any possible solutions to set font-weight parameter to normal, if fallback font is being used?

推荐答案

您可以定义一个新的 @ font-face 每种字体。

You could define a new @font-face for each font you want.

@font-face {
      font-family: 'mainFont';
      src: url(/*Link to Open Sans*/);
      font-weight: 600;
}

@font-face {
      font-family: 'secondaryFont';
      src: local('Helvetica');
      font-weight: 400;
}

@font-face {
      font-family: 'tertiaryFont';
      src: local('Arial');
      font-weight: 600;
}

然后您将得到 font-family :'mainFont','secondaryFont','tertiaryFont'; 应该可以得到预期的结果。

Then you'll end up with font-family: 'mainFont', 'secondaryFont', 'tertiaryFont'; which should get the desired results.

这篇关于如何为后备字体设置不同的字体粗细?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆