<分区>
<分区>
I tried following this thread here but I am not able to duplicate their results.
main.css
h1 {
font-family: 'Shadows Into Light', serif;
src: url('/assets/fonts/shadows.ttf') format("Shadows Into Light");
font-size: 40px;
text-align: center;
position: relative;
bottom: 20px;
margin: 0 auto 0 auto;
width:100px;
}
Assets 目录
assets
|
|
---stylesheets
| |
| ---main.css
---images
|
|
---images
|
|
---fonts
|
---shadow.ttf
此外,我尝试手动将字体目录包含到我的 Assets 管道中:
config/application.rb
class Application < Rails::Application
config.assets.paths << Rails.root.join("app", "assets", "fonts")
如何将 ttf 自定义字体包含到我的 Rails 应用程序中?
最佳答案
@font-face {
font-family: 'yourfont';
src: url('addres-yourfont.eot?#') format('eot'), /* IE6–8 */
url('addres-yourfont.woff') format('woff'), /* FF3.6+, IE9, Chrome6+, Saf5.1+*/
url('addres-yourfont.ttf') format('truetype'); /* Saf3—5, Chrome4+, FF3.5, Opera 10+ */
}
关于css - 如何将 ttf 自定义字体包含到我的 Rails 应用程序中?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27804248/