webkit 中的 @font-face 和 letter-spacing

发布于 2024-08-29 16:19:21 字数 511 浏览 7 评论 0原文

我刚刚发现嵌入字体时,字母间距在 webkit(也许还有其他浏览器?)中并不总是有效。我尝试了两种不同的字体并收到了不同的结果。

“League Gothic Regular”将起作用

http://www.theleagueofmoveabletype.com/fonts/7 -league-gothic

“Quicksand Light”不会

http://www.fontsquirrel.com/ fonts/Quicksand

瘦的是什么?有没有办法强制使用不兼容的字体?

快速说明:Firefox 似乎确实适用于这两种字体。

I just discovered that letter-spacing doesn't always work in webkit (and perhaps other browsers?) when embedding fonts. I've tried it on two different fonts and received different results.

"League Gothic Regular" will work

http://www.theleagueofmoveabletype.com/fonts/7-league-gothic

"Quicksand Light" will not

http://www.fontsquirrel.com/fonts/Quicksand

What's the skinny? Is there a way to force the hand of non-compliant fonts?

Quick note: Firefox does seem to apply to both fonts.

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

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

发布评论

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

评论(3

只是在用心讲痛 2024-09-05 16:19:21

我不确定我有答案,但我在使用 Font Squirrel 的 League Gothic 时遇到了字间距问题,直到我使用不同的设置在网站上重新生成字体内容后我才弄清楚。我使用 Paul Irish 的 Bulletproof 方法...

Font Squirrel 设置 http://img59.imageshack .us/img59/8784/screenshot20100428at132.png

I'm not sure I have the answer but I was having a word-spacing problem with League Gothic from Font Squirrel, I couldn't figure it out until I re-generated the font-face stuff on the site using different settings. I use the Paul Irish's Bulletproof method...

Font Squirrel settings http://img59.imageshack.us/img59/8784/screenshot20100428at132.png

清旖 2024-09-05 16:19:21

我遇到了同样的问题,我可以使用以下代码清除它:

@font-face {
    font-family: 'League Gothic';
    src: url('/assets/fonts/league_gothic-webfont-webfont.eot');
    src: local('‚ò∫'),
            url(data:font/woff;charset=utf-8;base64,/* base64-encoded font here */) format('woff'),
            url(data:font/truetype;charset=utf-8;base64,/* base64-encoded font here */) format('truetype'),
            url('/assets/fonts/league_gothic-webfont-webfont.svg#webfontu5sqNtGI') format('svg');
    font-weight: normal;
    font-style: normal;
}

这主要是从 FontSquirrel< 生成的/a> 然后稍微修改(我删除了 local() 内容并替换了垃圾字符)。

这解决了我的字母间距问题。

I had the same problem, and I was able to clear it up using this code:

@font-face {
    font-family: 'League Gothic';
    src: url('/assets/fonts/league_gothic-webfont-webfont.eot');
    src: local('‚ò∫'),
            url(data:font/woff;charset=utf-8;base64,/* base64-encoded font here */) format('woff'),
            url(data:font/truetype;charset=utf-8;base64,/* base64-encoded font here */) format('truetype'),
            url('/assets/fonts/league_gothic-webfont-webfont.svg#webfontu5sqNtGI') format('svg');
    font-weight: normal;
    font-style: normal;
}

This was mostly generated from FontSquirrel and then modified slightly (I removed the local() stuff and substituted the junk characters).

This cleared up my letter-spacing issues.

猫腻 2024-09-05 16:19:21

在我看来,这只是由 svg 字体引起的!!!
我无法严格验证它,但我的测试用例证明了这一点。

重新排序你的字体 URL,将 svg 格式放在最后,它应该可以解决问题。但是 svg 字体不会被使用并且渲染可能会很脏(呃)

It seems to me that this is caused only by svg fonts!!!
I wasn't able to verify it strictly but my test cases prove that much.

Reorder your font-face urls putting svg format last, it should fix the problem. But svg fonts won't get used and rendering might be dirty(er)

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