<?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>The Bright Lines</title>
	<atom:link href="http://www.thebrightlines.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.thebrightlines.com</link>
	<description>HTML, CSS, Javascript and more</description>
	<lastBuildDate>Thu, 29 Jul 2010 22:44:34 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.4</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>CSS performance, who cares?</title>
		<link>http://www.thebrightlines.com/2010/07/28/css-performance-who-cares/</link>
		<comments>http://www.thebrightlines.com/2010/07/28/css-performance-who-cares/#comments</comments>
		<pubDate>Wed, 28 Jul 2010 05:11:40 +0000</pubDate>
		<dc:creator>Wouter Bos</dc:creator>
				<category><![CDATA[Browsers]]></category>
		<category><![CDATA[CSS]]></category>
		<category><![CDATA[Optimization]]></category>

		<guid isPermaLink="false">http://www.thebrightlines.com/?p=648</guid>
		<description><![CDATA[You probably didn't notice it, but the way you write CSS affects the rendering speed of the browser. Should you care about that? Most likely not, but it is possible to freeze your web page with inefficient selectors.]]></description>
			<content:encoded><![CDATA[<p>Lately I read the following text in <em>Building iPhone Apps with HTML, CSS, and JavaScript</em> (O&#8217;Reilly) on using ID&#8217;s in CSS:</p>
<blockquote cite="http://oreilly.com/catalog/9780596805784?cmp=il-orm-ofps-iphoneapps"><p>&#8220;There are differences between class and id. Class attributes should be used when you have more than one item on the page with the same class value. Conversely, id values have to be unique to a page.</p>
<p>When I first learned this, I figured I’d just always use class attributes so I wouldn’t have to worry about whether I was duping an id value. However, selecting elements by id is much faster than selecting them by class, so you can hurt your performance by overusing class selectors.&#8221;</p></blockquote>
<p>Huh? I never use ID&#8217;s in CSS selectors, but I never experienced slow rendering either. I wanted to test if it&#8217;s stupid not to use ID&#8217;s.</p>
<p>First I wanted to see if it was even able to create a CSS that was hard to parse. Google has a nice article about <a href="http://code.google.com/speed/page-speed/docs/rendering.html#UseEfficientCSSSelectors">writing efficient CSS selectors</a>, so that seemed like a good start before setting up a test. In short there are 2 things that make a fast CSS selector:</p>
<ul>
<li><strong>Make rules as specific as possible</strong><br />
This means that <code>div.content</code> is faster than <code>*</code>.<br />
You have to be especially specific with the rightmost selector, since the browser reads CSS selector from right to left.</li>
<li><strong>Avoid (large) descendant rules</strong><br />
An example of a descendant rule is <code>div.content div.column1 div.columnHeader h2</code>. Descendant rules are less efficient than rules with a single selector, like <code>h2</code>.</li>
</ul>
<h2>Test 1: setting up extremely inefficient CSS</h2>
<p>The most inefficient selector by far is <code>*</code>. Combined with large descendant rules you get extremely inefficient selectors:</p>
<pre name="code" class="css:nogutter">
* * * * * * * * * {
	background: #ff1;
}
* * * * {
	background: #ff2;
}
* * * * * * * {
	background: #ff3;
}
</pre>
<p>I created a CSS file of about 20KB in size with 3600 asterisks characters (*). I combined it with a very large HTML file (1MB) with 9000 opening HTML brackets (<). Because I only wanted to test the CSS rendering, I added the following JavaScript to be able to load the CSS file on my local computer <em>after</em> the page was loaded.</p>
<pre name="code" class="javascript:nogutter">
	<a href="javascript:loadCSS('default.css')">Load CSS</a>
	<script type="text/javascript">
		function loadCSS(url) {
			var fileref=document.createElement("link");
			fileref.setAttribute("rel", "stylesheet");
			fileref.setAttribute("type", "text/css");
			fileref.setAttribute("href", url);
			document.getElementsByTagName("head")[0].appendChild(fileref);
		}
	</script>
</pre>
<h3>Results Test 1</h3>
<table>
<thead>
<tr>
<th>Browser</th>
<th>Render time (sec)</th>
</tr>
</thead>
<tbody>
<tr>
<td>Firefox 3.6</td>
<td>2</td>
</tr>
<tr>
<td>IE 8</td>
<td>4</td>
</tr>
<tr>
<td>IE 7</td>
<td>6</td>
</tr>
<tr>
<td>IE 6</td>
<td>11</td>
</tr>
<tr>
<td>Chrome 6</td>
<td>4</td>
</tr>
</tbody>
</table>
<p><em>All tests were done on my computer (Vista with Intel Duo Core @ 2.4GHz) except for IE7 and IE6. IE7 was tested on a Vista machine with Intel Core Duo SPU @ 2.67Ghz. IE6 was tested on my machine with Virtual PC and on a PC with Windows XP SP3 and a Pentium 3 CPU 3GHz.</em></p>
<p>The results show that browsers freeze for at least 2 seconds in order to render the CSS. So it <em>is</em> possible to screw up your rendering, but you really have to make an effort for it with large HTML files and unrealistic CSS selectors.</p>
<h2>Test 2: setting up a more realistic scenario</h2>
<p>In this test I created a more realistic scenario. I took an existing CSS file and altered it until it was 113KB in size and contained about 1050 selectors. I changed the CSS rules until the bulk of the code looked like this:</p>
<pre name="code" class="css:nogutter">
.Homepage .containerText {
	position: relative;
	margin: 15px auto 0px auto;
	width: 960px;
	background:#ffffff;
}
.Homepage .containerText .containerLeft {
	float:left;
	width:450px;
	padding:10px 20px 45px 10px;
}
.Homepage .containerText .containerLeft p {
	margin:0px 0px 5px 0px;
	color:#414a49;
	line-height:1.286em;
}
</pre>
<p>So most of the code in the CSS file consisted of descendant selectors with classes and hardly any tag names. The corresponding HTML page was also created from existing code and copy-pasted until the file was 107KB in size with almost 600 opening HTML brackets (<). Now we have a relatively large HTML and CSS, but not unrealistic. Once again I tested it in different browsers:</p>
<h3>Results Test 2</h3>
<table>
<thead>
<tr>
<th>Browser</th>
<th>Render time (sec)</th>
</tr>
</thead>
<tbody>
<tr>
<td>Firefox 3.6</td>
<td>0</td>
</tr>
<tr>
<td>IE 8</td>
<td>0</td>
</tr>
<tr>
<td>IE 7</td>
<td>0.5</td>
</tr>
<tr>
<td>IE 6</td>
<td>1.5</td>
</tr>
<tr>
<td>Chrome 6</td>
<td>0</td>
</tr>
</tbody>
</table>
<p>All modern browsers responded so fast that I couldn&#8217;t really notice it needed rendering time. This means that the CSS file does not need any optimization by utilizing ID&#8217;s. The only browser that could profit from more efficient CSS selectors is IE 6. But since I don&#8217;t have to support IE 6 anymore, it&#8217;s not worth my time.</p>
<h2>Conclusion</h2>
<p>Writing fast CSS certainly will help some browsers on slow PC&#8217;s. But that is a minority of the users. So unless you have special requirements for your website, you&#8217;ll be better off focusing on writing logical, maintainable code than trying to get the browser to render a few milliseconds faster. There are some considerations though:</p>
<h3>Being more specific</h3>
<p>A few years ago I switched from writing <code>.foo</code> to writing <code>a.foo</code>. Adding the tag name in the selector gives me a better idea <em>what</em> I&#8217;m styling. Now I know that this coding style is also faster in rendering.</p>
<h3>Descendant selectors</h3>
<p>Descendent selectors (using more than one element in a CSS rule) are inefficient in rendering, but I won&#8217;t give that up. I like to be specific about what element I want to select in CSS. I rather write <code>div.column1 div.article span.date</code> than <code>span.date</code>. The latter is more efficient, but that only works with very small websites because only then you&#8217;d still have an overview of the all classes that are in the HTML code.</p>
<p>When I write JavaScript code I try not to &#8216;pollute&#8217; the global namespace. I try to do the same with CSS by using descendent selectors.</p>
<p>If you need faster rendering, you could alter descendant selectors by making one class that incorporates the whole path. So you&#8217;ll get <code>span.column1_article_date</code> instead of <code>div.column1 div.article span.date</code>. Although it would render faster, it also has some drawbacks. Renaming a class afterwards is tedious work, the class names can become very long and the classes can be used <em>outside</em> it&#8217;s intended containers, so a class called <code>div.column1_article_date</code> could be used anywhere in the DOM and not just inside div with the class <code>column1</code>.</p>
<h2>ID&#8217;s and JavaScript</h2>
<p>I do use ID&#8217;s by the way, Not in CSS though, but for JavaScript for these reasons:</p>
<ul>
<li>Specific elements can be easily accessed in plain JavaScript with <code>getElementById</code>.</li>
<li>If an element has an ID, I can be pretty surre that there is a bit of JavaScript attached to it.</li>
<li>Using ID&#8217;s in your jQuery selectors makes the selectors less dependent on the current HTML structure. It&#8217;s easy to break existing jQuery selectors by removing a class in the DOM.</li>
</ul>


<p>No related posts.</p>]]></content:encoded>
			<wfw:commentRss>http://www.thebrightlines.com/2010/07/28/css-performance-who-cares/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Netscape and accessibility</title>
		<link>http://www.thebrightlines.com/2010/06/22/netscape-and-accessibility/</link>
		<comments>http://www.thebrightlines.com/2010/06/22/netscape-and-accessibility/#comments</comments>
		<pubDate>Tue, 22 Jun 2010 19:43:48 +0000</pubDate>
		<dc:creator>Wouter Bos</dc:creator>
				<category><![CDATA[Browsers]]></category>
		<category><![CDATA[Software]]></category>
		<category><![CDATA[Usability]]></category>
		<category><![CDATA[WCAG]]></category>
		<category><![CDATA[Web development in general]]></category>
		<category><![CDATA[Netscape]]></category>
		<category><![CDATA[support]]></category>

		<guid isPermaLink="false">http://www.thebrightlines.com/?p=626</guid>
		<description><![CDATA[Lets see if an ancient browser can still handle the current web and if it's possible to help a little with the rendering of a page.]]></description>
			<content:encoded><![CDATA[<p><img class="alignright" title="Splash screen Netscape 4.7" src="http://www.guidebookgallery.org/pics/splashes/netscape/4.7-communicator.png" alt="" width="396" height="267" />Although we all cheer loud for all signs that proves IE6&#8217;s decline, fact is that this browser will stay to be a pain in the ass for some time. And to be honest: this is not something new. There&#8217;s always some browser lagging behind and preventing web developers of using new cool techniques. Nothing new here. Supporting Netscape in time of its final decline was also hard.</p>
<p>Yeah, Netscape 4. Now <em>that</em> was a browser that just did not want to die. Netscape wasn&#8217;t updated after 1998 but in 2001 still about 5% of the internet users used Netscape. I got curious how the web would look like in a browser that is more than a decade old. So I downloaded Netscape 4.7 and loaded some major websites to see how they would look.</p>
<p>The level of accessibility of websites varies enormously. Let&#8217;s start with one of the worse:</p>
<h2>Amazon.com</h2>
<div class="wp-caption alignnone" style="width: 450px"><a href="/article-data/images/ns-amazon-ns.png"><img title="Welcome to our new and improved webshop ;)" src="/article-data/images/ns-amazon-ns-small.png" alt="Welcome to our new and improved webshop ;)" width="440" height="405" /></a><p class="wp-caption-text">Welcome to our new and improved web shop <img src='http://www.thebrightlines.com/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p></div>
<div class="wp-caption alignnone" style="width: 450px"><img title="How the Amazon website should look like" src="/article-data/images/ns-amazon-ff-small.png" alt="How the Amazon website should look like" width="440" height="336" /><p class="wp-caption-text">How the Amazon website should look like</p></div>
<p>As you can see: Netscape renders the page but context is virtually lost. And it clearly can&#8217;t handle the sprite image in the top left corner.</p>
<h2>Twitter</h2>
<div class="wp-caption alignnone" style="width: 450px"><a href="/article-data/images/ns-twitter-ns.jpg"><img title="Twitter in Netscape" src="/article-data/images/ns-twitter-ns-small.jpg" alt="Twitter in Netscape" width="440" height="406" /></a><p class="wp-caption-text">A Twitter page in Netscape</p></div>
<div class="wp-caption alignnone" style="width: 450px"><a href="http://twitter.com/lyricsbylenny"><img title="How this Twitter-account should look like" src="/article-data/images/ns-twitter-ff-small.jpg" alt="How this Twitter-account should look like" width="440" height="336" /></a><p class="wp-caption-text">How this Twitter-account should look like</p></div>
<p>The lack of solid white background color in combination with a  rich-contrast background image that does get loaded is a serious  problem. Not to mention all the hidden information that becomes visible. This website too is not very usable anymore.</p>
<h2>Yahoo</h2>
<div class="wp-caption alignnone" style="width: 450px"><a href="/article-data/images/ns-yahoo-ns.png"><img title="Yahoo throws in a big fat warning..." src="/article-data/images/yahoo-ns-small.png" alt="Yahoo throws in a big fat warning..." width="440" height="222" /></a><p class="wp-caption-text">Yahoo just blocks you</p></div>
<p>Yahoo has another approach: It just says that you&#8217;re browser is ancient and offers download links to newer browsers.</p>
<h2>Google</h2>
<div class="wp-caption alignnone" style="width: 450px"><a href="/article-data/images/ns-google-ns2.png"><img title="...while Google just does its thing" src="/article-data/images/ns-google-ns2-small.png" alt="...while Google just does its thing" width="440" height="302" /></a><p class="wp-caption-text">...while Google just does it&#39;s thing</p></div>
<p>Google doesn&#8217;t complain and shows a page that looks remarkably well in Netscape 4. The links in the search results will still send you to websites that look like jigsaw puzzles, though <img src='http://www.thebrightlines.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<h2>So you can&#8217;t browse with an ancient browser. So what?</h2>
<p>Ok, this is indeed not a drama. But think of it this way: the web is a web of <em>content</em>. Content that becomes increasingly inaccessible if you don&#8217;t rebuild its content container, the website, every few years. Most organizations do that to be up to par with the latest browsers and designs but some just have to.</p>
<h2>Help browsers with a handicap</h2>
<p>Keeping content accessible is not just a hobby. It&#8217;s a major issue for websites of (semi)government organizations for example. They have to make sure content is open to anyone. Although they focus on handicapped internet users rather than handicapped browsers, one goal remains the same: a user should be able to use a website without the need of CSS, JavaScript or any other &#8216;fancy&#8217; technique. A <code>:hover</code> is no use to a blind user, neither will color and JavaScript animation. That&#8217;s why such a person uses a different browser without such capabilities. And that&#8217;s why we have guidelines like WCAG.</p>
<p>It&#8217;s not surprising that many websites that follow WCAG guidelines or something comparable  do reasonably well in Netscape 4. I&#8217;ll repeat it again: that&#8217;s a browser from 1998.</p>
<h2>www.section508.gov</h2>
<div class="wp-caption alignnone" style="width: 450px"><a href="/article-data/images/ns-section508-ns.png"><img title="Unique: this website looks almost identical in Firefox and Netscape" src="/article-data/images/ns-section508-ns-small.png" alt="Unique: this website looks almost identical in Firefox and Netscape" width="440" height="405" /></a><p class="wp-caption-text">Unique: this website looks almost identical in Firefox and Netscape</p></div>
<div class="wp-caption alignnone" style="width: 450px"><img title="www.section508.gov in Firefox" src="/article-data/images/ns-section508-ff.png" alt="www.section508.gov in Firefox" width="440" height="335" /><p class="wp-caption-text">www.section508.gov in Firefox</p></div>
<p>The web design of www.section508.gov just don&#8217;t look like it stems from the 1990s, it also uses ancient techniques from that era like tables for layout, image spacers and sparse use of CSS. All big no-no&#8217;s nowadays, but the website rendering is great.</p>
<h2>Dutch web guidelines</h2>
<div class="wp-caption alignnone" style="width: 450px"><a href="/article-data/images/ns-webrichtlijnen-ns.png"><img title="This website is in Netscape just in black and white, but very readable." src="/article-data/images/ns-webrichtlijnen-ns-small.png" alt="This website is in Netscape just in black and white, but very readable." width="440" height="405" /></a><p class="wp-caption-text">In black and white, but ordered and readable.</p></div>
<div class="wp-caption alignnone" style="width: 450px"><img title="The same website in Firefox" src="/article-data/images/ns-webrichtlijnen-ff.png" alt="The same website in Firefox" width="440" height="335" /><p class="wp-caption-text">The same website in Firefox</p></div>
<p>The difference in rendering between Netscape and Firefox is striking. Netscape is unable to read the CSS, but that&#8217;s a good thing here. Accessibility dictates that an HTML document should be structured. So when there&#8217;s no CSS to style the document, the document structure will remain.</p>
<p>But why does Netscape not load the CSS? It appears that the media attribute link markup is key here:</p>
<pre name="code" class="xhtml:nogutter">
Netscape won't load this CSS
&lt;link rel="stylesheet" type="text/css" href="/screen.css" media="screen, tty" /&gt;

Netscape *will* load this CSS
&lt;link rel="stylesheet" type="text/css" href="/screen.css" /&gt;
</pre>
<h2>Dutch semi-governmental website (www.groenendestad.nl)</h2>
<div class="wp-caption alignnone" style="width: 450px"><a href="/article-data/images/ns-groenendestad-ns.png"><img title="The website in Netscape" src="/article-data/images/ns-groenendestad-ns-small.png" alt="The website in Netscape" width="440" height="405" /></a><p class="wp-caption-text">The website in Netscape</p></div>
<div class="wp-caption alignnone" style="width: 450px"><img title="In Firefox" src="/article-data/images/ns-groenendestad-ff.png" alt="In Firefox" width="440" height="335" /><p class="wp-caption-text">In Firefox</p></div>
<p>The last site is a semi-governmental website developed at the company I work, Estate Internet. It&#8217;s a relative new site (2 years old) but still usable in both old an new browsers.</p>
<h2>Hurdles</h2>
<p>So it <em>is</em> possible to make websites that are still usable in ancient browsers. The main obstacle is that old browsers try to render stuff like CSS and JavaScript but choke on it halfway. In case of CSS it&#8217;s possible to block Netscape by adding the <code>media</code> attribute, but that&#8217;s still a hack. Old browsers should be protected from itself. One option is to just disable everything at the client side that could harm the rendering.</p>
<p>It would be nice if you could send unsupported browsers just the HTML, while others also receive CSS and JavaScript. But browser detection can be error prone. The only stable solution I know that is easy to implement is IE version detection through conditional comments. Consider this piece of code that only gives all non-IE browsers and all IE7+ browser the site&#8217;s stylesheet.</p>
<pre>&lt;![if !IE]&gt;
    &lt;link href="css/main.css" type="text/css" /&gt;
&lt;![endif]&gt;
&lt;![if gte IE 7]&gt;
    &lt;link href="css/main.css" type="text/css" /&gt;
&lt;![endif]&gt;</pre>
<p>Conditional Comments will help us giving a soon-to-be ancient browser like IE6 the treatment it deserves <img src='http://www.thebrightlines.com/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> .</p>
<p>Now it&#8217;s time to close Netscape again and start waiting for the new Firefox that supports basic CSS animation.</p>


<p>No related posts.</p>]]></content:encoded>
			<wfw:commentRss>http://www.thebrightlines.com/2010/06/22/netscape-and-accessibility/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Codeview, a new template for JSDoc Toolkit</title>
		<link>http://www.thebrightlines.com/2010/05/06/new-template-for-jsdoctoolkit-codeview/</link>
		<comments>http://www.thebrightlines.com/2010/05/06/new-template-for-jsdoctoolkit-codeview/#comments</comments>
		<pubDate>Thu, 06 May 2010 20:18:29 +0000</pubDate>
		<dc:creator>Wouter Bos</dc:creator>
				<category><![CDATA[CSS]]></category>
		<category><![CDATA[Documentation]]></category>
		<category><![CDATA[HTML]]></category>
		<category><![CDATA[Software]]></category>
		<category><![CDATA[codeview]]></category>
		<category><![CDATA[jsdoc]]></category>
		<category><![CDATA[template]]></category>

		<guid isPermaLink="false">http://www.thebrightlines.com/?p=605</guid>
		<description><![CDATA[I created a new HTML template for the Javascript documentation tool JSDoc, which is now free for download. It is tested in IE6 to IE9, FF3.6, Chrome 5 and Safari 4.]]></description>
			<content:encoded><![CDATA[<p><a class="button download" href="/article-data/downloads/codeview.zip"><span> </span>Download Codeview</a></p>
<p>The template is based on the basic template of <a href="http://code.google.com/p/jsdoc-toolkit/">JSDoc Toolkit</a>. The HTML structure is basically the same, but with a complete fresh CSS in a separate file. Nothing else is added to the template (yet), so it&#8217;s a fast loading website.</p>
<p>There are even no pictures added to the template, although it may not look that way because of the CSS3 styles that generate gradients, shadows and rounded corners. These effects are not visible in IE, except for rounded corners in IE9. So in case of IE, you&#8217;ll just see a simpler version of the website.</p>
<p>Here are some screenshots:</p>
<div class="wp-caption alignnone" style="width: 450px"><img title="Class view" src="/article-data/images/codeview-1.jpg" alt="Class view" width="440" height="413" /><p class="wp-caption-text">Class view</p></div>
<div class="wp-caption alignnone" style="width: 450px"><img title="Class overview" src="/article-data/images/codeview-2.jpg" alt="Class overview" width="440" height="413" /><p class="wp-caption-text">Class overview</p></div>
<div class="wp-caption alignnone" style="width: 450px"><img title="File overview" src="/article-data/images/codeview-3.jpg" alt="File overview" width="440" height="413" /><p class="wp-caption-text">File overview</p></div>


<p>Related posts:<ol><li><a href='http://www.thebrightlines.com/2010/03/28/document-your-javascript-interview-with-michael-mathews-of-jsdoc/' rel='bookmark' title='Permanent Link: Document your Javascript: interview with Michael Mathews of JSDoc Toolkit'>Document your Javascript: interview with Michael Mathews of JSDoc Toolkit</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://www.thebrightlines.com/2010/05/06/new-template-for-jsdoctoolkit-codeview/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Interview with Ethan Dunham of Fontsquirrel and Fontspring</title>
		<link>http://www.thebrightlines.com/2010/04/18/interview-with-ethan-dunham-of-fontsquirrel-and-fontspring/</link>
		<comments>http://www.thebrightlines.com/2010/04/18/interview-with-ethan-dunham-of-fontsquirrel-and-fontspring/#comments</comments>
		<pubDate>Sat, 17 Apr 2010 22:42:41 +0000</pubDate>
		<dc:creator>Wouter Bos</dc:creator>
				<category><![CDATA[Webfonts]]></category>
		<category><![CDATA[Cufon]]></category>
		<category><![CDATA[Ethan Dunham]]></category>
		<category><![CDATA[Fontspring]]></category>
		<category><![CDATA[Fontsquirrel]]></category>

		<guid isPermaLink="false">http://www.thebrightlines.com/?p=545</guid>
		<description><![CDATA[If somebody is recently making waves with fonts, it's Ethan Dunham. His website Fontsquirrel has become the source for free quality fonts. Most of them are also available as web fonts, which can be used directly in websites. Even better: Fontsquirrel also has a web font generator, which is the only tool of its kind.]]></description>
			<content:encoded><![CDATA[<div class="wp-caption alignright" style="width: 200px"><img title="Ethan Dunham about Fontspring: 'Designers should have control over their fonts'." src="/article-data/images/ethanDunham.jpg" alt="Ethan Dunham about Fontspring: 'Designers should have control over their fonts'." width="190" height="243" /><p class="wp-caption-text">Ethan Dunham about Fontspring: &quot;Designers should have control over their fonts&quot;.</p></div>
<h2>Putting the quality free fonts in the showroom</h2>
<p>Although the website has about 1.5 million page views per month, the website is just one year old. <a href="http://www.fontsquirrel.com">Fontsquirrel</a> was born in January 2009 because Ethan, for years a font designer himself, wasn&#8217;t happy with the way free fonts were offered on sites like <a href="http://www.dafont.com/">dafont.com</a>. &#8220;There are no free font sites that really focus on quality. What they focus on is quantity,&#8221;<strong> </strong>as Ethan said in an interview for the <a href="http://web20show.com/2009/11/episode-58-font-squirrel/">Web 2.0 Show</a>.</p>
<p>With Fontsquirrel he wanted to fill in that gap. He only selected free fonts that could also be used in commercial products like websites and were &#8220;at least half way high quality&#8221;. That way the users of Fontsquirrel had a list of quality fonts that could be used in almost anything.<strong></strong></p>
<h2>A good start</h2>
<p>Ethan had little expectations when he started Fontsquirrel: &#8220;I started it as a side project, maybe earn a few dollars on advertising. It was a site I wanted for myself and thought it would be useful to others.&#8221; The response was great after the release of Fontsquirrel: &#8220;It made it to the front page of delicious.com, right off the bat.&#8221;</p>
<p>After a year Ethan has found more than 630 font families that fitted his criteria. The active search has stopped now and new fonts only trickle in from time to time. &#8220;But that hasn&#8217;t been a problem for the popularity for the site. If you now need a font for your site, you have a place to go to.&#8221;<strong></strong></p>
<p>Not all fonts on Fontsquirrel are available as a webfont though. This has to do with licensing issues. Ethan: &#8220;I am either not allowed to redistribute fonts (and therefore webfonts) or the license doesn&#8217;t allow it.&#8221;</p>
<h2>Jeffrey Zeldman</h2>
<p>The popularity of Fontsquirrel is still growing with 5% to 20% a month. The online media certainly is boosting the trend. Ethan: &#8220;There lots of people dropping my name. <a href="http://www.zeldman.com/">Jeffrey Zeldman</a> in particular was kind enough to mention me in some blog posts and tweets.&#8221;</p>
<p>Because of Jeffrey Zeldman&#8217;s popularity and his status as an authority on web development, Ethan was even a bit affraid of his posts<strong> </strong>since they result in peaks in site visits that the server has to handle. &#8220;The problem is that the generator can be processor intensive. Just putting one font through that thing can tie up the server. So I&#8217;m a little anxious about getting more and more traffic to the generator. It could end up eating all of my resources.&#8221;</p>
<p>&#8220;The website is on a decent server, but people are uploading megabytes of fonts. I had one guy asking me why his 20 megabyte font wasn&#8217;t converting very well!&#8221; Another problem were grunge fonts with tons of vector points that were being run through the auto-hinter. But these problems are now hopefully gone forever: &#8221; I just built in some limitations to keep things humming along. I will not be able to serve all 100% of the people coming, but 90% of you won&#8217;t notice a thing.&#8221;</p>
<h2>Why we need the @font-face generator</h2>
<p>Most developers who ever tried to use web fonts in their web site, will most likely know how much trouble one has to go through. You&#8217;ll have to <em>at least</em> convert an existing font to EOT and already that can be a pain. For years Microsoft has a tool for generating EOT files, which is called WEFT. But WEFT crahes easily and the UI is cumbersome. That&#8217;s why many people take their resort in the simpler but more stable commandline program <a href="http://code.google.com/p/ttf2eot/">ttf2eot</a>.</p>
<p>Jonathan Snook wrote a <a href="http://snook.ca/archives/html_and_css/becoming-a-font-embedding-master">blog post</a> about the steps he had to go through to just be able to use web fonts on his site. That inspired Ethan for making the generator: “I had been doing quite a bit with FontForge and I realized how easy it would be if you’d automate most of that. It started off there, just for fun, and it progressively grew more and more features.”</p>
<div class="wp-caption alignnone" style="width: 450px"><img title="The @font-face generator: the only complete font generation tool online" src="/article-data/images/ethanDunham.png" alt="The @font-face generator: the only complete font generation tool online" width="440" height="300" /><p class="wp-caption-text">The @font-face Kit Generator: currently the only complete web font generator</p></div>
<p>The font face generator can do a lot of conversion now. And it has to: if you want to do it right, you&#8217;ll need 4 file types: TTF or OTF for most browsers, EOT for Internet Explorer, SVG for Safari on the iPhone and finally WOFF, the new standard for web fonts.</p>
<h2>Under the hood of the generator</h2>
<p><a href="http://fontforge.sourceforge.net/">FontForge</a> is still a large part of the Ethan&#8217;s generator. &#8220;I wrote a script that uses FontForge from the command line. But it is also integrated with a few other open source tools. Obviously it is connected to ttf2eot te generate an EOT. Another tool is <a href="http://people.mozilla.com/~jkew/woff/">sfnt2woff</a> for the WOFF files.&#8221; The generator now also produces an SVG file, which Safari on the iPhone needs.</p>
<h2>No future for Cufón</h2>
<p>The @font-face generator even makes a <a href="http://wiki.github.com/sorccu/cufon/about">Cufón</a> file. Cufón is a hack to make a browser show non-standard fonts. It uses Javascript to replace text with a line drawing of the font. Cufón aims to be a worthy alternative for the other hack: <a href="http://wiki.novemberborn.net/sifr/">sIFR</a>.</p>
<p>The fact that the @font-face generator creates Cufón files does not mean Ethan is endorsing it: &#8220;I don&#8217;t think there&#8217;s much of a future for Cufón. It was easy to add to the generator. I did it just for fun. Simo Kinnunen released the Cufón generator as open source, and I just plugged it in to see what happens. So I didn&#8217;t spend much time on it. But some people use it instead of @font-face. They think it renders more smoothly.&#8221;</p>
<p>Although there seems to be no future for Cufón, it has some advantages over @font-face: Cufón <em>does</em> render well on Windows in contrary to @font-face. We&#8217;ll have to wait for IE9 to see good font rendering on Windows browsers. Another advantage of Cufón is that the fonts cannot be pirated, since the original file is not being used.</p>
<h2>Future developments for @font-face generator</h2>
<p>The work on the @font-face generator is not finished yet. &#8220;It&#8217;s definitely a work in progress&#8221;, Ethan admits. He&#8217;s still busy adding new features and tweaks. One of those features is the ability to be able to select alternative glyphs and ligatures: &#8220;An OTF can have a normal set of Unicode characters, but it could also have other characters instead of the default. I did come up with a way that you can upload a font and choose which set you want to use. I haven&#8217;t implemented that yet.&#8221;<strong></strong></p>
<p>The whish list goes on, although Ethan is still in doubt if they&#8217;d be useful enough to implement: &#8220;You could embed an XML file into a WOFF as meta data, so that you have a font with the foundry information in it. Another thing I&#8217;m thinking about is to generate some server-side script to dynamically generate the CSS file, which should send the right font to the right browser.&#8221;</p>
<h2>&#8230;and then there was Fontspring</h2>
<p>In early February Ethan published another website: Fontspring. It is something that he had been thinking about for a few years already. &#8220;I&#8217;ve been in the type business for a long time and wanted to take what I&#8217;ve learned selling my own fonts and apply that to selling others.&#8221;</p>
<p>The interview for the Web 2.0 show gave him the final push for starting Fontspring: &#8220;I shared my observations about what I thought users would like regarding webfonts. Ie: That the idea of renting a font was a bit backwards and that most people would rather have freedom to download and use the fonts as they saw fit. There were a lot of companies jumping into the market and so I dropped everything I was doing and spent 2-3 months building Fontspring.&#8221;</p>
<p>&#8220;I created a whitepaper describing what it was we were doing and how we could protect their fonts from casual theft. It wasn&#8217;t complicated. Small, open-minded foundries said &#8216;yes&#8217;.&#8221;</p>
<div class="wp-caption alignnone" style="width: 450px"><img title="Fontspring.com" src="/article-data/images/ethanDunham-2.png" alt="Fontspring.com" width="440" height="300" /><p class="wp-caption-text">Fontspring.com</p></div>
<h2>Service vs DIY</h2>
<p>Fontspring sparked a new discussion about renting versus buying. Most web fonts vendors choose to rent web fonts, while most web developers will most likely opt for buying web fonts. &#8220;We are at the owning side of the &#8216;owning versus renting model&#8217;. We think that designers should have control over their fonts and we try to sell it that way. That&#8217;s why almost all of the fonts on Fontspring are licensed for unlimited domains. The other advantage is that we&#8217;re not just a service: you also get the desktop version of the font.&#8221;</p>
<p>Jeffrey Zeldman also has reservations about renting fonts and being dependent on a service. <a href="http://www.zeldman.com/2010/03/22/my-lovehate-affair-with-typekit/">His post on that subject</a> already sparked a discussion on the subject, but it&#8217;s most likely that the two business models will live side by side for at least some time.</p>
<p>The DIY model of hosting does not mean that the fonts can be easily pirated. Ethan took some measures to discourage pirating. &#8220;I&#8217;m trying to do the best of both worlds here. On one hand I want to serve customers who don&#8217;t want to be tied to a yearly fee. On the other hand I understand foundries&#8217; concerns about having their intellectual property on the web, all exposed.&#8221;</p>
<p>&#8220;What I&#8217;ve done is take some ideas of existing type services and integrated them in a DIY method. For example: when I make a webfont for Fontspring, I&#8217;m subsetting it to a smaller character set. I also removed all the OpenType features, and then scramble some of the internals to render it fairly useless as a desktop font.&#8221;</p>
<p>At the time of writing Fontspring is selling 1,044 font families from 36 Vendors. &#8220;I&#8217;ve actually been pleasantly surprised that the interest level of these type designers for the DIY model is high.&#8221; Ethan isn&#8217;t finished yet: &#8220;Fontspring will continue to sign on new font vendors and improve the quality of the webfonts delivered. I have a list a mile long of improvements to make to the site and user experience.&#8221;</p>
<div class="wp-caption alignnone" style="width: 450px"><img title="More than 1000 fonts to choose from" src="/article-data/images/ethanDunham-1.png" alt="More than 1000 font families to choose from" width="440" height="249" /><p class="wp-caption-text">More than 1000 font families to choose from</p></div>
<h2>Hinting</h2>
<p>All the fonts are generated with the @font-face generator. The font-face generator automatically adds hinting to the font if none is available. The hinting will make the font render better on the screen. Especially Windows browsers need hinting for the rendering.</p>
<p>Different vendors have different approaches to font optimization. Typekit for example<strong> </strong>does no optimization itself but leaves it up to the designer. The hinting of the fonts on Fontsquirrel and Fontspring are generated automatically, while font foundries like Ascender do all their hinting by hand.</p>
<p>Creating hints by hand ensures the best possible rendering, but that&#8217;s no option for Ethan: &#8220;Manual hinting is a very niche occupation and takes a lot of time. The automatic hinting does it well enough that you maybe see a few artifacts, but overall it&#8217;s gonna be pretty good. Fontspring has more than 1000 fonts. To go through all of them and manually hint them would be impossible. Having to pay somebody to do that would be very expensive obviously.&#8221;</p>
<h2>A bit about Ethan Dunham</h2>
<div class="wp-caption alignright" style="width: 210px"><img title="Ethans avatar on the web" src="/article-data/images/ethanDunham2.jpg" alt="Ethans avatar on the web" width="200" height="200" /><p class="wp-caption-text">Ethan&#39;s avatar on the web</p></div>
<p>Ethan is a full-time independent web designer in Wilmington, near Philadelphia and has been designing websites since 1996. He also designs fonts for 15 years now. He sells them on <a href="http://www.fonthead.com/">Fonthead.com</a> and now also on Fontspring.com.</p>
<p>As a font designer he never worried about the emerging web font technology: &#8220;I was one of the first to change the license agreement to allow @font-face.<strong> </strong>In my experience most people are honest and respect your intellectual property.&#8221;</p>


<p>Related posts:<ol><li><a href='http://www.thebrightlines.com/2009/12/10/251/' rel='bookmark' title='Permanent Link: My favorite for converting fonts to EOT'>My favorite for converting fonts to EOT</a></li>
<li><a href='http://www.thebrightlines.com/2010/02/28/web-fonts-services-list/' rel='bookmark' title='Permanent Link: List of web fonts services and resources'>List of web fonts services and resources</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://www.thebrightlines.com/2010/04/18/interview-with-ethan-dunham-of-fontsquirrel-and-fontspring/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Misconceptions on URL encoding and replace() in JavaScript</title>
		<link>http://www.thebrightlines.com/2010/04/08/misconceptions-on-url-encoding-and-replace-in-javascript/</link>
		<comments>http://www.thebrightlines.com/2010/04/08/misconceptions-on-url-encoding-and-replace-in-javascript/#comments</comments>
		<pubDate>Thu, 08 Apr 2010 21:26:34 +0000</pubDate>
		<dc:creator>Wouter Bos</dc:creator>
				<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[encodeURIComponent]]></category>
		<category><![CDATA[escape]]></category>
		<category><![CDATA[regex]]></category>
		<category><![CDATA[replace]]></category>

		<guid isPermaLink="false">http://www.thebrightlines.com/?p=569</guid>
		<description><![CDATA[JavaScript methods that seems to do what they're supposed to do, but not always.]]></description>
			<content:encoded><![CDATA[<h2>Escape</h2>
<p>Take for example the method of URL encoding a piece of string. There&#8217;s a pretty good chance that you run into a page that advises to use the <code>escape()</code> method for that. And although it <em>seems</em> to work, it will only handle ASCII-characters. You should use the newer method <code>encodeURIComponent()</code> for that.</p>
<p>The reason why <code>escape()</code> is still popular is probably because that method has been around longer, seems to do what you <em>think</em> it should do and is easier to remember. But if you use it for URL encoding, the end result will be buggy. Just <a href="http://www.google.nl/search?num=30&amp;hl=en&amp;client=firefox-a&amp;hs=qmJ&amp;rls=org.mozilla%3Aen-US%3Aofficial&amp;q=escape+javascript+url&amp;aq=f&amp;aqi=&amp;aql=&amp;oq=&amp;gs_rfai=">Google for &#8216;escape JavaScript URL&#8217;</a> and you&#8217;ll find lots of misinformation on this subject. <a href="http://xkr.us/articles/javascript/encode-compare/">xkr.us has a a good web page on that subject</a>.</p>
<h2>Replace</h2>
<p>Another one: <code>replace()</code>. That too seems to do what you think it should. Right? Well, not really. Only the first occurrence of a given string is replaced with another. Once again this is a method that pops up when you search for something like that and quickly copy-paste into your code. If you want to replace all strings you&#8217;ll have to use regular expressions. Instead of <code>replace('foo', 'bar')</code> you&#8217;ll have to write <code>replace(/foo/g, 'bar')</code>. Please pay attention to the lowercase &#8216;g&#8217; after the regular expression. That&#8217;s what toggles the <strong>G</strong>lobal replace.</p>


<p>No related posts.</p>]]></content:encoded>
			<wfw:commentRss>http://www.thebrightlines.com/2010/04/08/misconceptions-on-url-encoding-and-replace-in-javascript/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Document your Javascript: interview with Michael Mathews of JSDoc Toolkit</title>
		<link>http://www.thebrightlines.com/2010/03/28/document-your-javascript-interview-with-michael-mathews-of-jsdoc/</link>
		<comments>http://www.thebrightlines.com/2010/03/28/document-your-javascript-interview-with-michael-mathews-of-jsdoc/#comments</comments>
		<pubDate>Sun, 28 Mar 2010 20:19:45 +0000</pubDate>
		<dc:creator>Wouter Bos</dc:creator>
				<category><![CDATA[Documentation]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[Software]]></category>
		<category><![CDATA[jsdoc]]></category>
		<category><![CDATA[MichaelMathews]]></category>
		<category><![CDATA[micmath]]></category>

		<guid isPermaLink="false">http://www.thebrightlines.com/?p=525</guid>
		<description><![CDATA[Documenting source code is something that doesn't always get the priority it deserves. Especially Javascript which can be implemented rather ad-hoc. But there are enough tools around that can make documentation a lot easier.]]></description>
			<content:encoded><![CDATA[<div class="wp-caption alignright" style="width: 200px"><img title="Michael Mathews" src="/article-data/images/micmath.jpg" alt="Michael Mathews" width="190" height="229" /><p class="wp-caption-text">Michael Mathews</p></div>
<p>I recently discovered <a href="http://code.google.com/p/jsdoc-toolkit/">JSDoc Toolkit</a>, a tool that generates documentation of your Javascript code in the form of a website. That was dearly needed because I wanted to give me and other team members a better overview of my growing JavaScript codebase.</p>
<h2>The history of JSDoc</h2>
<p>The JSDoc-toolkit and its predecessor JSDoc have been around for nearly 10 years now and in both cases the bulk of the code is programmed by Michael Mathews, often shortened to &#8220;micmath&#8221;. JSDoc started as a solution for the growing Javascript code at the company he worked for: &#8220;I couldn&#8217;t find any existing tool that did what I wanted, so I just naturally started building my own. I didn&#8217;t want to totally reinvent the wheel of course. I basically tried to port Sun&#8217;s JavaDoc idea over to JavaScript.&#8221; So he wrote a documentation tool in Perl. &#8220;Once it was done and we&#8217;d used it a bit, I decided to release it as open source on SourceForge. I figured if I found it useful then maybe someone else would as well.&#8221;</p>
<p>Although JSDoc is a very useful documentation tool and probably the first free tool as well, it wasn&#8217;t received that well back in 2001 according to Michael Mathews: &#8220;It seemed the general JavaScript community was not yet ready for JSDoc. Back then the majority of folks doing JavaScript were not in the habit of practicing what you would call &#8216;Software Engineering&#8217; best practice! It was, more often than not, a field dominated scripting cowboys. The idea of automatic documentation generation, I think, was seen as something unneeded by most. According to the stats from SourceForge, the JSDoc tool was only downloaded a few hundred times in the first several years &#8211; and frankly that already seemed amazing enough to me.&#8221;</p>
<h2>The renaissance of JavaScript</h2>
<p>But as the web got more mature, so did the developers. Javascript gained respect in the last few years and the emerge of large libraries such as YUI, jQuery and Prototype showed that Javascript can be used in a complex but constructive way. New ways of coding were used to structure Javascript. Michael noticed the trend: &#8220;Since about 2005 JSDoc really started to take off. Since then it&#8217;s been downloaded over 30,000 times. It still seems amazing to me.&#8221; The latest version of JSDoc Toolkit is downloaded almost 5000 times since it was published in September 2009.</p>
<h2>JSDoc in the wild</h2>
<p>The term JSDoc by the way is a bit confusing. It refers both to the syntax and the program. The syntax has been relatively successful as well: &#8220;I know that a few of Google&#8217;s projects use JsDoc comments to extend their functionality. Closure Compiler is a good example of that, though it can be a pain when other projects start redefining the JsDoc syntax for their own purposes in ways that are incompatible with the original project. Of course there is no official standard for JsDoc comments, so I can&#8217;t blame them, but that is something I&#8217;d really like to see: an official JsDoc standard, I mean.&#8221;</p>
<p>&#8220;The <em>idea</em> of JSDoc has been picked up by many large projects over the years. However, my application was originally written in Perl and wasn&#8217;t very flexible, consequently it got rewritten by others a few times for internal use only. I don&#8217;t want to name any names because I personally think that, while perfectly legal to do that, it violates the open source spirit I intended the work to be used in.&#8221;</p>
<div class="wp-caption alignnone" style="width: 450px"><img title="Document your code..." src="/article-data/images/micmath-4.png" alt="Document your code..." width="440" height="266" /><p class="wp-caption-text">Document your code...</p></div>
<div class="wp-caption alignnone" style="width: 450px"><img title="...run the tool" src="/article-data/images/micmath-2.png" alt="...run the tool" width="440" height="221" /><p class="wp-caption-text">...run the tool...</p></div>
<div class="wp-caption alignnone" style="width: 450px"><img title="... and publish the generated documentation website" src="/article-data/images/micmath-3.png" alt="... and publish the generated documentation website" width="440" height="266" /><p class="wp-caption-text">...and publish the generated documentation website.</p></div>
<h2>The Toolkit of JSDoc</h2>
<p>A year after JSDoc was released, Michael resigned as an active contributor to the project. Gabriel Reid took care of JSDoc after that. He maintained and extended it. But around 2006 Michael decided to do a major upgrade for JSDoc. &#8220;Big frameworks were the norm and along with that was both the need for API documentation as well as the complexity of writing documentation for all the new and interesting things people were doing with JavaScript. I was beginning to think that, in order to get JSDoc up to speed with this new world, it would need to be rewritten from scratch. So I started a discussion about that on the users&#8217; list. That eventually led to the current incarnation of the project: JsDoc Toolkit.&#8221;</p>
<p>The rewrite was written in Javascript itself. That was possible with the open source <a href="http://www.mozilla.org/rhino/">Rhino</a> platform that parses the Javascript. That wasn&#8217;t based on any technical issue: &#8220;I just liked the idea of a program parsing itself. As a bonus the users were more likely to be able to modify the source code if it was written in a language they work in.&#8221;</p>
<p>Rhino runs on Java and was  initially developed by Netscape. Rhino would have been a part of a  larger project to port Netscape Navigator to the Java platform, but that  never happened. Rhino is still being used and is maintained by the  Mozilla Foundation.</p>
<h2>How JSDoc works</h2>
<p>JSDoc reads the code and the comments. The comments need to be formatted according to the JSDoc convention. It&#8217;s a notation that&#8217;s used in other tools like Google&#8217;s Closure as well and is similar to the JavaDoc convention.</p>
<p>The comments give hints to JSDoc Toolkit how the JavaScript is structured. Unfortunately not all notations are recognized by the tool. In fact: most of the really exotic notations are not recognized. Michael: &#8220;People don&#8217;t realize how difficult it can be to do static code analysis on a language as dynamic as JavaScript. Well, at least I didn&#8217;t. It is provably impossible in most cases to know what the various states of a JavaScript program will be at runtime, just from looking at the source code. I tell people, if you can get a program to know what you want have programmed, just from the plain source code, consider yourself lucky!&#8221;</p>
<p>&#8220;But for the rest of us JsDoc Toolkit provides a way to document your code in such a way that the tool never has to even see your code. In fact, you can even use JsDoc Toolkit in files with just comments, no code whatsoever! So in that sense there isn&#8217;t any code you can&#8217;t document with JsDoc Toolkit, as long as you don&#8217;t rely on the static code analysis features.&#8221;</p>
<p>The word &#8220;Toolkit&#8221; in the name &#8220;JSDoc Toolkit&#8221;, by the way refers to the template engine JSPlate. Michael: &#8220;I eventually went with the &#8216;Toolkit&#8217; name mostly because I liked the sound of it, but also as a little nod to a favourite templating system of mine, Andy Wardley&#8217;s Perl Template Toolkit.&#8221;</p>
<h2>JsDoc Toolkit Version 3</h2>
<p>Right now Michael is in the middle of programming version 3 of JSDoc of which the first beta should be released somewhere this summer. &#8220;Basically there are a few feature requests from JsDoc Toolkit 2 that seem reasonable enough -things like documenting the same symbol more than once- which are utterly impossible due to the core architecture of the tool itself. All those feature requests are now on the table and I&#8217;ll try to include them in the new version.&#8221;</p>
<p>&#8220;One feature that will definitely be supported is the idea of overloaded functions. A typical example would be a function named &#8216;width()&#8217; that returns the width when it is called with no arguments, but will set the width when called with a numeric argument.&#8221;</p>
<p>&#8220;This is fundamentally not possible to document in JsDoc Toolkit Version 2. And that really is the point of rewriting the tool for Version 3: it will include, in it&#8217;s core, all the lessons learned from the past several years of supporting JsDoc Toolkit. I believe it will provide a much more flexible foundation to build on.&#8221;</p>
<p>In addition, Michael will make more use of Rhino than he already did. Until now Rhino was only used to parse the server-side JavaScript. The parser that walks over the source code looking for doc comments and things like function declarations was written by Michael himself. Rhino has a JavaScript parser built in, but it would took &#8220;some serious Java hacking&#8221; to get it right.</p>
<p>&#8220;Fast forward a few years and some important things have changed: namely, Norris Boyd has made accessing Rhino&#8217;s internal Abstract Syntax Tree much easier. In fact, it is now as easy to walk over your source code as it is to use, say, DOM nodes to walk over HTML. I&#8217;d be crazy not to take advantage of all that free power just sitting there waiting to be used!&#8221;</p>
<p>&#8220;So Version 3 will have none of my own parser left in it. This means I get to shed about 40% of the project&#8217;s code, which was dedicated to just that one task, and can now focus on the more important bits: parsing the doc comments.&#8221;</p>
<p>&#8220;It also means that, in theory, if Rhino can understand it, you&#8217;ll be able to get JsDoc Toolkit to understand it. Of course this is all taking time to get up to speed with, but I&#8217;ve decided to use build my tool on top of the new <a href="http://ringojs.org/wiki/">RingoJS</a> framework and that&#8217;s made my life much easier, and the process much faster.&#8221;</p>
<p>The first beta of version 3 is estimated to be released in early summer.</p>
<h2>Continuation</h2>
<p>One of the weak spots of the JSDoc project is that most of the time there&#8217;s only one active developer working on it. Although the tool is still alive and kicking, it naturally needs some nurturing to prevent it from getting stale. &#8220;To be honest it can feel like a real burden sometimes.&#8221; Michael admits. &#8220;It&#8217;s essentially just me these days, and I mostly can&#8217;t give the project all the time it deserves.&#8221; So developers are welcomed to join in the project: &#8220;I&#8217;m ready to sign them up! The fact is that I think of JSDoc as my baby. Not that I invented anything new or amazing, I most emphatically didn&#8217;t. But I&#8217;d lived with it long enough and I&#8217;d become associated with it, so I wanted to see it do well in life.&#8221;</p>
<p>And so the development continues even though there are now some other tools around like JSDoc. He even used some of them. &#8220;I used to write a lot of Perl and JavaScript at the same time and found NaturalDocs to be a great tool because it required a single format that could work in any language.&#8221;</p>
<h2>Server side JavaScript</h2>
<p>Although JavaScript as a program language is appreciated much more than a few years ago, it is still a quirky language. But that&#8217;s no problem for Michael: &#8220;Yeh, it&#8217;s a weird language. But I come from a background of Perl, so I like weird languages! But actually, JavaScript on the server side is a totally refreshing experience. Rhino, for example, allows you to use all the latest cutting-edge JavaScript syntax and features, and you never have to worry about running in an ancient or buggy web browser. I hope and expect that server side JavaScript will really start catching on in the next few years.&#8221;</p>
<h2>A bit about Michael Mathews</h2>
<p>It was hard to find a bit of information about New Yorker Michael Mathews. Although JSDoc has been around for almost 10 years and is downloaded a lot, he hasn&#8217;t been interviewed before. He has been asked many times for some assistance though. It can create funny situations: &#8220;I was doing some freelance work and the fellow sitting next to me asked if I&#8217;d ever heard anything about this &#8216;JSDoc&#8217; stuff he was trying to use. I said I had heard of it and helped him sort it out. I had to eventually admit that I was the creator of the tool. He seemed a little surprised by that.&#8221;</p>
<p>Mathews started as a zookeeper, which he had done for a few years. But it wasn&#8217;t that much fun for him. &#8220;I basically cleaned up after lots of unusual animals.&#8221; When he wasn&#8217;t working, he played with his computer. &#8220;By the late nineties I was had my own homepage, complete with the large, requisite, &#8216;Under Construction&#8217; message.&#8221; His work behind the computer payed off eventually: &#8220;in the fall of 1998 I was employed as a Web Developer for MTV Online, working in Times Square in New York City. It still seems amazing to me.</p>
<p>He now works since 2008 for the BBC in London where he works on the <a href="http://www.bbc.co.uk/glow/">Glow</a> JavaScript library. And yes, everything of it is documented with the help of JSDoc Toolkit.</p>
<p>Glow is a JavaScript library that just, like Prototype and jQuery, makes programming in JavaScript easier. The difference is that Glow supports whatever standard is currently defined by the BBC Standards and Guidelines for browsers, accessibility and usability. This could mean it has to support older browsers that other major JavaScript libraries have already dropped.</p>
<h2>Links</h2>
<ul>
<li><a href="http://code.google.com/u/micmath/">JSDoc Toolkit</a></li>
<li><a href="http://twitter.com/jsdoctoolkit">JSDoc Toolkit Twitter</a></li>
<li><a href="http://micmath.github.com/">JSDoc Toolkit 3 Blog</a></li>
<li><a href="http://groups.google.com/group/jsdoc-2?pli=1">JsDoc Toolkit Users Group</a></li>
</ul>


<p>Related posts:<ol><li><a href='http://www.thebrightlines.com/2010/05/06/new-template-for-jsdoctoolkit-codeview/' rel='bookmark' title='Permanent Link: Codeview, a new template for JSDoc Toolkit'>Codeview, a new template for JSDoc Toolkit</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://www.thebrightlines.com/2010/03/28/document-your-javascript-interview-with-michael-mathews-of-jsdoc/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Web font rendering in IE9</title>
		<link>http://www.thebrightlines.com/2010/03/18/font-rendering-in-ie9/</link>
		<comments>http://www.thebrightlines.com/2010/03/18/font-rendering-in-ie9/#comments</comments>
		<pubDate>Thu, 18 Mar 2010 22:31:54 +0000</pubDate>
		<dc:creator>Wouter Bos</dc:creator>
				<category><![CDATA[Webfonts]]></category>
		<category><![CDATA[direct2d]]></category>
		<category><![CDATA[directwrite]]></category>
		<category><![CDATA[ie9]]></category>

		<guid isPermaLink="false">http://www.thebrightlines.com/?p=515</guid>
		<description><![CDATA[Some weeks ago I did a test to see how fonts look in a browser when they are not optimized for that. The result was that rendering and legibility was sometimes poor on Windows. Now that the IE9 Platform Preview is out, it's time to do the test once more.]]></description>
			<content:encoded><![CDATA[<div class="wp-caption alignleft" style="width: 121px"><img title="IE9 on Vista on the left and IE8 on Windows 7 on the right" src="/article-data/images/fontrendering-IE9-1.png" alt="IE9 on Vista on the left and IE8 on Windows 7 on the right" width="111" height="81" /><p class="wp-caption-text">IE9 on Vista on the left and IE8 on Windows 7 on the right. The font is Bodoni</p></div>
<p>For those who read my article on <a href="http://www.thebrightlines.com/2010/01/24/test-popular-professional-fonts-as-webfont/">font rendering of professional fonts</a> were surely disappointed to read that their fonts would most likely not render well in browsers on Windows if you use the CSS technique @font-face.</p>
<p>At the moment your best chance of getting a font rendering well in a browser is by buying or renting one from a font foundry like FontFont or Ascender, who optimize their fonts for the web. Fonts that aren&#8217;t optimized most likely will not render that well.</p>
<p>Well, there is some good news. IE9 uses Direct2D and DirectWrite and it seems that it does a much better job at font  rendering as you can already see in the example on the left. So although we will still be very much dependent on those optimized fonts until the predecessors of IE9 have finally faded away, there is light on the horizon.</p>
<p>Its very exiting to see that the font rendering improved so much. Just look at the zoomed in part of the letter &#8216;g&#8217;:</p>
<div class="wp-caption alignnone" style="width: 420px"><img title="The letter g at 500%. Again: IE9 on the left and IE8 on the right, in case you were still wondering ;)" src="/article-data/images/fontrendering-IE9-2.png" alt="The letter g at 500%. Again: IE9 on the left and IE8 on the right, in case you were still wondering ;)" width="410" height="175" /><p class="wp-caption-text">The letter &#39;g&#39; of the font Bodoni at 500%. Again: IE9 on the left and IE8 on the right, in case you were still wondering <img src='http://www.thebrightlines.com/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p></div>
<h2>Some notes on rendering</h2>
<p>Not very surprising, but sometimes the rendering of a piece of text in IE9 can result in something that&#8217;s significant wider than in IE8:</p>
<div class="wp-caption alignnone" style="width: 458px"><img title="Two screenshots of identical texts in IE8 and IE9, placed on top of each other" src="/article-data/images/fontrendering-IE9-3.png" alt="Two screenshots of identical texts in IE8 and IE9, placed on top of each other" width="448" height="27" /><p class="wp-caption-text">Two screenshots of identical texts in IE8 and IE9, placed on top of each other</p></div>
<p>You can still find some rendering glitches like you can see here:</p>
<div class="wp-caption alignnone" style="width: 458px"><img title="Still some bad rendering in IE9 with Helvetica at font-size 14, 15 and 16" src="/article-data/images/fontrendering-IE9-4.png" alt="Still some bad rendering in IE9 with Helvetica at font-size 14, 15 and 16" width="448" height="77" /><p class="wp-caption-text">Still some bad rendering in IE9 with Helvetica at font-size 14, 15 and 16</p></div>
<div class="wp-caption alignnone" style="width: 458px"><img title="Dax too still renders bad at some font sizes. The first line is IE9. The second line shows the font in Safari, rendering it as it should be." src="/article-data/images/fontrendering-IE9-5.png" alt="Dax too still renders bad at some font sizes. The first line is IE9. The second line shows the font in Safari, rendering it as it should be." width="448" height="62" /><p class="wp-caption-text">Dax too still renders bad at some font sizes. The first line is IE9. The second line shows the font in Safari, rendering it as it should be.</p></div>
<p><strong>Just to make it absolutely clear: the fonts in these examples are converted <em>without</em> any hinting improvement.</strong></p>


<p>Related posts:<ol><li><a href='http://www.thebrightlines.com/2010/01/24/test-popular-professional-fonts-as-webfont/' rel='bookmark' title='Permanent Link: Test: Popular professional fonts as webfont'>Test: Popular professional fonts as webfont</a></li>
<li><a href='http://www.thebrightlines.com/2010/03/09/new-web-font-service-ascender-corporation/' rel='bookmark' title='Permanent Link: New web font service: Ascenderfonts.com'>New web font service: Ascenderfonts.com</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://www.thebrightlines.com/2010/03/18/font-rendering-in-ie9/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Taking back the control</title>
		<link>http://www.thebrightlines.com/2010/03/15/taking-back-the-control/</link>
		<comments>http://www.thebrightlines.com/2010/03/15/taking-back-the-control/#comments</comments>
		<pubDate>Mon, 15 Mar 2010 20:04:41 +0000</pubDate>
		<dc:creator>Wouter Bos</dc:creator>
				<category><![CDATA[CSS]]></category>
		<category><![CDATA[Web development in general]]></category>
		<category><![CDATA[cooliris]]></category>
		<category><![CDATA[Firefox]]></category>
		<category><![CDATA[greasemonkey]]></category>
		<category><![CDATA[plugins]]></category>
		<category><![CDATA[readability]]></category>
		<category><![CDATA[stylish]]></category>

		<guid isPermaLink="false">http://www.thebrightlines.com/?p=506</guid>
		<description><![CDATA[As a user, you have more control than you think over what your browser does with websites.]]></description>
			<content:encoded><![CDATA[<div class="wp-caption alignright" style="width: 225px"><img title="The Bright Lines, seen through readability" src="/article-data/images/readability.png" alt="The Bright Lines, seen through readability" width="215" height="198" /><p class="wp-caption-text">The Bright Lines, as seen through &#39;readability&#39;</p></div>
<p>Lately I came across <a href="http://lab.arc90.com/experiments/readability/">Readability</a>. It&#8217;s a bookmarklet (works only in FF, Safari and Chrome) that alters any website into a more readable one. It does so by presenting it in a book form. At a first glance I thought it as a nice  tool, but I wasn&#8217;t sure I was going to use it. Then I thought that it was a real good example that you as a user have more to say than you think.</p>
<p>We always accept the usability of the websites for what it is. If it&#8217;&#8217;s good, it&#8217;s good. If it&#8217;s bad it&#8217;s bad. But the frontend of the website is built on <em>your</em> computer, in <em>your</em> browser. You have a certain level of control over the HTML, CSS and Javascript.</p>
<p>The most common way to make a website better is by using ad blockers. Yes, some people do live of advertising, but I don&#8217;t think that means you should be obliged to see them if you don&#8217;t want to. Especially when they distract. The best thing about ad blockers is that it doesn&#8217;t require any knowledge of web development at all.</p>
<p>Another example is <a href="https://addons.mozilla.org/en-US/firefox/addon/5579">CoolIris</a> that convert image pages of popular websites like Google Images or Flickr into a 3D wall of images.</p>
<p>A more techie Firefox plugin that I use is <a href="https://addons.mozilla.org/en-US/firefox/addon/2108">Stylish</a>. I use it to add my own CSS to websites I regularly visit. Most of the time I use it to remove section that I regard useless with a simple <code>display: none</code>. A more powerful variation of Stylish is the plugin <a href="https://addons.mozilla.org/en-US/firefox/addon/748">Greasemonkey</a>. With Greasemonkey you can alter the websites with Javascript. And just like Stylish, you can publish your customization of the website through the plugin.</p>
<p>So that&#8217;s a reminder for me to see that websites are not cast in stone. Popular websites will on the client side be hacked by a small minority of users to cater their own needs. And if a site is really in need of improvement, plugins that help non-technical users would spread like wildfire.</p>


<p>Related posts:<ol><li><a href='http://www.thebrightlines.com/2009/10/29/popups-dodging-popup-blockers/' rel='bookmark' title='Permanent Link: Popups dodging popup blockers'>Popups dodging popup blockers</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://www.thebrightlines.com/2010/03/15/taking-back-the-control/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>New web font service: Ascenderfonts.com</title>
		<link>http://www.thebrightlines.com/2010/03/09/new-web-font-service-ascender-corporation/</link>
		<comments>http://www.thebrightlines.com/2010/03/09/new-web-font-service-ascender-corporation/#comments</comments>
		<pubDate>Tue, 09 Mar 2010 21:02:36 +0000</pubDate>
		<dc:creator>Wouter Bos</dc:creator>
				<category><![CDATA[Webfonts]]></category>

		<guid isPermaLink="false">http://www.thebrightlines.com/?p=500</guid>
		<description><![CDATA[2010 is definitely going to be the year of the web font now that the technical problems concerning browser support finally have been lifted. Font foundry Ascender is also jumping on the bandwagon now that their web font service is cross-browser.]]></description>
			<content:encoded><![CDATA[<div class="wp-caption alignright" style="width: 210px"><img class=" " title="Screenshot of www.ascenderfonts.com" src="/article-data/images/ascender-2.png" alt="Screenshot of www.ascenderfonts.com" width="200" height="171" /><p class="wp-caption-text">Screenshot of www.ascenderfonts.com</p></div>
<p>This year the web font will become omnipresent. It&#8217;s possible to convert the fonts yourself and incorporate it into your website with something like <a href="http://www.fontsquirrel.com/fontface/generator">Fontsquirrel</a>. But some fonts just need a bit more than just a conversion, since they can look bad in browsers, certainly on Windows. So it was time for me to test some font services, since you may expect that the people behind the web service at least check if a font renders correctly.</p>
<p>Lucky for me that Bill Davis of <a href="http://www.ascenderfonts.com/">Ascenderfonts.com</a> asked me to check out their new font service after reading my <a href="http://www.thebrightlines.com/2010/01/24/test-popular-professional-fonts-as-webfont/">article on web font rendering</a>. At that time Ascenderfont did not offer trial accounts, so I was happy to take the offer in order to be able to give the service a spin for free.</p>
<h2>The Ascender Corporation</h2>
<p><img class="alignleft" title="Ascender Corporation logo" src="/article-data/images/ascender.png" alt="" width="59" height="60" />The website Ascenderfonts.com is not a company by itself. It is the webshop of the font foundry Ascender Corporation. The company creates fonts, extends glyphs and hinting and resells fonts, so the emerge of web fonts means another opportunity for them to sell their fonts.</p>
<p>The company is founded in 2004 by a few software developers and typographers. One of the founder, Steve Matteson, has worked on both Arial and Times New Roman for Windows 3.1. He also designed Convection which is the font for the Xbox360, Liberation which is used on many Linux distributions and Andale Mono, a mono spaced font that for long had been my favorite font for replacing that less readable Courier. Finally he also designed Droid, the font for Google&#8217;s Android platform.</p>
<p>Another founder of Ascender, Tom Rickner, has been involved with the design of fonts like Georgia, Tahoma and Verdana. All fonts we&#8217;re familiar with.</p>
<p>Ascender Officially started their web font service in July 2009 but it wasn&#8217;t a real option for web developers back then, since they only offered EOT Lite. That automatically meant that the fonts were only visible in Internet Explorer.</p>
<p>Back then EOT Lite was proposed by Ascender to the W3C as a default standard for web fonts. But the W3C chose WOFF as a standard, so in the beginning of January they started to support TTF and WOFF as well. Now all major browsers except Safari on the iPhone are supported.</p>
<h2>The service</h2>
<p>The fact that the service is now cross-browser has not been promoted yet, so it&#8217;s still more or less under the radar. But that could change quickly. They already offer 200+ fonts (<a href="http://typekit.com/">Typekit</a> offered at time of writing 400+) but want to have between 500 and a 1000 web fonts within two years.</p>
<p>Getting such a large collection is harder than it seems. Many fonts are by default not suitable for the web. I did a <a href="/2010/01/24/test-popular-professional-fonts-as-webfont/">little test</a> recently to see how some popular professional fonts would look like in a browser. All of them did not render well in one or more font sizes. It&#8217;s not much better with free and shareware fonts: a study of Ascender concluded that almost 96% of all those fonts have some sort of trouble with rendering in the browser.</p>
<p>So there&#8217;s a whole world of fonts that need to be improved in order to be used on the web. It&#8217;s easy to see the need. Fonts are a major component of a corporate identity and fonts like Arial or Times New Roman are rarely part of the offline corporate identity. Every company wants to have their online identity in sync with the offline version so that means lots of potential work for Ascender. Making a print font fit for the web starting from 9 pixels and up is worth a few days of work.</p>
<p>The focus on good screen rendering is according to Bill Davis of the Ascender Company the main reason why a web developer should choose for their service. According to Bill some other advantages of their service would be that their service (in contrary to Typekit) works without Javascript and that the licensing is per font and per domain, which should be easy for billing, especially for larger companies.</p>
<p>What I missed when using the Ascenderfont service is a bit more information about the rendering. There are screenshots of Windows and the Mac and you can do a actual font rendering in your own browser, but it&#8217;s not as detailed as Typekit that show previews of fonts at different font sizes, of all the major browsers on each major operating system. Okay, maybe it&#8217;s a bit too much information, but it is comforting to know that you can check every option before choosing a particular font.</p>
<p>What I do like is that the web fonts are categorized between the ones that are fit for headings and the ones that are fit for body text. Typekit has that function too through tagging, but at the moment only a few fonts are tagged as either headline or text.</p>
<h2>What about the font creators?</h2>
<p>With all the web fonts popping up everywhere I was wondering how the font foundries themselves look at this new development. Well, the people of Ascender certainly don&#8217;t feel uncomfortable with it. Bill Davis of Ascender says that most of their clients fine with web fonts: &#8220;Almost all of our clients agreed with our proposal of EOT Lite (wb: similar to EOT, but without URL binding and proprietary compression) as a standard, so that&#8217;s a clear sign that font creators see web fonts as a viable way of using fonts in websites.&#8221;</p>
<h2>Which service must I choose?</h2>
<p>Although it&#8217;s interesting to compare web services with each other, it will be the font service with the most fonts that will probably win the battle for the clients. Designers want to have a broad choice of fonts to choose from. That is: if they even check if a font is available as a web font on forehand. Every web developer is sometimes confronted with designs created by someone who wanted to make something &#8216;challenging&#8217; or just don&#8217;t know/care about technical limitations. In such a case it&#8217;s the service with the most fonts that could most likely offer font that&#8217;s in the delivered web design.</p>


<p>Related posts:<ol><li><a href='http://www.thebrightlines.com/2010/02/28/web-fonts-services-list/' rel='bookmark' title='Permanent Link: List of web fonts services and resources'>List of web fonts services and resources</a></li>
<li><a href='http://www.thebrightlines.com/2010/03/18/font-rendering-in-ie9/' rel='bookmark' title='Permanent Link: Web font rendering in IE9'>Web font rendering in IE9</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://www.thebrightlines.com/2010/03/09/new-web-font-service-ascender-corporation/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>FontFont is now selling web fonts</title>
		<link>http://www.thebrightlines.com/2010/03/01/fontfont-is-now-selling-web-fonts/</link>
		<comments>http://www.thebrightlines.com/2010/03/01/fontfont-is-now-selling-web-fonts/#comments</comments>
		<pubDate>Sun, 28 Feb 2010 22:54:09 +0000</pubDate>
		<dc:creator>Wouter Bos</dc:creator>
				<category><![CDATA[Webfonts]]></category>
		<category><![CDATA[fontfont]]></category>
		<category><![CDATA[fontshop]]></category>

		<guid isPermaLink="false">http://www.thebrightlines.com/?p=471</guid>
		<description><![CDATA[There's another foundry offering a part of their fonts as web fonts.]]></description>
			<content:encoded><![CDATA[<p>In case it wasn&#8217;t clear in <a href="/2010/02/28/web-fonts-services-list/">my previous article</a>: FontFont is now selling some of their fonts as web fonts, including FF DIN, FF Meta, FF Dax, and FF Kievit. <a href="http://www.fontshop.com/fontlist/n/web_fontfonts/?utm_source=NewsletterFeb2410&amp;utm_medium=web&amp;utm_content=WebFontsFontlist&amp;utm_term=em&amp;utm_campaign=FF52Web">Complete list of FontFont&#8217;s web fonts</a>. FontFont is only selling the font. They won&#8217;t host it for you. And you can only download EOT Lite and WOFF from their website. In order to make web fonts work in Safari and Chrome, you&#8217;ll have to Typekit. That&#8217;s because Safari en Chrome cannot load WOFF, but will accept TTF or OTF. One problem with the web fonts license is that you cannot create a mock-up in Photoshop since you cannot install an EOT or WOFF on your computer.</p>
<p>You can <a href="http://www.fontshop.com/blog/?p=1763">read more about it on their weblog</a>.</p>


<p>Related posts:<ol><li><a href='http://www.thebrightlines.com/2010/02/28/web-fonts-services-list/' rel='bookmark' title='Permanent Link: List of web fonts services and resources'>List of web fonts services and resources</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://www.thebrightlines.com/2010/03/01/fontfont-is-now-selling-web-fonts/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
