Hi all,
I came accross this way of adding custom font to rails application. If u have another way of adding plz comment down.
step 1
select font type and download
for example
go to http://www.dafont.com
select font and download font
step 2
go to http://www.fontsquirrel.com/
select - web font generator - select font u download(unzip file downloaded from http://www.dafont.com).
step 3
This site wil generate another zip which contain all required for that font style.
From that zip, unzip and open css, copy css into your html or css file of that html.
step 4
(http://stackoverflow.com/questions/12329137/how-to-add-a-custom-font-to-rails-app)
config/application.rb
config.assets.enabled = true
config.assets.paths << "#{Rails.root}/app/assets/fonts"
step 5
example
<html lang="en">
<head>
<style>
@font-face {
font-family: 'a_sensible_armadilloregular';
src: url('/assets/para/a_sensible_armadillo-webfont.eot');
src: url('/assets/para/a_sensible_armadillo-webfont.eot?#iefix') format('embedded-opentype'),
url('/assets/para/a_sensible_armadillo-webfont.woff') format('woff'),
url('/assets/para/a_sensible_armadillo-webfont.ttf') format('truetype'),
url('/assets/para/a_sensible_armadillo-webfont.svg#a_sensible_armadilloregular') format('svg');
font-weight: normal;
font-style: normal;
}
.content p {
font-family: 'a_sensible_armadilloregular';
font-size: 42px;
}
</style>
</head>
<body>
<div class="content">
<p>sample text</p>
</div>
</body>
</html>
Wednesday, 8 January 2014
How to add a custom font to Rails application
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment