How to add a custom font to Rails app?

add a custom font to Rails application by using google fonts

for example i am using Freckle Face
http://www.google.com/fonts#QuickUsePlace:quickUse/Family:
Quick Use: Freckle Face

1. Choose the styles you want:
Impact on page load time
Tip: Using many font styles can slow down your webpage, so only select the font styles that you actually need on your webpage.

2. Choose the character sets you want:
Tip: If you choose only the languages that you need, you'll help prevent slowness on your webpage.
Latin (latin)
Latin Extended (latin-ext)

3. Add this code to your website:
Instructions: To embed your Collection into your web page, copy the code as the first element in the of your HTML document.

<link href='http://fonts.googleapis.com/css?family=Freckle+Face' rel='stylesheet' type='text/css'>  

4. Integrate the fonts into your CSS:
The Google Fonts API will generate the necessary browser-specific CSS to use the fonts. All you need to do is add the font name to your CSS styles. For example:

font-family: 'Freckle Face', cursive;  

Instructions: Add the font name to your CSS styles just as you'd do normally with any other font.

Example:

h1 { font-family: ‘Metrophobic’, Arial, serif; font-weight: 400; }  

<head>  
  <meta charset='UTF-8' />  
  <link href='http://fonts.googleapis.com/css?family=Freckle+Face' rel='stylesheet' type='text/css'>  
</head>  
<body>  
 <div id="header">  
  <div id="nav">  
   <a href="#contact">Contact</a> <span style="word-spacing:normal; color:white; font-family: 'Freckle Face', cursive;, arial, serif; font-size:20px;"><--Click a link to see this page in action!</span>  
  </div>  
 </div>  
</body> 

Adding a custom font to Rails application

  1. Select font type and download
    for example
    go to http://www.dafont.com
    select font and download font

  2. Generate font files

    go to http://www.fontsquirrel.com/
    select - web font generator - select font u download(unzip file downloaded from http://www.dafont.com).

  3. Retrieve the font files
    This site will 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

  4. Add the font to your rails app

    (How to add a custom font to Rails app?)

    config/application.rb

     config.assets.enabled = true  
     config.assets.paths << "#{Rails.root}/app/assets/fonts"  
    
  5. Add it to the view:

    <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>  
    


Checkout http://www.css3.info/preview/web-fonts-with-font-face/

Larger example, assuming they're resolved directly under the assets dir

@font-face {
  font-family: 'Nokia Pure Headline';    
  src: url('/assets/nokiapureheadlinerg-webfont.eot');
  src: url('/assets/nokiapureheadlinerg-webfont.eot?iefix') format('eot'),
  url('/assets/nokiapureheadlinerg-webfont.woff') format('woff'),
  url('/assets/nokiapureheadlinerg-webfont.ttf') format('truetype'),
  url('/assets/nokiapureheadlinerg-webfont.svg#webfont3AwWkQXK') format('svg');
  font-weight: normal;
  font-style: normal;
}

Im sorry I dont know LESS

Also for the config of the assets pipeline to have the contents of assets/fonts available under we use:

# Enable the asset pipeline
config.assets.enabled = true
config.assets.paths << Rails.root.join('/app/assets/fonts')