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.
asked May 25, 2015 at 16:21
Luís FerreiraLuís Ferreira
2,4283 gold badges20 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 PlebaniGermano Plebani
3,4203 gold badges27 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
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
nabjoernnabjoern
1411 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
answered Apr 11, 2016 at 9:04
MatteoMatteo
1,65417 silver badges24 bronze badges
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
26.7k19 gold badges112 silver badges117 bronze badges
answered Oct 26, 2016 at 7:01
Fuad HusniFuad Husni
3292 silver badges4 bronze badges
7
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
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
VenryxVenryx
14.3k10 gold badges68 silver badges92 bronze badges
2
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
GiuseppeGiuseppe
44413 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
MetaTronMetaTron
8058 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
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
EbrahimEbrahim
1,6522 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
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
1
In my case, this was caused by creating a SVN patch file that encompassed the addition of the font files. Like so:
- Add font files from local file system to subversioned trunk
- Trunk works as expected
- Create SVN patch of trunk changes, to include addition of font files
- Apply patch to another branch
- 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
MattMatt
23k39 gold badges108 silver badges150 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 GowlandRobert Gowland
7,5095 gold badges43 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
RaydotRaydot
1,3371 gold badge23 silver badges37 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
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
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
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
SaidmamadSaidmamad
631 silver badge12 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
FenixFenix
2,1511 gold badge15 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
DavidTaubmannDavidTaubmann
3,1342 gold badges33 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.
1233
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, который включал добавление файлов шрифтов. Вот так:
- добавить файлы шрифтов из локальной файловой системы в subversioned trunk
- ствол работает как ожидалось
- создать SVN патч изменений магистрали, чтобы включить добавление файлов шрифтов
- применить патч к другой ветви
- файлы шрифтов добавляются в ветку subversioned (и могут быть зафиксированы), но повреждены, давая ошибки в ОП.
решение состояло в том, чтобы загрузить файлы шрифтов непосредственно в ветку из моей локальной файловой системы. Я предполагаю, что это произошло, потому что файлы SVN patch должны конвертировать все в формат ASCII и не обязательно сохранять двоичные файлы для файлов шрифтов. Но это только предположение.
для меня ошибка заключалась в том, что я забыл перевести FTP в двоичный режим перед загрузкой файлов шрифтов.
Edit
вы можете проверить это, загрузив другие типы двоичных данных, таких как изображения. Если они также не отображаются, то это может быть ваш вопрос.
Если вы используете Express вам нужно обслуживать статического контента, добавив что-то вроде:
var server = express();
сервер.использовать(экспресс.статический.'(/общественных’)); // где общественность корневой папке приложения, шрифты, содержащиеся в нем, на любом уровне, т. е. общественных/Fonts или общественных/дист/шрифты…
// Если вы используете connect, google для аналогичной конфигурации.
13 / 13 / 7 Регистрация: 28.01.2012 Сообщений: 549 |
|
1 |
|
28.05.2016, 16:38. Показов 20036. Ответов 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
0 |
Alex_DeaD 6 / 6 / 6 Регистрация: 09.12.2013 Сообщений: 104 |
||||
28.05.2016, 19:19 |
4 |
|||
Загружаю в css 1)В 6 строке нет ;
Показал это потому, что очень смущают пути шрифта, а также почему название его взято в ковычки?
0 |
mrtoxas Модератор 3824 / 2674 / 1521 Регистрация: 12.07.2015 Сообщений: 6,674 Записей в блоге: 4 |
||||||||||||||||
28.05.2016, 20:43 |
5 |
|||||||||||||||
Не по теме:
В 6 строке нет ; Допускается опускать «;» перед закрывающим «}» Добавлено через 42 минуты
в body уже используется:
Добавлено через 5 минут
Этого всего достаточно же. Добавлено через 23 минуты
А ошибка возникла из за неправильно указанного пути к папке со шрифтами.
0 |
hiphone 13 / 13 / 7 Регистрация: 28.01.2012 Сообщений: 549 |
||||
28.05.2016, 22:22 [ТС] |
6 |
|||
сделал так, взяв стандартный css из архива, результат тот же
0 |
Модератор 3824 / 2674 / 1521 Регистрация: 12.07.2015 Сообщений: 6,674 Записей в блоге: 4 |
|
28.05.2016, 23:10 |
7 |
Распиши дерево каталогов сайта. Где лежит index, где папка с fontawesome. Добавлено через 3 минуты
0 |
hiphone 13 / 13 / 7 Регистрация: 28.01.2012 Сообщений: 549 |
||||
28.05.2016, 23:45 [ТС] |
8 |
|||
assets/fonts/font-awesome-4.6.1 — путь из www
шрифт-то доступен по указанному в варнинге адресу
0 |
2960 / 2578 / 1068 Регистрация: 15.12.2012 Сообщений: 9,733 Записей в блоге: 11 |
|
28.05.2016, 23:48 |
9 |
шрифт-то доступен по указанному в варнинге адресу Давайте копать под хостинг… Файлы передаёте через админку хостинга или с помощью Filezilla? Пробовали данный проект запускать на локальном сервере или на другом хостинге?
0 |
13 / 13 / 7 Регистрация: 28.01.2012 Сообщений: 549 |
|
29.05.2016, 00:27 [ТС] |
10 |
Давайте копать под хостинг… Файлы передаёте через админку хостинга или с помощью Filezilla? Пробовали данный проект запускать на локальном сервере или на другом хостинге? Через IDE грузил, на локалке все нормально работает. P.S. Странно, дело именно в IDE оказалось, раньше не сталкивался с таким. Загрузив через админку всё заработало Добавлено через 10 минут Resource interpreted as Font but transferred with MIME type text/html как исправить это?
0 |
2960 / 2578 / 1068 Регистрация: 15.12.2012 Сообщений: 9,733 Записей в блоге: 11 |
|
29.05.2016, 00:58 |
11 |
как исправить это? Давайте попробуем расшарить мим-тип… Добавьте в файл .htaccess строки: AddType application/vnd.ms-fontobject eot
1 |
13 / 13 / 7 Регистрация: 28.01.2012 Сообщений: 549 |
|
29.05.2016, 11:54 [ТС] |
12 |
Давайте попробуем расшарить мим-тип… Добавьте в файл .htaccess строки: Спасибо, заработало
0 |
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.
asked May 25, 2015 at 16:21
Luís FerreiraLuís Ferreira
2,4283 gold badges20 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 PlebaniGermano Plebani
3,4203 gold badges27 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
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
nabjoernnabjoern
1411 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
answered Apr 11, 2016 at 9:04
MatteoMatteo
1,65417 silver badges24 bronze badges
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
26.7k19 gold badges112 silver badges117 bronze badges
answered Oct 26, 2016 at 7:01
Fuad HusniFuad Husni
3292 silver badges4 bronze badges
7
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
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
VenryxVenryx
14.3k10 gold badges68 silver badges92 bronze badges
2
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
GiuseppeGiuseppe
44413 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
MetaTronMetaTron
8058 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
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
EbrahimEbrahim
1,6522 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
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
1
In my case, this was caused by creating a SVN patch file that encompassed the addition of the font files. Like so:
- Add font files from local file system to subversioned trunk
- Trunk works as expected
- Create SVN patch of trunk changes, to include addition of font files
- Apply patch to another branch
- 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
MattMatt
23k39 gold badges108 silver badges150 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 GowlandRobert Gowland
7,5095 gold badges43 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
RaydotRaydot
1,3371 gold badge23 silver badges37 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
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
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
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
SaidmamadSaidmamad
631 silver badge12 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
FenixFenix
2,1511 gold badge15 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
DavidTaubmannDavidTaubmann
3,1342 gold badges33 silver badges43 bronze badges
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.
asked May 25, 2015 at 16:21
Luís FerreiraLuís Ferreira
2,4283 gold badges20 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 PlebaniGermano Plebani
3,4203 gold badges27 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
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
nabjoernnabjoern
1411 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
answered Apr 11, 2016 at 9:04
MatteoMatteo
1,65417 silver badges24 bronze badges
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
26.7k19 gold badges112 silver badges117 bronze badges
answered Oct 26, 2016 at 7:01
Fuad HusniFuad Husni
3292 silver badges4 bronze badges
7
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
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
VenryxVenryx
14.3k10 gold badges68 silver badges92 bronze badges
2
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
GiuseppeGiuseppe
44413 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
MetaTronMetaTron
8058 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
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
EbrahimEbrahim
1,6522 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
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
1
In my case, this was caused by creating a SVN patch file that encompassed the addition of the font files. Like so:
- Add font files from local file system to subversioned trunk
- Trunk works as expected
- Create SVN patch of trunk changes, to include addition of font files
- Apply patch to another branch
- 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
MattMatt
23k39 gold badges108 silver badges150 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 GowlandRobert Gowland
7,5095 gold badges43 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
RaydotRaydot
1,3371 gold badge23 silver badges37 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
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
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
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
SaidmamadSaidmamad
631 silver badge12 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
FenixFenix
2,1511 gold badge15 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
DavidTaubmannDavidTaubmann
3,1342 gold badges33 silver badges43 bronze badges
Have you tried adding $
s to the end of test
? Like test: /.eot$/,
on all of them. woff
might get hit twice
But the url is .woff2?v=4.4.0
and .woff2?xxxx
Thank you. It works when the test is /.woff2(?S*)?$/
.
Please verify on awesome-fonts .css file if the url path for fonts are ok. It works for me.
I removed all other config and used this:
{ test: /.woff(2)?(?v=[0-9].[0-9].[0-9])?$/, loader: "url-loader?limit=10000&minetype=application/font-woff" },
{ test: /.(ttf|eot|svg)(?v=[0-9].[0-9].[0-9])?$/, loader: "file-loader" }
I hope this helps someone else too.
remember: remove other font test configurations for fonts.
kaankucukx reacted with thumbs down emoji
followbl, janschaefer, samlogan, preeti-tm, toothywalrus, rm-rf-etc, LevStolpner, Pushplaybang, danakt, jessiezf, and 2 more reacted with hooray emoji
KonstantinDavidov, toothywalrus, rm-rf-etc, LevStolpner, AndresSaa, Pushplaybang, danakt, camiloei, jessiezf, brianchristensen, and Yaolegol reacted with heart emoji
Yaolegol reacted with rocket emoji
Hello @isramv, on your snippet, I think there is a typo on minetype
, shouldn’t be mimetype
?
I’m having this same issue, and none of the above seem to work for me.
Not yet, unfortunately :/
@mbifulco if you find anything I’d love to see that as well .. 😞
Thanks, @isramv !!! This worked great for me.
Didn’t work neither for woff/woff2 files, but now it’s ok. What I did:
{
test: /.woff(2)?(?v=[0-9].[0-9].[0-9])?$/,
loader: 'url',
query: {
limit: 10000,
mimetype: "application/font-woff",
name: utils.assetsPath('fonts/[name].[hash:7].[ext]')
}
},
{
test: /.(eot|ttf|otf)(?.*)?$/,
loader: 'url',
query: {
limit: 10000,
name: utils.assetsPath('fonts/[name].[hash:7].[ext]')
}
},
I also re-converted my font files using online convertors, and now it works like a charm.
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
/ # root of web server
css/
file-that-import-fonts.css
fonts/
font-file.ext
The output css file was trying to import font files at the same folder level of it.
So it always hit 404 /css/font.x
and my server rendered 404 error was mistaken as a broken font. That’s why Failed to decode downloaded font. OTS parsing error: invalid version tag
.
The following snippet solved:
{ test: /.(otf|eot|svg|ttf|woff|woff2)$/, loader: 'file-loader', query: { outputPath: 'fonts/', publicPath: '../fonts/' // That's the important part } },
Now my font files are properly referenced within my css file.
Recently I also had the same problem, the following webpack config script snipped is solved the issue:
{
test: /.svg(?v=[0-9].[0-9].[0-9])?$/,
loader: 'url?limit=65000&mimetype=image/svg+xml&name=/[name].[ext]'
},
{
test: /.woff(?v=[0-9].[0-9].[0-9])?$/,
loader: 'url?limit=65000&mimetype=application/font-woff&name=/[name].[ext]'
},
{
test: /.woff2(?v=[0-9].[0-9].[0-9])?$/,
loader: 'url?limit=65000&mimetype=application/font-woff2&name=/[name].[ext]'
},
{
test: /.[ot]tf(?v=[0-9].[0-9].[0-9])?$/,
loader: 'url?limit=65000&mimetype=application/octet-stream&name=/[name].[ext]'
},
{
test: /.eot(?v=[0-9].[0-9].[0-9])?$/,
loader: 'url?limit=65000&mimetype=application/vnd.ms-fontobject&name=/[name].[ext]'
}
The most important thing from the config above is name query parameter for url loader, with my config fonts will be rendered as /, you may prefixed this with, for example, fonts: &name=/fonts/[name].[ext]
@vchyzhevskyi thanks!! It worked after few hours searching a solution
@vchyzhevskyi this way you’ll encode your fonts in base64 into your css file no ? Could be better to have font files to light the weight of your app..
it worked for me after I specify the format like this:
@font-face { font-family: "shop-icons"; src: url(node_modules/mypkg/fonts/shop-icons.svg) format("svg"), url(node_modules/mypkg/fonts/shop-icons.ttf) format("truetype"), url(node_modules/mypkg/fonts/shop-icons.eot), url(node_modules/mypkg/fonts/fonts/shop-icons.woff) format("woff"); }
Initially I didn’t have format and my style looked like:
@font-face { font-family: "shop-icons"; src: url(node_modules/mypkg/fonts/shop-icons.svg), url(node_modules/mypkg/fonts/shop-icons.ttf), url(node_modules/mypkg/fonts/shop-icons.eot), url(node_modules/mypkg/fonts/fonts/shop-icons.woff); }
Has Similar issue, This works for me:
{ test: /.(eot|woff|ttf|svg)$/, loaders: ["file?name=[path][name].[ext]?[hash]"] }, { test: /.woff2(?S*)?$/, loaders: ["file?name=[path][name].[ext]?[hash]"] }
none of these solutions are working for me.
still getting the error
@Pushplaybang have u realized wuts going on ? me either having the same erros and still cant figure it out..
Edit :
I come up with this. simply removed the loader and it worked.
I have to mention, my build is with Vue Cli 3 and applying this configuration on vue.config.js
Hope this helps. 🎉
{ test: /.woff(2)?(?v=[0-9].[0-9].[0-9])?$/, }
vis97c reacted with laugh emoji
kaankucukx, Pushplaybang, overtrue, TecHunter, and vis97c reacted with hooray emoji
vis97c, schoero, and ZeroByter reacted with heart emoji
vis97c reacted with rocket emoji
I removed all other config and used this:
{ test: /.woff(2)?(?v=[0-9].[0-9].[0-9])?$/, loader: "url-loader?limit=10000&minetype=application/font-woff" }, { test: /.(ttf|eot|svg)(?v=[0-9].[0-9].[0-9])?$/, loader: "file-loader" }
I hope this helps someone else too.
remember: remove other font test configurations for fonts.
This works for me thinks
@Pushplaybang have u realized wuts going on ? me either having the same erros and still cant figure it out..
![]()
Edit :
I come up with this. simply removed the loader and it worked.
I have to mention, my build is with Vue Cli 3 and applying this configuration on vue.config.js
Hope this helps. 🎉
{ test: /.woff(2)?(?v=[0-9].[0-9].[0-9])?$/, }
This solved the issue, thanks!!
This was referenced
Sep 15, 2021
{ test: /.woff(2)?(?v=[0-9].[0-9].[0-9])?$/, loader: «url-loader?limit=10000&minetype=application/font-woff» },
{ test: /.(ttf|eot|svg)(?v=[0-9].[0-9].[0-9])?$/, loader: «file-loader» }
Strangely, this worked for me. If anyone out there is stuck on this with no hope, give this bizarre solution a try
Recently, I’ve been looking at some information about the web front end, and the following error occurred in processing a CSS, so as to record it.
I compiled a project under webstorm and loaded the index page on it. I got the following warning on the chrome console:
Failed to decode downloaded font: http://localhost:4200/assets/fonts/Simple-Line-Icons.woff2?v=2.4.0
OTS parsing error: Failed to convert WOFF 2.0 font to SFNT
Failed to decode downloaded font: http://localhost:4200/assets/fonts/Simple-Line-Icons.woff2?v=2.4.0
OTS parsing error: Failed to convert WOFF 2.0 font to SFNT
Failed to decode downloaded font: http://localhost:4200/assets/fonts/Simple-Line-Icons.woff2?v=2.4.0
OTS parsing error: Failed to convert WOFF 2.0 font to SFNT
Custom font and code used:
@font-face {
font-family: 'simple-line-icons';
src: url('../fonts/Simple-Line-Icons.eot?v=2.4.0');
src: url('../fonts/Simple-Line-Icons.eot?v=2.4.0#iefix') format('embedded-opentype'),
url('../fonts/Simple-Line-Icons.woff2?v=2.4.0') format('woff2'),
url('../fonts/Simple-Line-Icons.ttf?v=2.4.0') format('truetype'),
url('../fonts/Simple-Line-Icons.woff?v=2.4.0') format('woff'),
url('../fonts/Simple-Line-Icons.svg?v=2.4.0#simple-line-icons') format('svg');
font-weight: normal;
font-style: normal;
}
The styleext I use is SCSS, and the stylesheet file suffix is. CSS.
There are two solutions
1. Will xxxx.css Change to xxxx.css.scss .
2. Change the format in the font declaration. Change format (‘woff ‘) to format (‘font woff’)
@font-face {
font-family: 'simple-line-icons';
src: url('../fonts/Simple-Line-Icons.eot?v=2.4.0');
src: url('../fonts/Simple-Line-Icons.eot?v=2.4.0#iefix') format('embedded-opentype'),
url('../fonts/Simple-Line-Icons.woff2?v=2.4.0') format('font-woff2'),
url('../fonts/Simple-Line-Icons.ttf?v=2.4.0') format('truetype'),
url('../fonts/Simple-Line-Icons.woff?v=2.4.0') format('font-woff'),
url('../fonts/Simple-Line-Icons.svg?v=2.4.0#simple-line-icons') format('svg');
font-weight: normal;
font-style: normal;
}