【发布时间】:2017-02-22 11:36:29
【问题描述】:
我花了很长时间才弄清楚,Chrome 总是更喜欢本地安装的字体,而不是 css 中链接的同名字体(另请参阅https://stackoverflow.com/a/27704394/1099519)。我的问题是如何弄清楚,迫使 Chrome 不这样做。
在我的页面 https://www.amon.cc/ 上,我使用 Google 字体 (https://fonts.google.com/specimen/Roboto) 中的“Roboto Light”,如下所示:
<link href="//fonts.googleapis.com/css?family=Roboto:300" rel="stylesheet" type="text/css" />
在我的 CSS 文件中,字体是这样声明的:
body{
...
font-family:Roboto,...;
font-weight:300;
....
}
在 FF、IE、Edge 中运行良好:
但在 Chrome 中字体总是较粗:
原因:在我的私人 Windows 10 以及商务计算机上,Windows 上预装了“Roboto”字体:Robot Regular、Robot Condensed。但是没有 Roboto Thin 或 Robot Light,所以 Chrome 似乎可以回退到 Roboto Regular。
从 Windows 中删除 Robot 字体集时,Chrome 使用声明的网络字体并以我想要的方式显示它。我不知道如何“强制”Chrome 不使用本地安装,而是使用 CDN 上的。
但是,Chrome 可以在 https://fonts.google.com/specimen/Roboto 网站上以所有不同的变体显示 Roboto 字体(即使使用我本地安装的 Robot 字体)。我不知道这是怎么做到的。
【问题讨论】:
标签: css google-chrome fonts google-webfonts