Downloadable font rejected by sanitizer как исправить

I want to use a font in my web page but i get these error messages in firefox when loading page: downloadable font: rejected by sanitizer (font-family: "Yekan" style:normal weight:normal stretch:n...

I want to use a font in my web page but i get these error messages in firefox when loading page:

downloadable font: rejected by sanitizer (font-family: "Yekan" style:normal weight:normal stretch:normal src index:1) source: .../css/Yekan.woff2  custom.css:1:12
downloadable font: incorrect file size in WOFF header (font-family: "Yekan" style:normal weight:normal stretch:normal src index:2) source: .../css/Yekan.woff  custom.css:1:12
downloadable font: rejected by sanitizer (font-family: "Yekan" style:normal weight:normal stretch:normal src index:2) source: .../css/Yekan.woff  custom.css:1:12
downloadable font: FFTM: invalid table offset (font-family: "Yekan" style:normal weight:normal stretch:normal src index:3) source: .../css/Yekan.ttf  custom.css:1:12
downloadable font: rejected by sanitizer (font-family: "Yekan" style:normal weight:normal stretch:normal src index:3) source: .../css/Yekan.ttf  custom.css:1:12
downloadable font: CFF : table overruns end of file (font-family: "Yekan" style:normal weight:normal stretch:normal src index:4) source: .../css/Yekan.otf  custom.css:1:12
downloadable font: rejected by sanitizer (font-family: "Yekan" style:normal weight:normal stretch:normal src index:4) source: .../css/Yekan.otf

my custom.css file:

@font-face {
    font-family: 'Yekan';
    src: url('./Yekan.eot');
    src: url('./Yekan.eot?#iefix') format("embedded-opentype"),
    url('./Yekan.woff2') format('woff2'),
    url('./Yekan.woff') format('woff'),
    url('./Yekan.ttf') format('truetype'),
    url('./Yekan.otf') format('opentype'),
    url('.//Yekan.svg#Yekan') format('svg');
    font-weight: normal;
    font-style: normal;
}

my style.css (where i use the font):

body
{
   font-family: "Yekan";
}
  • I have searched a lot and found nothing to solve this.
  • I have used this font before and I had no problem.
  • I checked the meme type and it was correct (for example meme type of Yekan.ttf was application/x-font-ttf).

asked Sep 7, 2019 at 16:29

Mohammad's user avatar

5

I have found the problem, I used Filezilla to upload fonts to server and it was set on ASCII transfer mode, after switching to Binary and re-uploading fonts problem solved.

answered Sep 7, 2019 at 18:31

Mohammad's user avatar

MohammadMohammad

1611 gold badge1 silver badge6 bronze badges

I recently had this problem with the icon font of the npm package bootstrap-icons version 1.5.0 on the server. I’m using the icons classes and wrapping them with own class names in SCSS.

The solution for me was to redefine the bootstrap font-family and copy and rename the font files to the project. So it looks in styles.scss like this:

@font-face {
  font-family: "bootstrap-icons-redef";
  src: url("../assets/fonts/bootstrap-icons-redef.woff2") format("woff2"),
  url("../assets/fonts/bootstrap-icons-redef.woff") format("woff");
}

A small disadvantage of this solution is that I have to check node_modules/bootstrap-icons/font/bootstrap-icons.css on every update to be sure my redefinition is still in sync with the file above.

answered Sep 22, 2021 at 12:54

Juri Sinitson's user avatar

I want to use a font in my web page but i get these error messages in firefox when loading page:

downloadable font: rejected by sanitizer (font-family: "Yekan" style:normal weight:normal stretch:normal src index:1) source: .../css/Yekan.woff2  custom.css:1:12
downloadable font: incorrect file size in WOFF header (font-family: "Yekan" style:normal weight:normal stretch:normal src index:2) source: .../css/Yekan.woff  custom.css:1:12
downloadable font: rejected by sanitizer (font-family: "Yekan" style:normal weight:normal stretch:normal src index:2) source: .../css/Yekan.woff  custom.css:1:12
downloadable font: FFTM: invalid table offset (font-family: "Yekan" style:normal weight:normal stretch:normal src index:3) source: .../css/Yekan.ttf  custom.css:1:12
downloadable font: rejected by sanitizer (font-family: "Yekan" style:normal weight:normal stretch:normal src index:3) source: .../css/Yekan.ttf  custom.css:1:12
downloadable font: CFF : table overruns end of file (font-family: "Yekan" style:normal weight:normal stretch:normal src index:4) source: .../css/Yekan.otf  custom.css:1:12
downloadable font: rejected by sanitizer (font-family: "Yekan" style:normal weight:normal stretch:normal src index:4) source: .../css/Yekan.otf

my custom.css file:

@font-face {
    font-family: 'Yekan';
    src: url('./Yekan.eot');
    src: url('./Yekan.eot?#iefix') format("embedded-opentype"),
    url('./Yekan.woff2') format('woff2'),
    url('./Yekan.woff') format('woff'),
    url('./Yekan.ttf') format('truetype'),
    url('./Yekan.otf') format('opentype'),
    url('.//Yekan.svg#Yekan') format('svg');
    font-weight: normal;
    font-style: normal;
}

my style.css (where i use the font):

body
{
   font-family: "Yekan";
}
  • I have searched a lot and found nothing to solve this.
  • I have used this font before and I had no problem.
  • I checked the meme type and it was correct (for example meme type of Yekan.ttf was application/x-font-ttf).

asked Sep 7, 2019 at 16:29

Mohammad's user avatar

5

I have found the problem, I used Filezilla to upload fonts to server and it was set on ASCII transfer mode, after switching to Binary and re-uploading fonts problem solved.

answered Sep 7, 2019 at 18:31

Mohammad's user avatar

MohammadMohammad

1611 gold badge1 silver badge6 bronze badges

I recently had this problem with the icon font of the npm package bootstrap-icons version 1.5.0 on the server. I’m using the icons classes and wrapping them with own class names in SCSS.

The solution for me was to redefine the bootstrap font-family and copy and rename the font files to the project. So it looks in styles.scss like this:

@font-face {
  font-family: "bootstrap-icons-redef";
  src: url("../assets/fonts/bootstrap-icons-redef.woff2") format("woff2"),
  url("../assets/fonts/bootstrap-icons-redef.woff") format("woff");
}

A small disadvantage of this solution is that I have to check node_modules/bootstrap-icons/font/bootstrap-icons.css on every update to be sure my redefinition is still in sync with the file above.

answered Sep 22, 2021 at 12:54

Juri Sinitson's user avatar

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and
privacy statement. We’ll occasionally send you account related emails.

Already on GitHub?
Sign in
to your account


Closed

africanw opened this issue

Dec 4, 2015

· 6 comments

Comments

@africanw

Hi,

Been using the fonts for a while but yesterday I upgraded from 4.2 to 4.5 and noticed in firefoxs console an error appears which did not before. If I put 4.2 back the error does not show in firefox.

error:
downloadable font: rejected by sanitizer (font-family: «FontAwesome» style:normal weight:normal stretch:normal src index:1) source: https://reports3.wagtailanalytics.com/css/foaw4.5/fonts/fontawesome-webfont.woff2

@font-face {
font-family: «FontAwesome»;
font-style: normal;
font-weight: …

font-aw…min.css (line 4, col 14)

@rmkane

Apparently you get this issue in Firefox is you run out of memory.

Mozilla Support

Error: downloadable font: rejected by sanitizer

Chosen Solution

You get this error if you run out of memory when loading the fontfile or if there is something wrong with the layout (contents) of the fontfile. This is a protection against bad or malicious font files. It is probably possible to disable the sanitizer by setting the pref gfx.downloadable_fonts.sanitize to false in about:config but then you are no longer protected. Use at your own risk. Do not blame Mozilla if you are infected with malware.

Side note…

You can embed code like so…

 | ```css
 | @font-face {
 |     font-family: "FontAwesome";
 |     font-style: normal;
 |     font-weight: ...
 | }
 | ```

Note: Ignore the | (pipes) in the markdown…


Which results in:

@font-face {
    font-family: "FontAwesome";
    font-style: normal;
    font-weight: ...
}

@africanw

but don’t get the error if I use 4.2. I also upgraded Firefox to the latest version and restart it and same error exists.

@rmkane

@tagliala

Sorry, cannot confirm.

Been using the fonts for a while but yesterday I upgraded from 4.2 to 4.5 and noticed in firefoxs console an error appears which did not before. If I put 4.2 back the error does not show in firefox.

Self hosting? CDN? 4.2.0 didn’t support woff2, which was introduced in 4.3.0. maybe there is something to do with mime types #4261

Feel free to discuss this issue but I’m going to close this one

@africanw

Ah ok I got it, your comment about woff2 got me looking into mime types and the webserver was setup for woff only so added woff2 and all good now.

Thanks

@tagliala

you’re welcome, glad you solved

Remove the ?v=4.6.3 and remaining tail from this block (font-awesome.css / font-awesome.min.css).

@font-face {
  font-family: 'FontAwesome';
  src: url('../fonts/fontawesome-webfont.eot?v=4.6.3');
  src: url('../fonts/fontawesome-webfont.eot?#iefix&v=4.6.3') format('embedded-opentype'), 
  url('../fonts/fontawesome-webfont.woff2?v=4.6.3') format('woff2'),
  url('../fonts/fontawesome-webfont.woff?v=4.6.3') format('woff'),
  url('../fonts/fontawesome-webfont.ttf?v=4.6.3') format('truetype'), 
  url('../fonts/fontawesome-webfont.svg?v=4.6.3#fontawesomeregular') format('svg');
  font-weight: normal;

Updated to:

@font-face {
  font-family: 'FontAwesome';
  src: url('../fonts/fontawesome-webfont.eot');
  src: url('../fonts/fontawesome-webfont.eot') format('embedded-opentype'), 
  url('../fonts/fontawesome-webfont.woff2') format('woff2'), 
  url('../fonts/fontawesome-webfont.woff') format('woff'), 
  url('../fonts/fontawesome-webfont.ttf') format('truetype'), 
  url('../fonts/fontawesome-webfont.svg') format('svg');
  font-weight: normal;
  font-style: normal;
}

Я скачал TTF-шрифт «Clunk» и пытаюсь применить его к какому-либо тексту.

Вот код, который я использую:

<html>
<head>
<style>
@font-face {
    font-family: clunk;
    src: url('clunk.ttf');
}

h1 {
    font-family: clunk;
}
</style>
</head>
<body>
<h1 id="logo">Test</h1>
</body>
</html>

Кажется, это не работает, и Chrome выдает мне две ошибки:

Failed to decode downloaded font: (path to the file)
OTS parsing error: incorrect entrySelector for table directory

В Firefox это ошибки, которые появляются:

downloadable font: bad search range (font-family: "clunk" style:normal weight:normal stretch:normal src index:0) source: (path to the file)  test.html:4:12

downloadable font: incorrect entrySelector for table directory (font-family: "clunk" style:normal weight:normal stretch:normal src index:0) source: (path to the file)  test.html:4:12

downloadable font: rejected by sanitizer (font-family: "clunk" style:normal weight:normal stretch:normal src index:0) source: (path to the file)

Я гуглил эти ошибки, но эта проблема кажется очень широкой, и было трудно найти минимальные примеры. Что будет причиной ошибки в этой простой ситуации?

6 ответов

Лучший ответ

Я нашел этот ответ 2009 года, в котором предлагалось восстановить шрифт с помощью FontForge. Я попробовал это, и это решило проблему, так что, похоже, это была проблема с самим шрифтом, а не с кодом.

В данном конкретном случае буквы в шрифте были «отсутствующими точками в экстремумах», которые FontForge удалось решить одним щелчком мыши.


2

Pikamander2
19 Июн 2017 в 06:13

Перейти к:

http://yourwebsite/clunk.ttf

Если это не удается загрузить (как говорится в первой ошибке), то местоположение вашего файла неверно. Возможно, вам придется установить абсолютный путь, например:

http://yourwebsite/somesubpath/clunk.ttf

Или же

/somesubpath/clunk.ttf


0

Norbert van Nobelen
19 Июн 2017 в 05:12

Проверьте ваши пути. Лучшие практики — всегда использовать относительные пути (например, :)

 src: url('fonts/clunk.ttf') format('truetype');

Проверьте заголовок: Access-Control-Allow-Origin

enter image description here


1

Hash
19 Июн 2017 в 05:39

Попробуй это

src: url('/clunk.ttf');


1

clarkoy
19 Июн 2017 в 05:12

Это может помочь вам.

https://everythingfonts.com/ttf-to-woff

В основном, что вам нужно сделать, это:

-Конвертировать .ttf в .woff

Я не знаю, почему это работает. Но это всегда работает для меня. Также … удалите кеш или измените имя файла.

Надеюсь, это поможет


2

Monwell Partee
19 Июн 2017 в 06:46

Изменить семейство шрифтов: clunk на семейство шрифтов: «clunk». Затем проверьте свой путь


2

ßãlãjî
9 Ноя 2019 в 14:55

I have problems with a font (font awesome). I have searched for a fix and what I found that causes the problem is the version query ('../fonts/fontawesome-webfont.woff2?v=4.7.0') but in my case that does’t fix the problem.

I have noticed that the problem comes from the nginx‘s conf file:

location / {
    try_files $uri $uri/ /index.php?$args;
    rewrite ^/(.*)$ /index.php?p=$1 last;
}

If I remove the rewrite ^/(.*)$ /index.php?p=$1 last; line the font loads just fine.

Here is what firefox says:

downloadable font: rejected by sanitizer (font-family: «FontAwesome» style:normal weight:normal stretch:normal src index:1) source: http://example.com/assets/font-awesome/fonts/fontawesome-webfont.woff2

And here is what chrome says:

Failed to decode downloaded font: http://example.com/assets/font-awesome/fonts/fontawesome-webfont.woff2
(index):1 OTS parsing error: invalid version tag

Thomas's user avatar

Thomas

4,1955 gold badges21 silver badges28 bronze badges

asked Oct 22, 2017 at 3:37

Bogdan Galan's user avatar

6

I have added the folowing in my nginx conf and is working

location ~* .(eot|otf|ttf|woff|woff2)$ {
add_header Access-Control-Allow-Origin *;
}

But I still don’t belive it was because of this.

answered Oct 22, 2017 at 4:25

Bogdan Galan's user avatar

Bogdan GalanBogdan Galan

511 gold badge2 silver badges7 bronze badges

1

For those lost souls of you that still got «Downloadable font rejected by sanitizer» while hosting fonts on a nginx server. I checked my nginx logs /var/log/nginx/error.log, guess what: wrong permissions to fonts folder face-palm

...."/var/www/example/public/static/fonts/fontname.woff" failed (13: Permission denied)

answered Sep 15, 2022 at 21:36

ned's user avatar

1

Понравилась статья? Поделить с друзьями:

Читайте также:

  • Download tool idt error 39
  • Download pending как исправить
  • Download paused because wifi is disabled как исправить
  • Download obb service is running pubg как исправить
  • Download master error

  • 0 0 голоса
    Рейтинг статьи
    Подписаться
    Уведомить о
    guest

    0 комментариев
    Старые
    Новые Популярные
    Межтекстовые Отзывы
    Посмотреть все комментарии