@font 在 Chrome 中面对断断续续的字体
我有我的 我在这里创建的网站,它看起来不错(现在 CSS3媒体查询不适用于 IE),但我发现我的 @font 字体已损坏,在 Windows 版 Chrome 中看起来就像一坨屎(到目前为止,这是我发现的唯一一个主要字体)。
我搜索了一下,发现 CSS3 rbg 修复应该可以工作,但它对我没有任何作用。 Paul Irish 进行了防弹修复,但是我的字体在 Android 中崩溃了。我已经研究了几个小时了,但似乎找不到任何有用的东西。我听说过 Cufon,但我试图坚持使用 @font face,因为它只是针对 Chrome,我遇到了这个麻烦。
我去了 font squirrel 并获得了我正在使用的字体的字体套件,所以它看起来像这样
@font-face {
font-family: 'GeosansLightRegular';
src: url('geosanslight-webfont.eot');
src: url('geosanslight-webfont.eot?#iefix') format('embedded-opentype'),
url('geosanslight-webfont.woff') format('woff'),
url('geosanslight-webfont.ttf') format('truetype'),
url('geosanslight-webfont.svg#GeosansLightRegular') format('svg');
font-weight: normal;
font-style: normal;
}
它适用于大多数浏览器(同样,我没有机会测试每一个,但我已经检查过它IE 6-9 看起来不错,FF 9 for Windows 和 FF 8 for OSX,Safari Opera 看起来很棒,Windows 版 Chrome 不能很好地使用 @font face 命令,
有没有人能给我一些建议 。做让它看起来更好或者修复它?(除了删除 @font 字体类并使用常规字体。)
另外,我最终可以使用 Chrome 的条件注释来查看常规字体,但我的 HTML 不会 ..
所以任何帮助将不胜感激
I have my website that I am creating here and it's looking good (right now CSS3 media queries aren't working for IE) but I find my @font face is broken and looks like crap in Chrome for Windows (so far that's the only major one I've found).
I've searched it up and found CSS3 rbg fix that is supposed to work however it did nothing for me. Did the bulletproof fix from Paul Irish however then my font breaks in Android. I've been researching this fro a couple hours now but can't seem to find anything that will work. I've heard of Cufon but I'm trying to stick with @font face as it's just for Chrome that I'm having this trouble.
I went to font squirrel and got the font face kit for the font I am using so it looks like this
@font-face {
font-family: 'GeosansLightRegular';
src: url('geosanslight-webfont.eot');
src: url('geosanslight-webfont.eot?#iefix') format('embedded-opentype'),
url('geosanslight-webfont.woff') format('woff'),
url('geosanslight-webfont.ttf') format('truetype'),
url('geosanslight-webfont.svg#GeosansLightRegular') format('svg');
font-weight: normal;
font-style: normal;
}
It works with most of the browsers (again I haven't had a chance to test EVERY single one, but I have checked it on IE 6-9 and it looks good, FF 9 for Windows and FF 8 for OSX, Safari Opera and it looks great. Chrome for windows is just not working well with the @font face command.
Does anyone have advice as to what I can do to either make it look better or fix it? (Aside from removing the @font face class and using regular font.)
Also, I could however end up using a conditional comment from Chrome to just view a regular font but then my HTML wouldn't validate eh?
So any help would be appreciated..
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
我已经解决了这个问题! Chrome 喜欢先加载 SVG 行。只需将其优先级提高即可。嗯...应该有人告诉Font Squirrel。
https://stackoverflow.com/a/9041280/1112665
例如,
请告诉我这是否适合您。干杯!
(由 simoneast 编辑:将 EOT 版本移至顶部,否则会破坏 IE。)
I've fixed this! Chrome likes it when you load the SVG line first. Just move that up in priority. Hmm... someone should tell Font Squirrel.
https://stackoverflow.com/a/9041280/1112665
e.g.
let me know if that works for you. cheers!
(Edited by simoneast: moved EOT version to top, otherwise it breaks IE.)
我为我的案例找到了另一个简单的解决方案。
我有 Microsoft Windows 7 SP1 和Goodle Chrome 23.0.1271.64 m 并在我的网络应用程序中使用 FontAwesome 。要在 Chrome 中启用 FontAwesome 的抗锯齿功能,只需删除如 maximo 所说的操作 - 使用 svg 字体开始 src 定义,但也要删除之后的字体名称svg 哈希值。简单地将其转换为:
转换为:
有帮助吗?
(由 simoneast 编辑:将 EOT 版本移至顶部,否则会破坏 IE。)
I've found another simple solution for my case.
I have Microsoft Windows 7 SP1 & Goodle Chrome 23.0.1271.64 m and using FontAwesome for my web application. To enable anti-aliasing for FontAwesome in Chrome simple remove do as maximo said - start src definition with svg font, but also remove font name after the svg hash. Simple convert this:
to this:
Does it help?
(Edited by simoneast: moved EOT version to top, otherwise it breaks IE.)
webkit 支持 CSS3 属性“font-smooth”。你尝试过吗?
There is a CSS3 property 'font-smooth' supported by webkit. Have you tried that?
要让 webfonts 在 Windows 上的 Chrome 中呈现良好的抗锯齿效果,您需要在字体声明中使用此格式:
基本上,您需要强制 Chrome 使用 SVG 字体格式。您可以通过将 .svg 版本的 url 移至顶部来实现此目的,但是 Windows 上的 Chrome 在执行此操作时会出现布局混乱的问题(直至版本 30)。通过使用媒体查询覆盖字体声明,这些问题就得到了解决。
另外:有时 OpenType 字体和 SVG 字体之间的基线位置不匹配,但您可以通过简单地编辑 SVG 字体文件来调整这一点。 SVG 字体是基于 xml 的,如果您查看声明,
您可以更改 ascent 的值并使其匹配其他字体格式版本。
To get webfonts to render with good antialias in Chrome on Windows, you need to use this format in the font declaration:
Basically, you need to force Chrome to use the SVG font format. You can do this by moving the url for the .svg version to the top, however Chrome on Windows has had problems with messing up the layout when doing this (up to and including version 30). By overriding the font declaration using a media query, these issues are solved.
Also: Sometimes the baseline position doesn't match between OpenType fonts and SVG fonts but you can adjust this by simply editing the SVG font files. SVG fonts are xml based and if you look at the declaration
You can change the value for ascent and get it to match the other font format versions.
经过几个小时的寻找修复后,我找到了一个完美的修复。它需要支付年费,但是如果您是拥有多个网站的网页设计师,那么这是必须拥有的!
www.typekit.com
它适用于所有现代浏览器,并且解决了我使用 Chrome 时遇到的烦人问题,所以我很高兴。无论您的访问者正在观看什么内容,都值得花费少量的费用来获得出色的字体。开始遇到问题,请联系他们,他们会为您解决问题。几乎适用于任何字体,让您高枕无忧。
After many hours of looking for a fix I found a perfect fix. It costs an annual fee, however if you are a web designer with multiple sites this is a must have!
www.typekit.com
It works on ALL modern browsers and it fixes my pesky problem with Chrome so I'm happy. It's worth the small fee to have great type no matter what your visitor is viewing on. Start to have an issue, contact them and THEY fix it for you. Peace of mind for almost any typeface.