erikflowers / weather-icons

215 Weather Themed Icons and CSS
https://github.com/erikflowers/weather-icons
6.92k stars 850 forks source link

downloadable font rejected by sanitizer weathericons #181

Closed Aror closed 3 years ago

Aror commented 7 years ago

Hi, I keep getting the error:

"downloadable font: rejected by sanitizer (font-family: "weathericons" style:normal weight:normal stretch:normal src index:0) source: http://localhost:3000/css/font/weathericons-regular-webfont.ttf"

The font works fine if I simply open the index.html file but when I serve it via a web server, I encounter the above error.

This is the css code I am using:

@font-face { font-family: "weathericons"; src: url('../font/weathericons-regular-webfont.ttf') format('truetype'); font-weight: normal; font-style: normal; }

UPDATE: I just tried using another font from here: http://forecastfont.iconvau.lt/ and I used it in the same manner as weathericons font. I also used the truetype format (ttf). It works and does not give me a rejected by sanitizer error. I believe there might be an issue with the weathericons font code. Please look into this.

erikflowers commented 7 years ago

I don't have any idea what the error could be about, but I would try the woff file as well, that is probably a more reliable format to use for a webfont. Is there a reason you're only using the truetype and not the whole file stack, or at last the woff or woff2?

Aror commented 7 years ago

@erikflowers Hi Erik. I must apologize as I think the problem is indeed with the way I have configured my server and not with the font file.

I changed the directory of the font file to be in the same directory as the css file that imports the font and I no longer get the sanitizer error. I don't know why this solution works but it does and your font renders fine now.

However, I have tried the same with the woff font file and i get a sanitizer error. Even though I'd prefer to use the woff font due to its wider support, I can't because of the sanitizer error. Maybe this is also a problem on my end but I am not sure so ill stick with the ttf font.