IE8 Renders font weights randomly

2020-03-07 06:42发布

问题:

On a webpage in IE8 I have 4 custom fonts in CSS using font-face, two of each font go to the same family for bold and normal weights.

I have found that IE8 randomly renders the non bold as bold and sometimes vice-versa. If I sit at the page pressing refresh each time it loads the text changes, seemingly randomly.

I even tried having javascript set the fonts for elements only after everything is loaded - and it still occurs.

Any one know whats going on?

回答1:

I've had the same issue when using multiple weights and styles of a single font in IE8. Typekit has an article that explains this bug in IE8 and below: Using multiple weights and styles

According to them:

"Internet Explorer 6, 7, & 8 load a maximum of four weights per family. Additionally, using two closely-related weights (e.g., 400 and 500) may result in only one weight loading correctly."

Using variation specific seems to be the way to solve this. Like so (snippet from a Myfonts.com web font kit):

@font-face {
  font-family: 'AvenirNextLTPro-DemiIt'; /* Demibold Italic */
  font-style: italic;
  font-weight: 600;
  src: url('webfonts/25A826_1_0.eot');
  src: url('webfonts/25A826_1_0.eot?#iefix') format('embedded-opentype'),url('webfonts/25A826_1_0.woff') format('woff'),url('webfonts/25A826_1_0.ttf') format('truetype');
}

@font-face {
  font-family: 'AvenirNextLTPro-BoldIt'; /* Bold Italic */
  font-style: italic;
  font-weight: 700;
  src: url('webfonts/25A826_6_0.eot');
  src: url('webfonts/25A826_6_0.eot?#iefix') format('embedded-opentype'),url('webfonts/25A826_6_0.woff') format('woff'),url('webfonts/25A826_6_0.ttf') format('truetype');
}

 

.someclass {
  font-family: 'AvenirNextLTPro-DemiIt'; /* Demibold Italic */
  font-style: italic;
  font-weight: 600;
}
.otherclass {
  font-family: 'AvenirNextLTPro-BoldIt'; /* Bold Italic */
  font-style: italic;
  font-weight: 700;
}