网页字体渲染
创建网页时我总是遇到同样的问题。 当我添加大于 16-18px 的字体时,它看起来很糟糕。 它是锯齿状的、像素化的。 我尝试过使用不同的字体和粗细,但是我在那里没有太多运气。
注意:只有windows下是这样的。 主要是在 Opera 和 FF 中,在 IE7 中也有,但没有那么糟糕。 在 Linux 中,字体看起来不错。 我还没看过Mac。
你们会做什么来解决这个问题? 如果有什么。 我注意到 SO 上的标题也很锯齿状,但它们足够小,不会看起来很糟糕。
I always run into the same problem when creating web pages. When I add a font that is larger then about 16-18px it looks terrible. Its jagged, and pixelated. I have tried using different fonts and weights, however I haven't had much luck there.
Note: Its only in windows that it is like this. Mainly in Opera and FF also in IE7 but not quite as bad. In Linux the font looks good. I haven't looked at a Mac.
What do you guys do to fix this? if anything. I noticed that the titles here on SO are also pretty jagged but they are just small enough not to look bad.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
在 Windows 上,启用 ClearType 将解决此问题。 但是,您不能强迫用户使用它。 这不是浏览器问题; 这是操作系统的字体平滑方法。
On Windows, enabling ClearType will solve this. However, you can't force users to use it. It's not a browser issue; it's the operating system's font smoothing method.
启用抗锯齿应该可以解决显示问题。
Enabling anti-aliasing should solve the display problem.
除了抗锯齿之外,还可以尝试启用清晰的字体。
Aside from anti-aliasing, try enabling clear type.
您无法强制用户更改操作系统呈现字体的方式。 如果这对您来说很重要,那么您可以用图像替换大标题,这使您可以准确控制字体的呈现方式(并确保标题看起来完全符合您的意愿,即使用户没有您的建议字体已安装)。
如果您这样做,请确保为那些看不到图像的人提供替代文本表示。 我倾向于使用 CSS 来显示背景图像,并隐藏标题的内容。 像这样。
老实说,如果它在所有大文本上,这看起来确实有点矫枉过正。 请注意,这会增加您的客户需要下载的数据量。 然而,对于大标题,此方法可能会导致看起来比操作系统呈现的文本更好的内容。
There is nothing you can do to force the user to change the way that their operating system renders fonts. If it is that big a deal to you then you can replace the large headings with images, this allows you to control exactly how the font is rendered (and ensures that the heading looks exactly as you wish, even if the user doesnt have your suggested font installed).
If you do this make sure that you provide an alternative text representation for those who do not see images. I tend to use CSS to show a background image, and hide the contents of the heading. Like this.
To be honest this does seem like overkill if it is on all large text. And be aware that it will increase the amount of data that your clients need to download. However for a large heading this method can lead to something that looks nicer than OS rendered text.