简体   繁体   English

Safari 8.0.6忽略具有字母组合:“ fit”的CSS字母间距属性

[英]Safari 8.0.6 ignores CSS letter-spacing properties with letter combination: 'fit'

This is a very strange bug I have encountered in Safari 8.0.6, when Safari renders the word/letter combination 'fit' it ignores the CSS 'letter-spacing' property. 这是我在Safari 8.0.6中遇到的一个非常奇怪的错误,当Safari呈现单词/字母组合“ fit”时,它将忽略CSS的“ letter-spacing”属性。 I have observed this with a custom webfont, but also with Arial (not reproducible with 'Times'). 我已经用自定义的webfont观察到了这一点,但也使用Arial(不能用“ Times”重现)观察到了这一点。

http://jsfiddle.net/aaronpruzaniec/hqt7bs0y/2/ http://jsfiddle.net/aaronpruzaniec/hqt7bs0y/2/

http://imgur.com/1uM6LRw http://imgur.com/1uM6LRw

 <span style="letter-spacing:15px;font-family:times;">Every word will have 15px letter spacing exept for the word: fit, for no apparent reason. xxfitxx fitness</span> <br> <br> <span style="letter-spacing:15px;font-family:arial;">Every word will have 15px letter spacing exept for the word: fit, for no apparent reason. xxfitxx fitness</span> 

Disclaimer: I don't have that particular version of Safari here to test on, so this answer may not solve the issue properly, in which case I apologise. 免责声明:我没有要测试的特定版本的Safari,因此此答案可能无法正确解决问题,在这种情况下,我表示歉意。
In addition, the issue appears also in some versions of Chrome, and the solutions seem to work differently in different versions. 此外,此问题在某些版本的Chrome中也出现,并且解决方案在不同版本中的工作方式似乎有所不同。 So test carefully! 因此,请仔细测试!

The problem is that in some fonts, certain letter combinations are replaced with ligature glyphs. 问题是在某些字体中,某些字母组合被连字字形代替。 This is normally done to improve the rendering quality, but in this case, it backfires. 通常这样做是为了提高渲染质量,但是在这种情况下,它适得其反。

Solution: switch off ligature substitution. 解决方案:关闭连字替换。
This can be done with either the modern font-variant-ligatures property or the older font-feature-settings one. 这可以使用现代的font-variant-ligatures属性或较旧的font-feature-settings属性来完成。 Or you can try both... 或者您可以同时尝试...

 p {letter-spacing:1em; font-family:'DejaVu Sans', 'Times New Roman';} .ffs {-webkit-font-feature-settings:"liga" 0; font-feature-settings:"liga" 0;} .fvl {-webkit-font-variant-ligatures: none; font-variant-ligatures: none;} 
 <p>fit fisticuffs fluffie offline</p> <p class="ffs">fit fisticuffs fluffie offline</p> <p class="fvl">fit fisticuffs fluffie offline</p> <p class="ffs fvl">fit fisticuffs fluffie offline</p> 

Hope this helps! 希望这可以帮助! As I said, I can't test this with Safari 8; 正如我所说,我无法使用Safari 8进行测试; the only Safari I have (5) doesn't display the problem, but an older Chrome version does. 我仅有的一个Safari(5)不会显示此问题,但较旧的Chrome版本可以显示。 And these styles have an effect. 这些样式都有效果。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM