css – Failed to decode downloaded font, OTS parsing error: invalid version tag + rails 4

css – Failed to decode downloaded font, OTS parsing error: invalid version tag + rails 4

I got the exact same error, and in my case it turned out to be because of a wrong path for the @font-face declaration. The web inspector never complained with a 404 since the dev server were using (live-server) was configured to serve up the default index.html on any 404:s. Without knowing any details about your setup, this could be a likely culprit.

If running on IIS as the server and .net 4/4.5 it might be missing mime / file extension definitions in Web.config – like this:

<system.webServer>
	<staticContent>
      <remove fileExtension=.eot />
      <mimeMap fileExtension=.eot mimeType=application/vnd.ms-fontobject />
      <remove fileExtension=.ttf />
      <mimeMap fileExtension=.ttf mimeType=application/octet-stream />
      <remove fileExtension=.svg />
      <mimeMap fileExtension=.svg mimeType=image/svg+xml />
      <remove fileExtension=.woff />
      <mimeMap fileExtension=.woff mimeType=application/font-woff />
    </staticContent>
</system.webServer>

css – Failed to decode downloaded font, OTS parsing error: invalid version tag + rails 4

I was having the same issue.,
OTS parsing error: Failed to convert WOFF 2.0 font to SFNT
(index):1 Failed to decode downloaded font: http://dev.xyz/themes/custom/xyz_theme/fonts/xyz_rock/rocksansbold/Rock-SansBold.woff2

If you got this error message while trying to commit your font then it is an issue with .gitattributes
warning: CRLF will be replaced by LF

The solution for this is adding whichever font you are getting the issue with in .gitattributes

*.ttf     -text diff
*.eot     -text diff
*.woff    -text diff
*.woff2   -text diff

Then I deleted corrupt font files and reapplied the new font files and is working great.

Leave a Reply

Your email address will not be published.