Failed to decode downloaded font как исправить

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.

Shashank Agrawal's user avatar

asked May 25, 2015 at 16:21

Luís Ferreira's user avatar

Luís FerreiraLuís Ferreira

2,4283 gold badges19 silver badges27 bronze badges

3

In the css rule you have to add the extension of the file.
This example with the deepest support possible:

@font-face {
  font-family: 'MyWebFont';
  src: url('webfont.eot'); /* IE9 Compat Modes */
  src: url('webfont.eot?#iefix') format('embedded-opentype'), /* IE6-IE8 */
       url('webfont.woff2') format('woff2'), /* Super Modern Browsers */
       url('webfont.woff') format('woff'), /* Pretty Modern Browsers */
       url('webfont.ttf')  format('truetype'), /* Safari, Android, iOS */
       url('webfont.svg#svgFontName') format('svg'); /* Legacy iOS */
}

EDIT:

“Failed to decode downloaded font” means the font is corrupt, or is incomplete (missing metrics, necessary tables, naming records, a million possible things).

Sometimes this problem is caused by the font itself. Google font provides the correct font you need but if font face is necessary i use Transfonter to generate all font format.

Sometimes is the FTP client that corrupt the file (not in this case because is on local pc). Be sure to transfer file in binary and not in ASCII.

answered May 25, 2015 at 16:28

Germano Plebani's user avatar

Germano PlebaniGermano Plebani

3,4403 gold badges26 silver badges38 bronze badges

5

I experienced a similar issue in Visual Studio, which was being caused by an incorrect url() path to the font in question.

I stopped getting this error after changing (for instance):

@@font-face{
    font-family: "Example Font";
    src: url("/Fonts/ExampleFont.eot?#iefix");

to this:

@@font-face{
    font-family: "Example Font";
    src: url("../fonts/ExampleFont.eot?#iefix");

answered Jun 30, 2015 at 15:34

alex's user avatar

2

I had to add type="text/css" to my link-tag. I changed it from:

<link href="https://fonts.googleapis.com/css?family=Roboto+Condensed:300,400,700" rel="stylesheet">

to:

<link href="https://fonts.googleapis.com/css?family=Roboto+Condensed:300,400,700" rel="stylesheet" type="text/css">

After I changed it the error disappeared.

answered May 26, 2017 at 10:03

nabjoern's user avatar

nabjoernnabjoern

1511 silver badge3 bronze badges

1

Make sure your server is sending the font files with the right mime/type.

I recently have the same problem using nginx because some font mime types are missing from its vanilla /etc/nginx/mime.types file.

I fixed the issue adding the missing mime types in the location where I needed them like this:

location /app/fonts/ {

  #Fonts dir
  alias /var/www/app/fonts/;

  #Include vanilla types
  include mime.types;

  #Missing mime types
  types  {font/truetype ttf;}
  types  {application/font-woff woff;}
  types  {application/font-woff2 woff2;}
}

You can also check this out for extending the mime.types in nginx:
extending default nginx mime.types file

Community's user avatar

answered Apr 11, 2016 at 9:04

Matteo's user avatar

MatteoMatteo

1,65417 silver badges24 bronze badges

I just had the same issue and solved it by changing

src: url("Roboto-Medium-webfont.eot?#iefix")

to

src: url("Roboto-Medium-webfont.eot?#iefix") format('embedded-opentype')

answered Jan 27, 2016 at 15:42

Christian Rauchenwald's user avatar

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:

@import url(https://fonts.googleapis.com/css?family=Roboto:300,400,100,500,900);

To:

@import url(http://fonts.googleapis.com/css?family=Roboto:300,400,100,500,900);

answered Mar 31, 2017 at 20:56

Venryx's user avatar

VenryxVenryx

15k10 gold badges68 silver badges94 bronze badges

2

Changing format('woff') to format('font-woff') solves the problem.

Just a little change compared to Germano Plebani’s answer

 @font-face {
  font-family: 'MyWebFont';
  src: url('webfont.eot'); /* IE9 Compat Modes */
  src: url('webfont.eot?#iefix') format('embedded-opentype'), /* IE6-IE8 */
       url('webfont.woff2') format('woff2'), /* Super Modern Browsers */
       url('webfont.woff') format('font-woff'), /* Pretty Modern Browsers */
       url('webfont.ttf')  format('truetype'), /* Safari, Android, iOS */
       url('webfont.svg#svgFontName') format('svg'); /* Legacy iOS */
}

Please check if your browser sources can open it and what is the type

Willi Mentzel's user avatar

Willi Mentzel

27.2k20 gold badges112 silver badges119 bronze badges

answered Oct 26, 2016 at 7:01

Fuad Husni's user avatar

Fuad HusniFuad Husni

3272 silver badges4 bronze badges

7

Sometimes this problem happens when you upload/download the fonts using the wrong FTP method.
Fonts must be FTP-ed using binary method, not ASCII. (Depending on your mood, it may feel counterintuitive, lol).
If you ftp the font files using ASCII method, you can get this error message.
If you ftp your files with an ‘auto’ method, and you get this error message, try ftp forcing the binary method.

answered Feb 21, 2016 at 5:39

Giuseppe's user avatar

GiuseppeGiuseppe

45413 silver badges24 bronze badges

My problem was occurring in browsers different than chrome.
Pay attention to the coma between URL and format, this is how everything went back to normal for all the browsers. Honestly, it works without this “format” too but I decided to leave it be.

@font-face {
  font-family: "Roboto";
  src: url("~path_to_font/roboto.ttf"), format("truetype");
}

answered Apr 4, 2021 at 16:35

MetaTron's user avatar

MetaTronMetaTron

8658 silver badges13 bronze badges

1

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.

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

answered Sep 11, 2015 at 22:24

Francisco Goldenstein's user avatar

1

In my case it was caused with an incorrect path file, in .htaccess.
please check correctness of your file path.

answered Aug 10, 2016 at 16:34

Ebrahim's user avatar

EbrahimEbrahim

1,7222 gold badges25 silver badges31 bronze badges

AWS Amplify specific Failed to decode downloaded font issue as above – but adding woff2 to the default Target address /index.html rule in App setting / Rewrites and redirects resolved any woff2 errors 👍

Before

</^[^.]+$|.(?!(css|gif|ico|jpg|js|png|txt|svg|woff|ttf|map|json)$)([^.]+$)/>

After

</^[^.]+$|.(?!(css|gif|ico|jpg|js|png|txt|svg|woff|woff2|ttf|map|json)$)([^.]+$)/>

answered Dec 8, 2021 at 16:53

tim's user avatar

timtim

3,2563 gold badges21 silver badges13 bronze badges

I also had same problem but i have solved by adding ‘Content-Type’ : ‘application/x-font-ttf’ in response header for all .ttf files

answered Jun 17, 2017 at 10:32

U_R_Naveen UR_Naveen's user avatar

1

In my case, this was caused by creating a SVN patch file that encompassed the addition of the font files. Like so:

  1. Add font files from local file system to subversioned trunk
  2. Trunk works as expected
  3. Create SVN patch of trunk changes, to include addition of font files
  4. Apply patch to another branch
  5. Font files are added to subversioned branch (and can be committed), but are corrupted, yielding error in OP.

The solution was to upload the font files directly into the branch from my local file system. I assume this happened because SVN patch files must convert everything to ASCII format, and don’t necessarily retain binary for font files. But that’s only a guess.

answered Jun 25, 2017 at 18:32

Matt's user avatar

MattMatt

23.2k39 gold badges110 silver badges151 bronze badges

For me, the mistake was forgetting to put FTP into binary mode before uploading the font files.

Edit

You can test for this by uploading other types of binary data like images. If they also fail to display, then this may be your issue.

answered Jun 8, 2017 at 11:11

Robert Gowland's user avatar

Robert GowlandRobert Gowland

7,5675 gold badges40 silver badges58 bronze badges

3

In my case — using React with Gatsby — the issue was solved with double-checking all of my paths. I was using React/Gatsby with Sass and the Gatsby source files were looking for the fonts in a different place than the compiled files. Once I duplicated the files into each path this problem was gone.

answered Aug 27, 2019 at 22:24

Raydot's user avatar

RaydotRaydot

1,3851 gold badge21 silver badges38 bronze badges

In my case when downloading a template the font files were just empty files. Probably an issue with the download. Chrome gave this generic error about it. I thought at first the solution of changing from woff to font-woff solved it, but it only made Chrome ignore the fonts. My solution was finding the fonts one by one and downloading/replacing them.

answered Dec 4, 2018 at 21:27

André C. Andersen's user avatar

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.

answered Jan 11, 2016 at 3:46

Cleophas Mashiri's user avatar

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:

<?xml version="1.0"?>
<configuration>
  <system.web>
    <authorization>
      <allow users="*" />
    </authorization>
  </system.web>
</configuration>

answered Nov 19, 2018 at 11:10

Андрей Приймак's user avatar

If it is on the server (not in localhost), then try to upload the fonts manually, because sometimes the FTP client (for example, FileZilla) corrupts the files and it can cause the problem. For me, I uploaded manually using Cpanel interface.

answered Jul 20, 2019 at 7:25

Saidmamad's user avatar

SaidmamadSaidmamad

631 silver badge13 bronze badges

My case looked similar but the font was corrupted (and so impossible to decode). It was caused by configuration in maven. Adding nonFilteredFileExtension for font extensions within maven-resources-plugin helped me:

<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-resources-plugin</artifactId>
    <configuration>
        <nonFilteredFileExtensions>
            <nonFilteredFileExtension>ttf</nonFilteredFileExtension>
            <nonFilteredFileExtension>otf</nonFilteredFileExtension>
            <nonFilteredFileExtension>woff</nonFilteredFileExtension>
            <nonFilteredFileExtension>woff2</nonFilteredFileExtension>
            <nonFilteredFileExtension>eot</nonFilteredFileExtension>
        </nonFilteredFileExtensions>
    </configuration>
</plugin>

answered Apr 15, 2020 at 20:56

Fenix's user avatar

FenixFenix

2,2011 gold badge16 silver badges23 bronze badges

Google also fails…

Yesterday the same issue was caused by something on Google’s side, but only on Win7 and some Win10 computers.

https://github.com/google/material-design-icons/issues/1220

Anyway, it was promptly resolved in less than 24 hours.

I suggest always to backup things we depend on from CDN’s, like these fonts.

answered Sep 15, 2021 at 20:32

DavidTaubmann's user avatar

DavidTaubmannDavidTaubmann

3,1822 gold badges34 silver badges43 bronze badges

Не удалось декодировать загруженный шрифт



это ошибка, которую я получаю в Chrome и, к сожалению, поиск его не дал мне много результатов. Сам шрифт отображается правильно. Однако я все еще получаю эту ошибку/предупреждение. Более конкретно, это полное предупреждение:

” не удалось декодировать загруженный шрифт:
http://localhost:8000/app/fonts/Lato/”

мой CSS таковы:

@font-face {
font-family:"Lato";
src: url("../fonts/Lato/");
}

html, body {
font-family:'Lato';
}

Я просто не понимаю. Шрифт применяется правильно, но предупреждение всегда есть. Пытаюсь использовать Sans-Serif заставляет шрифт вернуться к обычному шрифту браузера, так что это может быть, но я не уверен, и даже после поиска я ничего не нашел. Спасибо!

EDIT

есть различные файлы шрифтов, все из той же семьи. Я пытаюсь загрузить их все. Файлы шрифтов .ttf. Я загружаю их из локальной папки, и есть различные шрифтовые файлы, такие как Lato-Black.ttf,Lato-Bold.ttf,Lato-Italic.ttf etc.


1499  


14  

14 ответов:

в правиле css вы должны добавить расширение файла.
Этот пример с максимально возможной поддержкой:

@font-face {
  font-family: 'MyWebFont';
  src: url('webfont.eot'); /* IE9 Compat Modes */
  src: url('webfont.eot?#iefix') format('embedded-opentype'), /* IE6-IE8 */
       url('webfont.woff2') format('woff2'), /* Super Modern Browsers */
       url('webfont.woff') format('woff'), /* Pretty Modern Browsers */
       url('webfont.ttf')  format('truetype'), /* Safari, Android, iOS */
       url('webfont.svg#svgFontName') format('svg'); /* Legacy iOS */
}

переход из формата (‘woff’) в формат (‘font-woff’) поможет мне решить эту проблему только сейчас.

просто измените небольшое изменение здесь от Germano Plebani answer

 @font-face {
  font-family: 'MyWebFont';
  src: url('webfont.eot'); /* IE9 Compat Modes */
  src: url('webfont.eot?#iefix') format('embedded-opentype'), /* IE6-IE8 */
       url('webfont.woff2') format('woff2'), /* Super Modern Browsers */
       url('webfont.woff') format('font-woff'), /* Pretty Modern Browsers */
       url('webfont.ttf')  format('truetype'), /* Safari, Android, iOS */
       url('webfont.svg#svgFontName') format('svg'); /* Legacy iOS */
}

пожалуйста, проверьте, если Ваш браузер источники могут открыть его и какой тип

я испытал аналогичную проблему в Visual Studio, которая была вызвана неправильным url() путь к шрифту в вопрос.

я перестал получать эту ошибку после смены (например):

@@font-face{
    font-family: "Example Font";
    src: url("/Fonts/ExampleFont.eot?#iefix");

для этого:

@@font-face{
    font-family: "Example Font";
    src: url("../fonts/ExampleFont.eot?#iefix");

убедитесь, что ваш сервер отправляет файлы шрифтов с правом mime / type.

у меня недавно была такая же проблема с использованием nginx потому что некоторые типы шрифтов mime отсутствуют в его ванили .

я исправил проблему, добавив недостающие типы mime в том месте, где они мне были нужны:

location /app/fonts/ {

  #Fonts dir
  alias /var/www/app/fonts/;

  #Include vanilla types
  include mime.types;

  #Missing mime types
  types  {font/truetype ttf;}
  types  {application/font-woff woff;}
  types  {application/font-woff2 woff2;}
}

вы также можете проверить это для расширения mime.типы в nginx:
расширения по умолчанию nginx mime.типы файлов

у меня просто была такая же проблема, и я решил ее, изменив

src: url("Roboto-Medium-webfont.eot?#iefix")

до

src: url("Roboto-Medium-webfont.eot?#iefix") format('embedded-opentype')

для меня эта ошибка возникла, когда я ссылался на шрифт google с помощью https. Когда я переключился на http, ошибка исчезла. (и да, я пробовал это несколько раз, чтобы подтвердить, что это было причиной)

Я:

@import url(https://fonts.googleapis.com/css?family=Roboto:300,400,100,500,900);

To:

@import url(http://fonts.googleapis.com/css?family=Roboto:300,400,100,500,900);

мне пришлось добавить type="text/css" в моей ссылке-теге. Я изменил его с:

<link href="https://fonts.googleapis.com/css?family=Roboto+Condensed:300,400,700" rel="stylesheet">

to:

<link href="https://fonts.googleapis.com/css?family=Roboto+Condensed:300,400,700" rel="stylesheet" type="text/css">

после того как я его поменял ошибка исчезла.

У меня была та же проблема с font awesome v4.4, и я исправил ее, удалив формат woff2. Я получал предупреждение только в Chrome.

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

иногда эта проблема возникает, когда вы загружаете/загружаете шрифты, используя неправильный метод FTP.
Шрифты должны быть FTP-ed с использованием двоичного метода, а не ASCII. (В зависимости от вашего настроения, это может показаться нелогичным, lol).
Если вы ftp файлы шрифтов с помощью метода ASCII, вы можете получить это сообщение об ошибке.
Если вы ftp-файлы с помощью метода “auto”, и вы получаете это сообщение об ошибке, попробуйте ftp принудительно двоичный метод.

в моем случае это было вызвано неправильным файлом пути, in .htaccess.
пожалуйста, проверьте правильность пути к файлу.

У меня также была такая же проблема, но я решил, добавив “Content-Type”: “application/x-font-ttf” в заголовке ответа для всех .ttf файлы

в моем случае это было вызвано созданием файла патча SVN, который включал добавление файлов шрифтов. Вот так:

  1. добавить файлы шрифтов из локальной файловой системы в subversioned trunk
  2. ствол работает как ожидалось
  3. создать SVN патч изменений магистрали, чтобы включить добавление файлов шрифтов
  4. применить патч к другой ветви
  5. файлы шрифтов добавляются в ветку subversioned (и могут быть зафиксированы), но повреждены, давая ошибки в ОП.

решение состояло в том, чтобы загрузить файлы шрифтов непосредственно в ветку из моей локальной файловой системы. Я предполагаю, что это произошло, потому что файлы SVN patch должны конвертировать все в формат ASCII и не обязательно сохранять двоичные файлы для файлов шрифтов. Но это только предположение.

для меня ошибка заключалась в том, что я забыл перевести FTP в двоичный режим перед загрузкой файлов шрифтов.

Edit

вы можете проверить это, загрузив другие типы двоичных данных, таких как изображения. Если они также не отображаются, то это может быть ваш вопрос.

Если вы используете Express вам нужно обслуживать статического контента, добавив что-то вроде:
var server = express();
сервер.использовать(экспресс.статический.'(/общественных’)); // где общественность корневой папке приложения, шрифты, содержащиеся в нем, на любом уровне, т. е. общественных/Fonts или общественных/дист/шрифты…
// Если вы используете connect, google для аналогичной конфигурации.

tehadm


  • #3

А если просто локально шрифты хранить? Или это дела вкуса?)

Так чтоб шрифт нормально отображался на сайте его нужно конвертировать, под разные браузеры. Локально он и так будет хранится. Вот допустим как я прописывал локально хранящийся шрифт на сайте:

HTML:

@font-face {
    font-family: 'CyrilicOld';
    src: url('fonts/CyrilicOld.eot');
    src: url('fonts/CyrilicOld.eot') format('embedded-opentype'),
         url('fonts/CyrilicOld.woff2') format('woff2'),
         url('fonts/CyrilicOld.woff') format('woff'),
         url('fonts/CyrilicOld.ttf') format('truetype'),
         url('fonts/CyrilicOld.svg#CyrilicOld') format('svg');
}

и потом уже, задаешь для нужного элемента этот шрифт:

HTML:

.site-header .menu-toggle {
    font-family: CyrilicOld; 
}

Последнее редактирование: 25.07.2020

Содержание

  1. Не удалось декодировать загруженный шрифт
  2. 14 ответов:
  3. [loader] Failed to decode downloaded font. OTS parsing error: invalid version tag #1468
  4. Comments
  5. luqin commented Sep 23, 2015
  6. SimenB commented Sep 23, 2015
  7. luqin commented Sep 24, 2015
  8. luqin commented Sep 24, 2015
  9. dody87 commented Dec 14, 2015
  10. isramv commented Aug 8, 2016 •
  11. hmichelkernix commented Aug 19, 2016
  12. mbifulco commented Sep 23, 2016
  13. barberj commented Oct 1, 2016
  14. mbifulco commented Oct 5, 2016
  15. refaelos commented Oct 7, 2016
  16. StaticSphere commented Oct 10, 2016
  17. aspirisen commented Nov 25, 2016
  18. existe-deja commented Jan 2, 2017 •
  19. designbyadrian commented Jan 29, 2017
  20. lubien commented Jan 29, 2017
  21. Failed to decode downloaded font
  22. 22 Answers 22
  23. Failed to decode downloaded font #235
  24. Comments
  25. jboisgontier commented Jan 3, 2018 •
  26. Webpack: Failed to decode downloaded font: OTS parsing error: invalid version tag #923
  27. Comments
  28. HugoGresse commented Oct 18, 2016 •
  29. Description
  30. Expected behavior
  31. Actual behavior
  32. Environment
  33. Reproducible Demo
  34. gaearon commented Oct 18, 2016
  35. HugoGresse commented Oct 18, 2016
  36. gaearon commented Oct 18, 2016
  37. HugoGresse commented Oct 18, 2016
  38. RainingNight commented Jul 12, 2017 •
  39. Dantiff commented Dec 14, 2017 •

Не удалось декодировать загруженный шрифт

это ошибка, которую я получаю в Chrome и, к сожалению, поиск его не дал мне много результатов. Сам шрифт отображается правильно. Однако я все еще получаю эту ошибку/предупреждение. Более конкретно, это полное предупреждение:

Я просто не понимаю. Шрифт применяется правильно, но предупреждение всегда есть. Пытаюсь использовать Sans-Serif заставляет шрифт вернуться к обычному шрифту браузера, так что это может быть, но я не уверен, и даже после поиска я ничего не нашел. Спасибо!

14 ответов:

в правиле css вы должны добавить расширение файла. Этот пример с максимально возможной поддержкой:

переход из формата (‘woff’) в формат (‘font-woff’) поможет мне решить эту проблему только сейчас.

просто измените небольшое изменение здесь от Germano Plebani answer

пожалуйста, проверьте, если Ваш браузер источники могут открыть его и какой тип

я испытал аналогичную проблему в Visual Studio, которая была вызвана неправильным url() путь к шрифту в вопрос.

я перестал получать эту ошибку после смены (например):

убедитесь, что ваш сервер отправляет файлы шрифтов с правом mime / type.

я исправил проблему, добавив недостающие типы mime в том месте, где они мне были нужны:

вы также можете проверить это для расширения mime.типы в nginx: расширения по умолчанию nginx mime.типы файлов

у меня просто была такая же проблема, и я решил ее, изменив

для меня эта ошибка возникла, когда я ссылался на шрифт google с помощью https. Когда я переключился на http, ошибка исчезла. (и да, я пробовал это несколько раз, чтобы подтвердить, что это было причиной)

мне пришлось добавить type=»text/css» в моей ссылке-теге. Я изменил его с:

после того как я его поменял ошибка исчезла.

У меня была та же проблема с font awesome v4.4, и я исправил ее, удалив формат woff2. Я получал предупреждение только в Chrome.

иногда эта проблема возникает, когда вы загружаете/загружаете шрифты, используя неправильный метод FTP. Шрифты должны быть FTP-ed с использованием двоичного метода, а не ASCII. (В зависимости от вашего настроения, это может показаться нелогичным, lol). Если вы ftp файлы шрифтов с помощью метода ASCII, вы можете получить это сообщение об ошибке. Если вы ftp-файлы с помощью метода «auto», и вы получаете это сообщение об ошибке, попробуйте ftp принудительно двоичный метод.

в моем случае это было вызвано созданием файла патча SVN, который включал добавление файлов шрифтов. Вот так:

решение состояло в том, чтобы загрузить файлы шрифтов непосредственно в ветку из моей локальной файловой системы. Я предполагаю, что это произошло, потому что файлы SVN patch должны конвертировать все в формат ASCII и не обязательно сохранять двоичные файлы для файлов шрифтов. Но это только предположение.

для меня ошибка заключалась в том, что я забыл перевести FTP в двоичный режим перед загрузкой файлов шрифтов.

Edit

вы можете проверить это, загрузив другие типы двоичных данных, таких как изображения. Если они также не отображаются, то это может быть ваш вопрос.

Если вы используете Express вам нужно обслуживать статического контента, добавив что-то вроде: var server = express(); сервер.использовать(экспресс.статический.'(/общественных’)); // где общественность корневой папке приложения, шрифты, содержащиеся в нем, на любом уровне, т. е. общественных/Fonts или общественных/дист/шрифты. // Если вы используете connect, google для аналогичной конфигурации.

Источник

[loader] Failed to decode downloaded font. OTS parsing error: invalid version tag #1468

The text was updated successfully, but these errors were encountered:

We are unable to convert the task to an issue at this time. Please try again.

The issue was successfully created but we are unable to update the comment at this time.

I removed all other config and used this:

I hope this helps someone else too.
remember: remove other font test configurations for fonts.

I’m having this same issue, and none of the above seem to work for me.

Not yet, unfortunately :/

Didn’t work neither for woff/woff2 files, but now it’s ok. What I did:

I also re-converted my font files using online convertors, and now it works like a charm.

@Lacroute What is «utils» in your example?

I’d like to share the solution to my problem that’s fairly same as yours for those who google they way out here (like me).

Given my folder structure

The output css file was trying to import font files at the same folder level of it.

The following snippet solved:

Now my font files are properly referenced within my css file.

Источник

Failed to decode downloaded font

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:

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!

jwGXQ

22 Answers 22

In the css rule you have to add the extension of the file. This example with the deepest support possible:

«Failed to decode downloaded font» means the font is corrupt, or is incomplete (missing metrics, necessary tables, naming records, a million possible things).

Sometimes this problem is caused by the font itself. Google font provides the correct font you need but if font face is necessary i use Transfonter to generate all font format.

Sometimes is the FTP client that corrupt the file (not in this case because is on local pc). Be sure to transfer file in binary and not in ASCII.

I experienced a similar issue in Visual Studio, which was being caused by an incorrect url() path to the font in question.

I stopped getting this error after changing (for instance):

rb7ih

Changing format(‘woff’) to format(‘font-woff’) solves the problem.

Just a little change compared to Germano Plebani’s answer

Please check if your browser sources can open it and what is the type

photo

Make sure your server is sending the font files with the right mime/type.

I recently have the same problem using nginx because some font mime types are missing from its vanilla /etc/nginx/mime.types file.

I fixed the issue adding the missing mime types in the location where I needed them like this:

You can also check this out for extending the mime.types in nginx: extending default nginx mime.types file

I had to add type=»text/css» to my link-tag. I changed it from:

After I changed it the error disappeared.

I just had the same issue and solved it by changing

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)

Sometimes this problem happens when you upload/download the fonts using the wrong FTP method. Fonts must be FTP-ed using binary method, not ASCII. (Depending on your mood, it may feel counterintuitive, lol). If you ftp the font files using ASCII method, you can get this error message. If you ftp your files with an ‘auto’ method, and you get this error message, try ftp forcing the binary method.

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.

pV5Na

4v2CF

For me, the mistake was forgetting to put FTP into binary mode before uploading the font files.

Edit

You can test for this by uploading other types of binary data like images. If they also fail to display, then this may be your issue.

In my case, this was caused by creating a SVN patch file that encompassed the addition of the font files. Like so:

The solution was to upload the font files directly into the branch from my local file system. I assume this happened because SVN patch files must convert everything to ASCII format, and don’t necessarily retain binary for font files. But that’s only a guess.

Источник

Failed to decode downloaded font #235

Hi,
I’m using Symfony 3.3 and WebPack for assets management. I’m actually getting issues with fonts which are not decoding properly :

Failed to decode downloaded font: http://website.local/build/fonts/opensans-bold-webfont.ttf (index):1 Failed to decode downloaded font: http://website.local/build/fonts/opensans-regular-webfont.ttf 2(index):1 Failed to decode downloaded font: http://website.local/build/fonts/icomoon.woff 2(index):1 Failed to decode downloaded font: http://website.local/build/fonts/icomoon.ttf

I can’t figure what I’m doing wrong..
Furthermore, I configured exactly the same on a side project with Symfony 4 version, and everything is doing fine.

Here is the actual configuration :

strucure for assets folder :

package.json :

webpack.config.js :

var Encore = require(‘@symfony/webpack-encore’);

Encore
.setOutputPath(‘web/build/’)
.setPublicPath(‘/build’)
.addEntry(‘app’, ‘./assets/js/app.js’)
.enableSassLoader()
.autoProvidejQuery()
.cleanupOutputBeforeBuild()
.enableSourceMaps(!Encore.isProduction())
;

app.scss :

This is imported in app.js file with require(‘../css/app.scss’);

@font-face <
font-family: ‘opensans’;
src: url(‘../fonts/opensans-regular-webfont.woff’) format(‘woff’);
src: url(‘../fonts/opensans-regular-webfont.eot’);
src: url(‘../fonts/opensans-regular-webfont.eot?#iefix’) format(’embedded-opentype’),
url(‘../fonts/opensans-regular-webfont.ttf’) format(‘truetype’),
url(‘../fonts/opensans-regular-webfont.svg#open_sansregular’) format(‘svg’);
font-weight: normal;
font-style: normal;
>

@font-face <
font-family: ‘opensans_bold’;
src: url(‘../fonts/opensans-bold-webfont.woff’) format(‘woff’);
src: url(‘../fonts/opensans-bold-webfont.eot’);
src: url(‘../fonts/opensans-bold-webfont.eot?#iefix’) format(’embedded-opentype’),
url(‘../fonts/opensans-bold-webfont.ttf’) format(‘truetype’),
url(‘../fonts/opensans-bold-webfont.svg#open_sansbold’) format(‘svg’);
font-weight: bold;
font-style: normal;
>

@font-face <
font-family: ‘icomoon’;
src: url(‘../fonts/icomoon.eot’);
src: url(‘../fonts/icomoon.eot?#iefix’) format(’embedded-opentype’),
url(‘../fonts/icomoon.woff’) format(‘woff’),
url(‘../fonts/icomoon.ttf’) format(‘truetype’),
url(‘../fonts/icomoon.svg#open_sansbold’) format(‘svg’);
font-weight: normal;
font-style: normal;
>

The text was updated successfully, but these errors were encountered:

We are unable to convert the task to an issue at this time. Please try again.

The issue was successfully created but we are unable to update the comment at this time.

Источник

Webpack: Failed to decode downloaded font: OTS parsing error: invalid version tag #923

Description

Since v0.6.1, I’m having an issue with the font I’m using. I was on 0.2.1 before.

Expected behavior

The font should be loaded properly and displayed correctly.

Actual behavior

The font is not displayed and an empty rectangle appear in place of the font/icon

Environment

react-scripts@0.6.1
node v4.5.0
npm 2.15.9

Operating system: OSX 10.11.5 El Capitain
Browser and version: Chrome 53.0.2785.116 64b

Reproducible Demo

The text was updated successfully, but these errors were encountered:

We are unable to convert the task to an issue at this time. Please try again.

The issue was successfully created but we are unable to update the comment at this time.

Can you provide a full project reproducing this please?

In the meantime you should be able to use the public folder as an escape hatch to handle fonts without Webpack. There is a section in the user guide on the public folder.

I’ve finded the issue.

Okay this makes sense. We serve index.html as fallback for unrecognised paths cause it usually makes sense in single page apps. So this is what you were getting instead of the font.

thanks @gaearon loving create-react-app

Hello,
Sorry am late, but in case someone runs into a similar error in future.

I encountered the same issue, and after hours of blind trial and errors, this is how I solved the issue:

Foremost, the browser is unable to use the fonts due to poor formats. In this case, Fonts Squirrel comes in handy. Use the generator to to convert your uploaded standardized web fonts.

After downloading the standardized fonts, move the extracted fonts (*.oet, *.ttf, *.woff, *.woff2) to your public folder in the react app. This ensures that the fonts are available to the react server when the app loads during development and as well after build.

Источник

13 / 13 / 7

Регистрация: 28.01.2012

Сообщений: 549

1

28.05.2016, 16:38. Показов 20521. Ответов 11


Студворк — интернет-сервис помощи студентам

Здравствуйте, форумчане! Вот такие ошибки возникают, раньше ни разу такого не было, как исправить?

Failed to decode downloaded font: http://test.csgoskin.ru/assets… f2?v=4.6.1

OTS parsing error: invalid version tag



0



6 / 6 / 6

Регистрация: 09.12.2013

Сообщений: 104

28.05.2016, 18:42

2

Каким образом загружаешь шрифт? Где загружаешь? Мы что экстрасенсы? Можно больше информации?



0



hiphone

13 / 13 / 7

Регистрация: 28.01.2012

Сообщений: 549

28.05.2016, 19:05

 [ТС]

3

Загружаю в css

CSS
1
2
3
4
5
6
7
@font-face {
    font-family: 'FontAwesome';
    src: url('/assets/fonts/fontawesome-webfont.eot?v=4.6.1');
    src: url('/assets/fonts/fontawesome-webfont.eot?#iefix&v=4.6.1') format('embedded-opentype'), url('/assets/fonts/fontawesome-webfont.woff2?v=4.6.1') format('woff2'), url('/assets/fonts/fontawesome-webfont.woff?v=4.6.1') format('woff'), url('/assets/fonts/fontawesome-webfont.ttf?v=4.6.1') format('truetype'), url('/assets/fonts/fontawesome-webfont.svg?v=4.6.1#fontawesomeregular') format('svg');
    font-weight: normal;
    font-style: normal
}



0



Alex_DeaD

6 / 6 / 6

Регистрация: 09.12.2013

Сообщений: 104

28.05.2016, 19:19

4

Цитата
Сообщение от hiphone
Посмотреть сообщение

Загружаю в css

1)В 6 строке нет ;
2) Вот правильный пример подгрузки стороннего шрифта:

CSS
1
2
3
4
@font-face {
    font-family: Pompadur; /* Имя шрифта */
    src: url(fonts/pompadur.ttf); /* Путь к файлу со шрифтом */
   }

Показал это потому, что очень смущают пути шрифта, а также почему название его взято в ковычки?
Посмотрите эти параметры.



0



mrtoxas

Эксперт JSЭксперт HTML/CSS

3824 / 2674 / 1521

Регистрация: 12.07.2015

Сообщений: 6,674

Записей в блоге: 4

28.05.2016, 20:43

5

Не по теме:

Цитата
Сообщение от Alex_DeaD
Посмотреть сообщение

В 6 строке нет ;

Допускается опускать “;” перед закрывающим “}”

Добавлено через 42 минуты
Зачем так подключать? На fontawesome.io такого способа не нашел.
Качается и распаковывается архив в директорию сайта.
в head указывается путь к font-awesome.min.css:

HTML5
1
 <link rel="stylesheet" href="fonts/font-awesome-4.6.3/css/font-awesome.min.css">

в body уже используется:

HTML5
1
 <i class="fa fa-camera-retro"></i> fa-camera-retro

Добавлено через 5 минут
Или через сss

CSS
1
2
3
4
5
6
7
8
element:before {
    content: "f083";
    font-family: FontAwesome;
    font-style: normal;
    font-weight: normal;
    color: green;
    font-size: 18px;
}

Этого всего достаточно же.

Добавлено через 23 минуты
Нашел. Это как из вариантов

CSS
1
2
3
4
5
6
7
@font-face {
    font-family: 'FontAwesome';
    src: url('font-awesome-4.6.3/fonts/fontawesome-webfont.eot?v=4.6.3');
    src: url('font-awesome-4.6.3/fonts/fontawesome-webfont.eot?#iefix&v=4.6.3') format('embedded-opentype'), url('font-awesome-4.6.3/fonts/fontawesome-webfont.woff2?v=4.6.3') format('woff2'), url('font-awesome-4.6.3/fonts/fontawesome-webfont.woff?v=4.6.3') format('woff'), url('font-awesome-4.6.3/fonts/fontawesome-webfont.ttf?v=4.6.3') format('truetype'), url('font-awesome-4.6.3/fonts/fontawesome-webfont.svg?v=4.6.3#fontawesomeregular') format('svg');
    font-weight: normal;
    font-style: normal
}

А ошибка возникла из за неправильно указанного пути к папке со шрифтами.



0



hiphone

13 / 13 / 7

Регистрация: 28.01.2012

Сообщений: 549

28.05.2016, 22:22

 [ТС]

6

HTML5
1
<link rel="stylesheet" href="fonts/font-awesome-4.6.3/css/font-awesome.min.css">

сделал так, взяв стандартный css из архива, результат тот же



0



Эксперт JSЭксперт HTML/CSS

3824 / 2674 / 1521

Регистрация: 12.07.2015

Сообщений: 6,674

Записей в блоге: 4

28.05.2016, 23:10

7

Распиши дерево каталогов сайта. Где лежит index, где папка с fontawesome.

Добавлено через 3 минуты
В корне сайта лежит index, тут же папка fonts, в ней лежит папка font-awesome-4.6.3?



0



hiphone

13 / 13 / 7

Регистрация: 28.01.2012

Сообщений: 549

28.05.2016, 23:45

 [ТС]

8

assets/fonts/font-awesome-4.6.1 – путь из www

HTML5
1
<link rel="stylesheet" href="/assets/fonts/font-awesome-4.6.1/css/font-awesome.min.css">

шрифт-то доступен по указанному в варнинге адресу



0



Эксперт HTML/CSS

2963 / 2586 / 1068

Регистрация: 15.12.2012

Сообщений: 9,768

Записей в блоге: 11

28.05.2016, 23:48

9

Цитата
Сообщение от hiphone
Посмотреть сообщение

шрифт-то доступен по указанному в варнинге адресу

Давайте копать под хостинг… Файлы передаёте через админку хостинга или с помощью Filezilla? Пробовали данный проект запускать на локальном сервере или на другом хостинге?



0



13 / 13 / 7

Регистрация: 28.01.2012

Сообщений: 549

29.05.2016, 00:27

 [ТС]

10

Цитата
Сообщение от Fedor92
Посмотреть сообщение

Давайте копать под хостинг… Файлы передаёте через админку хостинга или с помощью Filezilla? Пробовали данный проект запускать на локальном сервере или на другом хостинге?

Через IDE грузил, на локалке все нормально работает.

P.S. Странно, дело именно в IDE оказалось, раньше не сталкивался с таким. Загрузив через админку всё заработало

Добавлено через 10 минут
А, нет, странно, только в 1 браузере заработало. Хром пишет:

Resource interpreted as Font but transferred with MIME type text/html

как исправить это?



0



Эксперт HTML/CSS

2963 / 2586 / 1068

Регистрация: 15.12.2012

Сообщений: 9,768

Записей в блоге: 11

29.05.2016, 00:58

11

Цитата
Сообщение от hiphone
Посмотреть сообщение

как исправить это?

Давайте попробуем расшарить мим-тип… Добавьте в файл .htaccess строки:

AddType application/vnd.ms-fontobject eot
AddType font/opentype otf
AddType font/truetype ttf
AddType application/x-font-woff woff



1



13 / 13 / 7

Регистрация: 28.01.2012

Сообщений: 549

29.05.2016, 11:54

 [ТС]

12

Цитата
Сообщение от Fedor92
Посмотреть сообщение

Давайте попробуем расшарить мим-тип… Добавьте в файл .htaccess строки:
AddType application/vnd.ms-fontobject eot
AddType font/opentype otf
AddType font/truetype ttf
AddType application/x-font-woff woff

Спасибо, заработало



0



Добавить комментарий