Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Font weight ignored in Chrome

I created a fiddle trying to use Open Sans font with font-weight 300:

HTML

<span class="demo">example</span> 

CSS

.demo {   font-weight: 400 !important;   font-family: 'Open Sans' !important;   font-style: normal;   font-variant: normal; } 

I use Google fonts to define the CSS

I can see a difference in Firefox (Ubuntu 13.10) when rendering at font-weight: 300 (light) and at font-weight: 400 (normal) but none in Chrome (Version 33.0.1750.117 ), where everything looks like it's rendered at font-weight:400. Am I doing something wrong or is there a bug in Chrome? Is there any known workaround?

Update:

There is definitely something wrong with chrome I have two instances of the same page open in 2 different windows in Chrome. One is rendering the font ok (300 weight corresponds to the light variant) and one is not (300 weight is the same as the Normal variant). Any clues? I've made sure to refresh the page in each tab so they are actually the same page.

Update 2: Attached screenshot: of the bug: Chrome font rendering bug

Update 3 This is not a duplicate of this. In that question the problem is that "Arial Black" and "Arial" are different fonts actually. In my case Open Sans is the only font and the problem is Chrome picking up the incorrect weight some times. As you can see from the screenshots, Chrome is not consistent with the font rendered even between two instances.

like image 941
vseguip Avatar asked Feb 24 '14 23:02

vseguip


People also ask

Why my font weight is not working?

font-weight can also fail to work if the font you are using does not have those weights in existence – you will often hit this when embedding custom fonts. In those cases the browser will likely round the number to the closest weight that it does have available.

Why is my font messed up 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.


1 Answers

Add this to your CSS:

* {-webkit-font-smoothing: antialiased;} 
like image 108
Fred K Avatar answered Sep 21 '22 15:09

Fred K