Saturday 11 January 2014

How to 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 <head> 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; }  
  example :  
 <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>  

No comments:

Post a Comment