问题描述
我使用google的网络字体,他们罚款超大字体大小,但在18px,他们看起来很可怕。我在这里读到的有字体平滑的解决方案,但我没有找到任何解释它清楚,我发现几个片段不工作。
我的 h4
几乎在每个浏览器都很糟糕,但Chrome是最糟糕的。在Chrome中,几乎所有的字体看起来都很可怕。
任何人都能指向正确的方向?也许你知道一个资源可以清楚地解释这一点?谢谢!
EXAMPLE SCREENSHOT#1
此屏幕截图显示了 在此Stackoverflow页面上的另一个答案,它通过以特殊的顺序加载Web字体来修复此问题。我会感觉不好,简单地复制他的优秀的答案,所以请看看那里。还有一个(未经验证的)解决方案,建议仅使用TTF / OTF字体,因为几乎所有浏览器都支持它们。
3)Google Chrome开发团队关于这个问题。因为在渲染引擎中有一些巨大的变化,所以显然还在进行中。
我已经写了一篇关于这个问题的博客文章,看看:
。
我的原始答案:
这是一个Google Chrome中的大错误和Google Chrome小组知道这一点,请参阅官方错误报告。目前,在2013年5月,甚至在报告错误后11个月,它没有解决。这是一个奇怪的事情,唯一的浏览器混乱Google Webfonts是谷歌自己的浏览器Chrome(!)。
$ b
2013年5月的Google Chrome开发小组发表的声明
/ p>错误报告中的官方声明:
我们的Windows字体渲染正在积极处理。 ...我们希望有一些在里程碑或两个开发人员可以开始玩。如何快速稳定是一如既往地,我们可以根除和烧掉任何回归有多快。
I'm using google webfonts and they fine at super large font sizes, but at 18px, they look awful. I've read here and there that there are solutions for font smoothing, but I haven't found any where that explains it clearly and the few snippets I have found don't work at all.
My h4
looks awful in pretty much every browser, but Chrome is the worst. In Chrome, pretty much all of my fonts look terrible.
Can anyone point me in the right direction? Perhaps you know of a resource that explains this clearly? Thanks!
EXAMPLE SCREENSHOT #1
This screenshot shows the homepage of https://www.dartlang.org/, a programming language that is made by Google (so we can imply that this website is also build by Google) and uses Google Webfonts.
Screenshot shows Google Chrome on the left, Firefox/Internet Explorer on the right.:
EXAMPLE SCREENSHOT #2
This screenshot shows a product info page on Adobe.com, using webfonts provided by Typekit. Adobe & Typekit are professionals when it comes to fonts.
Screenshot shows Google Chrome on the right, Firefox/Internet Explorer on the left:
Status of the issue, June 2014: Fixed with Chrome 37
Finally, the Chrome team will release a fix for this issue with Chrome 37 which will be released to public in July 2014. See example comparison of current stable Chrome 35 and latest Chrome 37 (early development preview) here:
Status of the issue, December 2013
1.) There is NO proper solution when loading fonts via @import
, <link href=
or Google's webfont.js
. The problem is that Chrome simply requests .woff files from Google's API which render horribly. Surprisingly all other font file types render beautifully. However, there are some CSS tricks that will "smoothen" the rendered font a little bit, you'll find the workaround(s) deeper in this answer.
2.) There IS a real solution for this when self-hosting the fonts, first posted by Jaime Fernandez in another answer on this Stackoverflow page, which fixes this issue by loading web fonts in a special order. I would feel bad to simply copy his excellent answer, so please have a look there. There is also an (unproven) solution that recommends using only TTF/OTF fonts as they are now supported by nearly all browsers.
3.) The Google Chrome developer team works on that issue. As there have been several huge changes in the rendering engine there's obviously something in progress.
I've written a large blog post on that issue, feel free to have a look:How to fix the ugly font rendering in Google Chrome
Reproduceable examples
See how the example from the initial question look today, in Chrome 29:
POSITIVE EXAMPLE:
Left: Firefox 23, right: Chrome 29
POSITIVE EXAMPLE:
Top: Firefox 23, bottom: Chrome 29
NEGATIVE EXAMPLE: Chrome 30
NEGATIVE EXAMPLE: Chrome 29
Solution
Fixing the above screenshot with -webkit-text-stroke:
First row is default, second has:
-webkit-text-stroke: 0.3px;
Third row has:
-webkit-text-stroke: 0.6px;
So, the way to fix those fonts is simply giving them
-webkit-text-stroke: 0.Xpx;
or the RGBa syntax (by nezroy, found in the comments! Thanks!)
-webkit-text-stroke: 1px rgba(0,0,0,0.1)
There's also an outdated possibility:Give the text a simple (fake) shadow:
text-shadow: #fff 0px 1px 1px;
RGBa solution (found in Jasper Espejo's blog):
text-shadow: 0 0 1px rgba(51,51,51,0.2);
I made a blog post on this:
If you want to be updated on this issue, have a look on the according blog post: How to fix the ugly font rendering in Google Chrome. I'll post news if there're news on this.
My original answer:
This is a big bug in Google Chrome and the Google Chrome Team does know about this, see the official bug report here. Currently, in May 2013, even 11 months after the bug was reported, it's not solved. It's a strange thing that the only browser that messes up Google Webfonts is Google's own browser Chrome (!). But there's a simple workaround that will fix the problem, please see below for the solution.
STATEMENT FROM GOOGLE CHROME DEVELOPMENT TEAM, MAY 2013
Official statement in the bug report comments:
Our Windows font rendering is actively being worked on. ... We hope to have something within a milestone or two that developers can start playing with. How fast it goes to stable is, as always, all about how fast we can root out and burn down any regressions.
这篇关于是否有任何“字体平滑”在Google Chrome中?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!