我想在我的 RoR 应用程序中使用几种字体,但它们的格式主要是 .ttf 和 .otf 等。我将如何将这些文件嵌入到我的 Rails 应用程序中?也就是说,一旦我将它们放入我的资产文件夹中,我将它们嵌入到我的 CSS 和/或 LESS 文件中的语法到底是什么?
编辑:这是我现在拥有的代码:
@font-face {
font-family: Vow;
src: url('/assets/Vow.otf');
}
h1 {
font-family: Vow;
text-align: center;
}
它似乎对我不起作用。Rails 控制台中的输出大致如下:
ActionController::RoutingError (No route matches [GET] "/assets/Vow.otf")
并用 Firebug 检查页面说:
downloadable font: download failed (font-family: "Vow" style:normal weight:normal stretch:normal src index:0): status=2147746065
source: http://localhost:3000/assets/Vow.otf