Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 1 of 1

Thread: CUFON Question?

  1. #1
    Senior Coder DJCMBear's Avatar
    Join Date
    Mar 2010
    Location
    United Kindom
    Posts
    1,173
    Thanks
    14
    Thanked 136 Times in 136 Posts

    CUFON Question?

    Hi I was just wondering if you could use two different fonts on the same page with CUFON, as you can register a font with the font files but if you register two fonts how how you choose between the fonts.

    For example if you do this
    Code:
    <script src="fonts/cufon.js" type="text/javascript"></script>
    <script src="fonts/font1.font.js" type="text/javascript"></script>
    <script src="fonts/font2.font.js" type="text/javascript"></script>
    But when I use the built-in CUFON replace it only picks the last font registered.
    Code:
    <script type="text/javascript">
    Cufon.replace('#div1'); // Will Replace all text in the div1 with font2
    Cufon.replace('#div2'); // Will Replace all text in the div2 with font2
    </script>
    <div id="div1">Font 1</div>
    <div id="div2">Font 2</div>
    If anyone knows how to do this please helo, thank you.

    EDIT:
    I found how you do it you need to use a selector like this.
    Code:
    <script type="text/javascript">
    Cufon.replace('div1',{fontFamily:'font1'});
    Cufon.replace('div2',{fontFamily:'font2'});
    </script>
    Last edited by DJCMBear; 08-27-2010 at 05:43 PM.
    Official BinPress hand picked coder.
    For anyone worried about SQL injection go have a look at my small yet powerful script here.
    Go Pledge for Light Table, if it hit's $300,000 Python and other languages will get added.
    I am 1 of 65,608 people to get a Pebble Watch :P


 

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •