<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Themocracy WordPress Themes &#187; fonts</title>
	<atom:link href="http://themocracy.com/tag/fonts/feed/" rel="self" type="application/rss+xml" />
	<link>http://themocracy.com</link>
	<description>WordPress Theme Design</description>
	<lastBuildDate>Thu, 18 Aug 2011 07:34:18 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>JQuery, Cufon and WordPress</title>
		<link>http://themocracy.com/2010/01/jquery-cufon-and-wordpress/</link>
		<comments>http://themocracy.com/2010/01/jquery-cufon-and-wordpress/#comments</comments>
		<pubDate>Tue, 19 Jan 2010 13:48:58 +0000</pubDate>
		<dc:creator>Lisa</dc:creator>
				<category><![CDATA[Plugins]]></category>
		<category><![CDATA[Tools]]></category>
		<category><![CDATA[cufon]]></category>
		<category><![CDATA[fonts]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[jquery]]></category>

		<guid isPermaLink="false">http://themocracy.com/?p=209</guid>
		<description><![CDATA[Just at the moment the best font replacement technique around is cufón – so how to get this technique into your WordPress theme design?]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: left; margin-right: 10px;"><a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fthemocracy.com%2F2010%2F01%2Fjquery-cufon-and-wordpress%2F"><img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fthemocracy.com%2F2010%2F01%2Fjquery-cufon-and-wordpress%2F" height="61" width="51" /></a></div><p><img class="alignright size-thumbnail wp-image-207" title="wordpress-250x250" src="http://themocracy.com/wp-content/uploads/2010/01/wordpress-250x250-150x150.png" alt="" width="150" height="150" />Just at the moment the best font replacement technique around is <a href="http://wiki.github.com/sorccu/cufon/">cufón</a> &#8211; so how to get this technique into your WordPress theme design?</p>
<p>You&#8217;ll need 3 javascript files &#8211; best to put them in the theme directory under /scripts</p>
<p>1. The Cufon javascript<br />
2. The individual font javascript &#8211; downloaded from cufon &#8211; or use their excellent generator http://cufon.shoqolate.com/generate/  (not all fonts as .ttf will do the trick, there&#8217;s issues of licensing in terms of web embedding)<br />
3. A custom script, very simple, just to activate.<br />
<span id="more-209"></span><br />
The plan is to get the scripts loading in the WP header, and the best action hook for this is <strong>template_redirect</strong> &#8211; so, in <strong>functions.php</strong></p>
<pre class="brush: php">
add_action(&#039;template_redirect&#039;, &#039;them_js_head_load&#039;);

function them_js_head_load(){

define(TH_TEMPLATE_URL, get_bloginfo(&#039;template_url&#039;));

wp_register_script(&#039;cufon&#039;, TH_TEMPLATE_URL . &#039;/scripts/cufon-yui.js&#039;, array(&#039;jquery&#039;), &#039;1.0&#039;);
wp_register_script(&#039;my_font&#039;, TH_TEMPLATE_URL . &#039;/scripts/myfont.font.js&#039;, array(&#039;jquery&#039;), &#039;1.0&#039;);
wp_enqueue_script(&#039;fontsactivate&#039;, TH_TEMPLATE_URL . &#039;/scripts/fontsactivate.js&#039;, array(&#039;jquery&#039;, &#039;cufon&#039;, &#039;them_font&#039;), &#039;1.0&#039;);
}
</pre>
<p><strong>fontsactivate.js</strong> is as simple as you want to make it &#8211; just this, for example, will replace all post h2 headings on the page</p>
<pre class="brush: js">
Cufon.replace(&#039;.post h2&#039;);
</pre>
<p>Don&#8217;t imagine it&#8217;s a great idea to replace all the text on a page with a custom font, that&#8217;ll make the server chug a bit &#8211; stick with headings&#8230;</p>
]]></content:encoded>
			<wfw:commentRss>http://themocracy.com/2010/01/jquery-cufon-and-wordpress/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
	</channel>
</rss>

