gpt4 book ai didi

css - 自定义字体不会在 Firefox for Rails 4 应用程序中呈现

转载 作者:太空宇宙 更新时间:2023-11-04 03:14:09 25 4
gpt4 key购买 nike

我已经上传了一个名为 Kodin 的自定义字体,所有字体都可以在 IE、Chrome 和 Safari 中使用,但不能在 Firefox 中使用。

我已经将所有自定义字体上传到 app/assets/fonts

包含的文件是....

Kodin-Regular.otf
Kodin-Regular.eot
Kodin-Regular.woff
Kodin-Regular.ttf

我的 application.css 文件包括...

   @font-face {
font-family: "KODIN";
src: url('/assets/Kodin-Regular.otf') format("truetype");
src: url('/assets/Kodin-Regular.eot') format('embedded-opentype'),
url('/assets/Kodin-Regular.woff') format('woff'),
url('/assets/Kodin-Regular.ttf') format('truetype');
font-weight: normal;
font-style: normal;
}

一切都很好。但是字体不会在 Firefox 网站上的任何地方呈现。我已经看到一些关于如何解决此问题的堆栈溢出线程,但没有一个是针对 Rails 的特定建议。

谢谢!

更新

在 Firefox 中发现了一些控制台错误。路径不对?

downloadable font: download failed (font-family: "KODIN" style:normal weight:normal stretch:normal src index:0): status=2147746065 source: http://localhost:3000/assets/Kodin-Regular.otf application.css:25:12
downloadable font: download failed (font-family: "KODIN" style:normal weight:normal stretch:normal src index:2): status=2147746065 source: http://localhost:3000/assets/Kodin-Regular.woff application.css:25:12
downloadable font: download failed (font-family: "KODIN" style:normal weight:normal stretch:normal src index:3): status=2147746065 source: http://localhost:3000/assets/Kodin-Regular.ttf application.css

最佳答案

如图所示尝试使用 Assets 路径,希望它有效。

src:url(asset-path('Kodin-Regular.otf')) format('truetype');

关于css - 自定义字体不会在 Firefox for Rails 4 应用程序中呈现,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28992616/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com