Get 2024 Templates Mega Bundle!14 Bootstrap, Vue & React Templates + 3 Vector Sets
Get for 99$

Rails: Failed to decode downloaded font


I am developing on Rails application so I get this error, please help me with this problem:


@font-face {
font-family: keenicons-duotone;
src: asset-url("keenicons/keenicons-duotone.eot?eut7fk");
src: asset-url("keenicons/keenicons-duotone.eot?eut7fk#iefix"),
format("embedded-opentype"),
asset-url("keenicons/keenicons-duotone.ttf?eut7fk") format("truetype"),
asset-url("keenicons/keenicons-duotone.woff?eut7fk") format("woff"),
asset-url("keenicons/keenicons-duotone.svg?eut7fk#keenicons-duotone")
format("svg");
font-weight: 400;
font-style: normal;
font-display: block;
}

Failed to decode downloaded font: http://localhost:3000/assets/keenicons/keenicons-duotone.eot?eut7fk#iefix
OTS parsing error: invalid sfntVersion: 282919424


Text formatting options
Submit
Here's a how to add some HTML formatting to your comment:
  • <pre></pre> for JS codes block
  • <pre lang="html"></pre> for HTML code block
  • <pre lang="scss"></pre> for SCSS code block
  • <pre lang="php"></pre> for PHP code block
  • <code></code> for single line of code
  • <strong></strong> to make things bold
  • <em></em> to emphasize
  • <ul><li></li></ul>  to make list
  • <ol><li></li></ol>  to make ordered list
  • <h3></h3> to make headings
  • <a></a> for links
  • <img> to paste in an image
  • <blockquote></blockquote> to quote somebody
  • happy  :)
  • shocked  :|
  • sad  :(

Replies (3)


Hi,

I'd like to know, when did you encounter this error? Is it during the process of running the Gulp task? Please let us know, and we'll assist you accordingly.



Hi,
I use HTML and manual configuration.
I put it in the fonts folder, path:app/assets/fonts/keenicons/keenicons-duotone.eot



Hi,

The error message you're encountering is typically related to problems with font files in your Rails application. The error suggests that there's an issue with the font file or how it's being served. Here are some steps to help you resolve this issue:

Check Font File: First, make sure that the font file is present in the correct location within your project's assets. Verify that the file hasn't been corrupted during download or deployment.

Font MIME Types: Ensure that the server is configured to serve font files with the correct MIME types. Font files should be served with appropriate MIME types to prevent issues. You can add the following configuration in your Rails application:

# config/application.rb
config.assets.paths << Rails.root.join("app", "assets", "fonts")
config.assets.precompile << /\.(?:svg|eot|woff|ttf)\z/


Asset Pipeline: If you're using the Asset Pipeline in Rails, make sure that the font files are included in the precompilation process. You can check your config/initializers/assets.rb file to ensure that the fonts are precompiled.

Asset URLs: Verify that the asset URLs in your CSS or SCSS files are correct and match the actual file paths. In your CSS, you should use the font-url helper to correctly generate asset URLs. For example:

@font-face {
font-family: "keenicons-duotone";
src: font-url("keenicons/keenicons-duotone.eot?eut7fk");
/* Other font sources here */
}


Check for Corrupted Font Files: It's possible that the font file itself is corrupted. Try re-downloading the font file or using a different font file to see if the issue persists.

Precompile Assets: If you haven't done so, run the asset precompilation task in your Rails application. This task compiles and serves assets in a production-ready manner.

RAILS_ENV=production bundle exec rake assets:precompile


Browser Cache: Clear your browser cache or use private browsing mode to ensure you're not loading cached assets.

If the issue still persists after trying these steps, please provide additional information about your setup and any specific error messages. This will help in further diagnosing the problem and providing a more targeted solution.


Text formatting options
Submit
Here's a how to add some HTML formatting to your comment:
  • <pre></pre> for JS codes block
  • <pre lang="html"></pre> for HTML code block
  • <pre lang="scss"></pre> for SCSS code block
  • <pre lang="php"></pre> for PHP code block
  • <code></code> for single line of code
  • <strong></strong> to make things bold
  • <em></em> to emphasize
  • <ul><li></li></ul>  to make list
  • <ol><li></li></ol>  to make ordered list
  • <h3></h3> to make headings
  • <a></a> for links
  • <img> to paste in an image
  • <blockquote></blockquote> to quote somebody
  • happy  :)
  • shocked  :|
  • sad  :(
Text formatting options
Submit
Here's a how to add some HTML formatting to your comment:
  • <pre></pre> for JS codes block
  • <pre lang="html"></pre> for HTML code block
  • <pre lang="scss"></pre> for SCSS code block
  • <pre lang="php"></pre> for PHP code block
  • <code></code> for single line of code
  • <strong></strong> to make things bold
  • <em></em> to emphasize
  • <ul><li></li></ul>  to make list
  • <ol><li></li></ol>  to make ordered list
  • <h3></h3> to make headings
  • <a></a> for links
  • <img> to paste in an image
  • <blockquote></blockquote> to quote somebody
  • happy  :)
  • shocked  :|
  • sad  :(