为什么我的嵌入字体渲染不正确?

发布于 2024-12-11 19:00:35 字数 445 浏览 8 评论 0原文

我正在使用 google fonts api,该字体在 Google 上看起来很棒,但是当我尝试使用它时,它无法正确呈现。这是一个示例:

https://twitter.com/dontdie/status/129234318299111424/photo/ 1

这是在 Chrome 中,两个不同的选项卡。由于某些原因,Chrome 不使用“子像素渲染”( http://en.wikipedia.org/wiki/ Subpixel_rendering )在我的网站上,但在 Google 上它已打开。

I am using the google fonts api, the font looks great on Google, but when I try to use it, it doesn't render properly. Here is an example:

https://twitter.com/dontdie/status/129234318299111424/photo/1

this is in Chrome, two different tabs. For some reason, Chrome is not using "subpixel rendering" ( http://en.wikipedia.org/wiki/Subpixel_rendering ) on my site, but on google it is turned on.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

暮年慕年 2024-12-18 19:00:35

我想我已经明白了这一点。将这些规则添加到我的样式表中似乎可以解决此问题:

body, body * {
  background-color: #fff;
  -webkit-font-smoothing: subpixel-antialiased;
}

仅设置 subpixel-antialiased 不起作用,仅向正文添加背景颜色也不起作用。这可能可以简化为仅选择 *html *。此外,鉴于 subpixel-antialiased 是默认设置,删除该规则也应该有效。

I think I figured this out. adding these rules to my stylesheet seemed to fix it:

body, body * {
  background-color: #fff;
  -webkit-font-smoothing: subpixel-antialiased;
}

Just setting subpixel-antialiased didn't work, and just adding a background color to the body didn't work. This could probably be simplified to select just * or html *. Also, given that subpixel-antialiased is the default, removing that rule should work as well.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文