This is an error I am getting in Chrome and unfortunately searching for it hasn't given me much results. The font itself is appearing correctly. However I still get this error/warning. More specifically, this is the full warning:
"Failed to decode downloaded font: http://localhost:8000/app/fonts/Lato/"
My CSS are these:
@font-face {
font-family:"Lato";
src: url("../fonts/Lato/");
}
html, body {
font-family:'Lato';
}
I just do not understand. The font is applied correctly, but the warning is always there. Trying to use Sans-Serif
makes the font revert to the normal browser font, so that may be it, but I am not sure, and even after searching I have found nothing. Thanks!
EDIT
There are various font files, all from the same family. I am trying to load them all. The font files are .ttf
. I am loading them from a local folder, and there are various font-files, like Lato-Black.ttf
, Lato-Bold.ttf
, Lato-Italic.ttf
etc.
I was having the same issue with font awesome v4.4 and I fixed it by removing the woff2 format. I was getting a warning in Chrome only.
For me, this error was occuring when I referenced a google font using https. When I switched to http, the error went away. (and yes, I tried it multiple times to confirm that was the cause)
So I changed:
To:
I use .Net Framework 4.5/IIS 7
To fix it I put file Web.config in folder with font file.
Content of Web.config:
In my case when downloading a template the font fileswere just empty files. Probably an issue with the download. Chrome gave this generic error about. I thought at first the solution of changing from
woff
tofont-woff
solved it, but it only made Chrome ignore the fonts. My solution was finding the fonts one by one and downloading/replacing them.I also had same problem but i have solved by adding 'Content-Type' : 'application/x-font-ttf' in response header for all .ttf files
If you are using express you need to allow serving of static content by adding something like: var server = express(); server.use(express.static('./public')); // where public is the app root folder, with the fonts contained therein, at any level, i.e. public/fonts or public/dist/fonts... // If you are using connect, google for a similar configuration.