Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why is text rendered with a greater font-size in Opera?

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?

like image 465
Bungle Avatar asked Oct 11 '10 20:10

Bungle


People also ask

Why is my browser text so large?

Press and hold the Ctrl key, then move the mouse wheel up or down. Alternatively, you can press and hold the Ctrl key (or Command on Mac), then press + or - (plus or minus) to increase and decrease the font size. All major browsers also support pressing Ctrl + 0 (zero) to change the font to its default size.

How do I reduce font size in opera?

Change the Text SizeHold down the Control Key (Ctrl) on your keyboard and scroll up or down depending on whether you want the text size larger or smaller (this may not work on all web pages).

Why do fonts render differently in different browsers?

If you notice that your text fonts look different on different browsers, it is because different browsers and devices use different rendering engines, and therefore may result in minor differences. Sometimes these minor differences can have a domino effect.

What is the importance of larger fonts?

Words presented in larger font size are considered more memorable and rated with higher judgments of learning (JOLs). One explanation for this phenomenon is that people believe that font size affects memory.


2 Answers

I came across this thread when I was having similar issues with Opera 11.10 on Windows 7 x64.

Opera was defaulting to using 20px as the body font-size (rather than 16px which is what other browsers use). This persisted even after uninstalling, deleting Opera preferences and re-installing. It turns out that Opera will honor your system font-size preferences (set under 'Control Panel\Appearance and Personalization\Display' on Win7) for rendered website text whereas other browsers (I tested FF4, Chrome 11, Safari 5, IE 9) do not. My system font size was set to 125% which explains the 20px. Once I set my system font zoom to 100%, Opera behaved the same as the others.

I'm not sure which behavior is more correct (In a way, it's nice that Opera honors my font choice) but since since other browsers do not do the same, it is "unexpected". I don't have a Mac to test but perhaps MacOS has a similar system font preference?

like image 145
Eoin Kelly Avatar answered Oct 13 '22 11:10

Eoin Kelly


I was having a similar issue.

I found that the default computed font size in FF and most other browsers on is 16px, but on opera the default seems to be 20px.

I simply set font-size:16px; for html, and it seemed to take care of it.

like image 45
phazei Avatar answered Oct 13 '22 11:10

phazei