Using Cufon in Magento
Written by Mark Clark - Mon Apr 18, 07:57 pm ET
Cufon is a way (among several other) to add more or less any font as a fully usable font directly on your website – of course including Magento. Here we’ll show you how to do that in just a few steps.
- Find your font. A good resource of free fonts is www.dafont.com, however make sure the font you are about to use has an EULA that fits your needs.
- Go to the Cufon site and follow the instructions on how to upload your font and get the generated font.js file. Also download the cufon-yui.js script.
- Place all the .js files in a new directory in /js/cufon.
- Open your template’s page.xml file and add the below code in its head section:
<actionmethod="addJs"><script>cufon/cufon-yui.js</script></action>
<actionmethod="addJs"><script>cufon/YourFontFile.font.js</script></action> - Now open your template’s head.phtml file and add the following code at the very end of it:
<scripttype="text/javascript">Cufon.replace('h1, h2');</script>
You’re done. Your h1 and h2 tags are now using your custom font.
You can also target spesific CSS classes by adding the following script tag:
<script type="text/javascript">Cufon.replace(' .product-title, .price ');</script> |
Related posts:
- Share:
-
Mark Clark