Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Fonts looks different in Firefox and Chrome

I am using Google Web Font's PT-sans

font-family: 'PT Sans',Arial,serif; 

but it looks different in Chrome and Firefox

Is there anything that I need to add so that it looks same in all browsers?

like image 612
Tushar Ahirrao Avatar asked Jan 15 '11 07:01

Tushar Ahirrao


People also ask

Why does my font look different in Firefox?

Chosen solution You can check in the Rules tab in the right panel in the Inspector what font-family is used for selected text. You can check in the Font tab in the right panel in the Inspector what font is actually used because Firefox might be using a different font than specified by the website.

Why do fonts look different in 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.

Why does the font look weird in Chrome?

Go to Control Panel > Appearance and Personalization > Display > Adjust ClearType text (on the left). Check the box entitled “Turn on ClearType.” After going through a short wizard, this will fix some of the text rendering issues in Chrome. Enable "Disable accelerated 2D Canvas" in Chrome.

How do I stop different browsers rendering fonts differently?

To stop this happening make sure in your CSS you have font-weight: normal and font-style: normal in your @fontface code block. You then need to apply the necessary styles to the HTML elements. And then add the specific styles for each element that uses that font.


2 Answers

For the ChunkFive font from FontSquirrel, specifying "font-weight: normal;" stopped Firefox's rendering from looking like ass when used in a header. Looks like Firefox was trying to apply a fake bold to a font that only has one weight, while Chrome was not.

like image 178
Sergiy Avatar answered Oct 03 '22 16:10

Sergiy


For me, Chrome web fonts look crappy until I put the SVG font ahead of WOFF and TrueType. For example:

@font-face {     font-family: 'source_sans_proregular';     src: url('sourcesanspro-regular-webfont.eot');     src: url('sourcesanspro-regular-webfont.eot?#iefix') format('embedded-opentype'),          url('sourcesanspro-regular-webfont.svg#source_sans_proregular') format('svg'),          url('sourcesanspro-regular-webfont.woff') format('woff'),          url('sourcesanspro-regular-webfont.ttf') format('truetype');     font-weight: normal;     font-style: normal; } 

Even then, Chrome's fonts look thinner than in Firefox or IE. Chrome looks good at this point, but I usually want to set different fonts in IE and Firefox. I use a mixture of IE conditional comments and jQuery to set different fonts depending on the browser. For Firefox, I have the following function run when the page loads:

function setBrowserClasses() {     if (true == $.browser.mozilla) {         $('body').addClass('firefox');     } } 

Then in my CSS, I can say

body { font-family: "source_sans_proregular", Helvetica, sans-serif; } body.firefox { font-family: "source_sans_pro_lightregular", Helvetica, sans-serif; } 

Likewise, in an IE-only stylesheet included within IE conditional comments, I can say:

body { font-family: "source_sans_pro_lightregular", Helvetica, sans-serif; } 
like image 32
Sarah Vessels Avatar answered Oct 03 '22 17:10

Sarah Vessels