Skip to main content

Cufon Library for using attractive fonts in website

The fonts used in websites for displaying titles, headings or subheadings have much importance in improving readability of the website. There are variety of pretty fonts available that can be used to render contents various HTML tags like H1,H2,B,I etc. One issue that could happen is, if the client machine doesn't have your applied font then it renders with available font. A very good and effective solution for this is the use of Cufon Library (Cufon Script) for rendering the HTML contents using your desired font. Cufon doesn’t use Flash technology (like sIFR*) to render fonts. Cufon simply changes selected text elements to the <canvas> HTML5 tag.

No plug-ins required for Cufon, it is fast and easy to implement, recent version of cufon script works with all major browsers.

It is simple to install Cufon script in your webpages.

At First, download the latest version of "cufon-yui.js" file from Cuffons website.

Next, download your favourite font from any of the web sources like openfontlibrary.org.

for using with cufon, the font shoulf be converted to JS format, for this take Cufon Generator page

In the "Regular typeface" field Browse for your font which was downloaded earlier and select it

Check the option "The EULAs of these fonts allow Web Embedding (without Adobe Flash)"

In the "Include following Glyphs" section, check the items upto "wordpress punctation" field omit rest if not needed.

Accept terms and click "Lets do this" button to generate the JS format of your font.

Upload this files to your Javascript files folder.

scripts/cufon/cufon-yui.js
scripts/cufon/myfavoritefont_bold_300.font.js

Next is to call this files in your web pages you can do it like this: include this in head section

<script src="scripts/cufon/cufon-yui.js" type="text/javascript"></script>
<script src="scripts/cufon/myfavoritefont_bold_300.font.js" type="text/javascript"></script>

You have to initialise the Cufon text replacement by calling following code - the code says Cufon must replace the contents in h1 and b tags with a html5 canvas tag and render the text with your desired font style.

<script type="text/javascript">
Cufon.replace('h1');
Cufon.replace('b');
</script>


Similarly you can use multiple font for different tags:

<script src="scripts/cufon/cufon-yui.js" type="text/javascript"></script>
<script src="scripts/cufon/myfavoritefont_bold_300.font.js" type="text/javascript"></script>
<script src="scripts/cufon/myotherfavoritefont_italic_500.font.js" type="text/javascript"></script>
<script type="text/javascript">
Cufon.replace('h1', { fontFamily: 'myfavoritefont' });
Cufon.replace('h2', { fontFamily: 'myotherfavoritefont' })
</script>

CUFON AND IE9 ISSUE - SOLUTION


CUFON WEBSITE
DOWNLOAD LATEST CUFON LIBRARY
CUFON GENERATOR PAGE
DOWNLOAD SCRIPT IMPLEMENTATION
HOW CUFON WORKS

Other Interesting Stuffs:

sIFR
*Scalable Inman Flash Replacement (sIFR) is an open source JavaScript and Adobe Flash dynamic web fonts implementation, enabling the replacement of text elements on HTML web pages with Flash equivalents.
Read more about sIFR JS Library

Web Font Sources
http://openfontlibrary.org/

Google Web Fonts API
The Google Web Fonts API helps you add web fonts to any web page. Benefits of the Google Web Fonts API include: A choice of high quality open source fonts.
Google web fonts - For Free optimised web fonts from Google library which can be used in your website.
like:

<link href='http://fonts.googleapis.com/css?family=Macondo+Swash+Caps' rel='stylesheet' type='text/css'>
read more..

Comments

Popular posts from this blog

Strange problem occured while trying to create a CSV file using PHP Script - The file is not seen on FTP but can download using file's absolute path url

Strange problem occured while trying to create a CSV file - The file is not seen on FTP but can download using file's absolute path url Last day I came across a strange problem when I tried to create a csv file on therver using a PHP script. the script was simply writing a given content as a csv file. The file will be created runtime. What happened was, The script executed fine, file handler for new file was created and contents was wrote into the file using fwrite and it returned the number of bytes that was written.

How to get the Query string of a URL using the Javascript (JS)?

JS function get the Query string of a URL or value of each parameter using the Javascript(JS)? If you want to get your current page's url var my_url=document.location; to get the query string part of the url use like this: var my_qry_str= location.search; this will return the part of the url starting from "?" following by query string Lets assume that your current page url is http://www.crozoom.com/2013/page.html?qry1=A&qry2=B then the location.search function will return " ?qry1=A&qry2=B " to exclue "?", do like this:


Urgent Openings for PHP trainees, Andriod / IOS developers and PHP developers in Kochi Trivandrum Calicut and Bangalore. Please Send Your updated resumes to recruit.vo@gmail.com   Read more »
Member
Search This Blog