为什么在Opera中用更大的字体大小显示文本? [英] Why is text rendered with a greater font-size in Opera?

查看:129
本文介绍了为什么在Opera中用更大的字体大小显示文本?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在一个HTML页面,需要或多或少像素完美,我注意到,在Opera 10,字体渲染比他们在其他浏览器,即使字体大小是有效的



请在Opera 10和另一个浏览器(例如Firefox 3.6)中查看此示例页面:



http://troy.onespot.com/static/stack_overflow/opera_font_size.html



或者,以下是说明问题的屏幕截图:



http://skitch.com/troywarr/d47m1/font-size



50px和46px



在Firefox 3.6中,50px行中的p的下降部分与在它后的红色箱子的底部。在Opera中,50px中的p的下降线悬挂在下面;它的46px更接近匹配的50px在Firefox中。这表明Opera正在10%的球场中渲染字体太大。



这和其他正文文本一样,完全抛弃了我的页面如果您对造成这种情况的原因有任何想法,或者至少如何防止/修复它。



谢谢!






UPDATE:



显示我没有安装Helvetica的正确副本 - 我从字体堆栈中删除它,并且看到在测试页上的渲染文本没有区别。



I更新测试页只使用通用的sans-serif字体族,所以希望我们现在看到的都是一样的。



有趣的是,使用通用serif字体在Opera和Firefox中显示完全相同。



这个问题只是一个奇怪的问题,Opera如何显示通用的sans-serif字体? p>




更新2:



这可能很重要:我使用Mac OS X雪豹。我现在正在尝试其他字体,看看是否可以进一步隔离问题。






3:



我使用Arial创建了另一个测试页:



http://troy.onespot.com/static/stack_overflow/opera_font_size_reset_arial.html



现在Opera和Firefox几乎完全匹配了!



我可以在这个项目中使用Arial代替Helvetica。据我所知,我有一个完全股票的OS X版本的Helvetica - 所以我不能承受不同的用户之间的差异可能看到我的页面上的字体。我会坚持尝试&真正的Arial。



这可能是什么意思,虽然 - OS X的默认sans-serif字体只是呈现奇怪的在Opera或什么?


<我的怀疑是,Opera对于 Sans-serif 使用与其他浏览器不同的备用字体。这应该可以通过使用一个绝对安装在系统上的不同的字体来确认或消除。


I'm working on an HTML page that needs to be more or less pixel-perfect, and I noticed that in Opera 10, fonts are rendering larger than they do in other browsers, even though the font-size is effectively the same.

Please see this example page in Opera 10 and another browser like Firefox 3.6:

http://troy.onespot.com/static/stack_overflow/opera_font_size.html

Alternatively, here's a screenshot that illustrates the issue:

http://skitch.com/troywarr/d47m1/font-size

The red boxes behind the "50px" and "46px" text (both styled to have the corresponding font-size) both have a height of 50px.

In Firefox 3.6, the descender of the "p" in "50px" lines up with the bottom of the red box behind it. In Opera, the descender of the "p" in "50px" hangs below; it's the "46px" that more closely matches the "50px" in Firefox. That suggests to me that Opera is rendering fonts in the ballpark of 10% too large.

This, and the same issue with other body text, is completely throwing off my page layout in Opera 10. Please let me know if you have any ideas about what may be causing this, or at least how to prevent/fix it.

Thanks!


UPDATE:

It appears that I don't have a proper copy of Helvetica installed - I removed it from the font stack and saw no difference in the rendered text on my test pages.

I updated the test pages to only use the generic "sans-serif" font-family, so hopefully we're all seeing the same thing now.

Interestingly, using the generic "serif" font displays exactly the same in Opera and Firefox.

Could this issue just be a quirk around how Opera displays the generic "sans-serif" font?


UPDATE 2:

This may be important: I'm using Mac OS X Snow Leopard. I'm experimenting with other fonts now to see if I can isolate the issue any further.


UPDATE 3:

I created another test page using Arial:

http://troy.onespot.com/static/stack_overflow/opera_font_size_reset_arial.html

And now Opera and Firefox match almost exactly!

I can probably get away with using Arial in lieu of Helvetica on this project. As far as I know, I have a completely stock OS X version of Helvetica - so I can't afford any disparity between how different users may be seeing the fonts on my page. I'll stick with the tried & true Arial.

What could this mean, though - does OS X's default sans-serif font just render strangely in Opera or something?

解决方案

My suspicion is that Opera uses a different fallback font for Sans-serif than the other browsers do. That should be possible to confirm or eliminate by using a different font that is definitely installed on the system.

这篇关于为什么在Opera中用更大的字体大小显示文本?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆