0

I checked all of SO, but wasn't able to figure out what's wrong in my specific case.

Here's my CSS:

@font-face {
  font-family: 'Open Sans';
  font-style: normal;
  font-weight: 300;
  src: local('Open Sans Light'), local('OpenSans-Light'), url(/assets/fonts/OpenSans-Light.ttf) format('truetype');
}
@font-face {
  font-family: 'Open Sans';
  font-style: normal;
  font-weight: 400;
  src: local('Open Sans'), local('OpenSans'), url(/assets/fonts/OpenSans-Regular.ttf) format('truetype');
}

But Chrome keeps throwing a Failed to decode downloaded font and OTS parsing error: DSIG: invalid table offset error in the console. As a result, the fonts are not being applied on the elements properly. The URL to the fonts are definitely correct, so I am not sure what's going wrong here.

This is only happening in Chrome. It works fine in Safari.

DemCodeLines
  • 1,870
  • 8
  • 41
  • 60

1 Answers1

1

I think your url attribute should lose the first / so it will look like this - just to try and troubleshoot, give that a shot.

@font-face {
  font-family: 'Open Sans';
  font-style: normal;
  font-weight: 300;
  src: local('Open Sans Light'), local('OpenSans-Light'), url(assets/fonts/OpenSans-Light.ttf) format('truetype');
}
@font-face {
  font-family: 'Open Sans';
  font-style: normal;
  font-weight: 400;
  src: local('Open Sans'), local('OpenSans'), url(assets/fonts/OpenSans-Regular.ttf) format('truetype');
}

Also for the sake of troubleshooting try linking directly from the Google Fonts site - if that works it will give clues to other issues.

jacobherrington
  • 447
  • 4
  • 17