<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
   <title>mezzoblue</title>
   <link rel="alternate" type="text/html" href="http://mezzoblue.com/" />
   <link rel="self" type="application/atom+xml" href="http://mezzoblue.com/feeds/index-posts.xml" />
   <id>tag:mezzoblue.com,2010://2</id>
   <updated>2010-07-27T22:48:06Z</updated>
   
   <author>
      <name>Dave Shea</name>
      <uri>http://mezzoblue.com/about/dave/</uri>
   </author>


<entry>
   <title>A CSS3 Tip</title>
   <link rel="alternate" type="text/html" href="http://mezzoblue.com/archives/2010/07/27/a_css3_tip/" />
   <id>tag:mezzoblue.com,2010://2.1453</id>
   
   <published>2010-07-27T22:38:04Z</published>
   <updated>2010-07-27T22:48:06Z</updated>
   
   <summary>I&apos;m probably way behind the curve on this one, but I recently realized the following: All browsers that support the CSS text-shadow and box-shadow properties also support the new CSS3 RGBa syntax. Which means you can safely combine them today....</summary>
   <content type="html" xml:lang="en" xml:base="http://mezzoblue.com/">
      <![CDATA[<p>I'm probably way behind the curve on this one, but I recently realized the following:</p>

<p>All browsers that support the CSS <code>text-shadow</code> and <code>box-shadow</code> properties also support the new CSS3 RGBa syntax. Which means you can safely combine them today.</p>

<p>That's handy, because it means no worrying about matching a precise hex colour shadow to a specific hex colour background. Instead just let the browser blend. An example:</p>

<pre><code class="css">p {
  text-shadow: rgba(0, 0, 0, 0.2) 0 1px 0;
}</code></pre>

<p style="text-shadow: rgba(0, 0, 0, 0.2) 0 1px 0;">That will produce a paragraph with a 20% opacity black drop shadow that will blend into any background colour below it. A paragraph like this one.</p>

<p>Previously I might have created the drop shadow in Photoshop, then used the eye dropper tool to pull out the composited shadow hex value after the transparency was applied to the background colour. No more!</p>]]>
      
   </content>
</entry>

<entry>
   <title>IE8 Still Failing PNG Alpha</title>
   <link rel="alternate" type="text/html" href="http://mezzoblue.com/archives/2010/05/20/ie8_still_fa/" />
   <id>tag:mezzoblue.com,2010://2.1452</id>
   
   <published>2010-05-20T21:48:38Z</published>
   <updated>2010-05-21T00:00:37Z</updated>
   
   <summary>You thought our long nightmare of PNG alpha transparency support was finally over as of IE7, didn&apos;t you? Yeah, me too. Over the past few months I&apos;ve been collaborating with Chris Glass on the newly-launched Joyent site. (When someone comes...</summary>
   <content type="html" xml:lang="en" xml:base="http://mezzoblue.com/">
      <![CDATA[<p>You thought our long nightmare of PNG alpha transparency support was finally over as of IE7, didn't you? Yeah, me too.</p>

<p>Over the past few months I've been collaborating with <a href="http://chrisglass.com/">Chris Glass</a> on the newly-launched <a href="http://joyent.com/">Joyent</a> site. (When someone comes to you and says, hey, we have Chris Glass helping us out with this project and we'd like the two of you to work together, you jump at that chance.)</p>

<p>I was tossing around ideas for building an <a href="http://www.joyent.com/technology/">interactive infographic</a> Chris had designed, and thought of at least four different ways of pulling it off. We're reaching this interesting point with front end web technology where we now have actual choices besides Flash for jobs like this. I considered CSS3 animations and the Canvas element before ultimately deciding on PNGs with alpha transparency and jQuery transitions and fades.</p>

<p>I put off browser testing as long as I could, but just this week prior to launch I realized it was very broken in all versions of Internet Explorer. I had a plan to back out to a static graphic in IE6, assuming IE7 and IE8 would treat the PNG + animation combo like any other reasonably modern browser. I was wrong.</p>

<p>It seems that IE's implementation of PNGs with alpha transparency is still buggy or incomplete in some way. When you place a PNG with alpha on a static page, you'll never be the wiser. It's when you adjust the opacity of that PNG that you run into problems. Take the following example:</p>

<ul id="test-1" style="width: 550px; overflow: hidden; padding: 20px 0;">
	<li style="float: left; width: 150px; background: #fff; text-align: center; margin-right: 30px; padding: 20px 0;">
	<img src="http://mezzoblue.com/articles/supplements/2010/05/triangles.png" width="89" height="251" alt="" />
	</li>
	<li style="float: left; width: 150px; background: url(http://mezzoblue.com/articles/supplements/2010/05/bg1.jpg); text-align: center; margin-right: 30px; padding: 20px 0; -webkit-border-radius: 20px; -moz-border-radius: 20px; border-radius: 20px;">
	<img src="http://mezzoblue.com/articles/supplements/2010/05/triangles.png" width="89" height="251" alt="" />
	</li>
	<li style="float: left; width: 150px; background: url(http://mezzoblue.com/articles/supplements/2010/05/bg2.jpg); text-align: center; margin-right: 30px; padding: 20px 0; -webkit-border-radius: 20px; -moz-border-radius: 20px; border-radius: 20px;">
	<img src="http://mezzoblue.com/articles/supplements/2010/05/triangles.png" width="89" height="251" alt="" />
	</li>
</ul>

<p>I'm overlaying this slightly-transparent image of three triangles atop a few different backgrounds. So far so good. IE7 and IE8 keep up. But if I apply further transparency to the image in the form of a jQuery <code>fadeIn</code> or an opacity value, things go a little haywire:</p>

<ul id="test-2" style="width: 550px; overflow: hidden; padding: 20px 0;">
	<li style="float: left; width: 150px; background: #fff; text-align: center; margin-right: 30px; padding: 20px 0;">
	<img src="http://mezzoblue.com/articles/supplements/2010/05/triangles.png" width="89" height="251" alt="" />
	</li>
	<li style="float: left; width: 150px; background: url(http://mezzoblue.com/articles/supplements/2010/05/bg1.jpg); text-align: center; margin-right: 30px; padding: 20px 0; -webkit-border-radius: 20px; -moz-border-radius: 20px; border-radius: 20px;">
	<img src="http://mezzoblue.com/articles/supplements/2010/05/triangles.png" width="89" height="251" alt="" />
	</li>
	<li style="float: left; width: 150px; background: url(http://mezzoblue.com/articles/supplements/2010/05/bg2.jpg); text-align: center; margin-right: 30px; padding: 20px 0; -webkit-border-radius: 20px; -moz-border-radius: 20px; border-radius: 20px;">
	<img src="http://mezzoblue.com/articles/supplements/2010/05/triangles.png" width="89" height="251" alt="" />
	</li>
</ul>

<p>That's the same setup as before, only with an opacity value of 0.99 (almost completely opaque) applied to each <code>img</code> element. In non-IE browsers, the previous two examples ought to look the same. In IE7 and IE8 on the other hand, the previous example instead looks like this next one:</p>

<img src="http://mezzoblue.com/articles/supplements/2010/05/nicejob.jpg" width="510" height="295" alt="IE rendering" style="margin: 20px 0;" />

<p>Of course, no version of IE supports the CSS <code>opacity</code> property yet, so jQuery instead applies the opacity by exploiting the IE-proprietary AlphaImageLoader filter. This ends up being the root cause of the (<a href="http://groups.google.com/group/jquery-dev/browse_thread/thread/1f693c5f4e8ea650/f49280e7958bac7d?lnk=gst&amp;q=fade+transparent+png&amp;pli=1">seemingly well-known</a>) bug. The suggested fix is to apply the transparency to the parent element instead, but I've had little success with that workaround.</p>

<p>What did work was a little library called <a href="http://www.dillerdesign.com/experiment/DD_belatedPNG/">DD_belatedPNG</a> that applies PNG transparency via VML instead of AlphaImageLoader. It's designed for IE6, but it works just fine in IE7 as well. For IE8, I was forced to throw out an <a href="http://msdn.microsoft.com/en-us/library/cc288325(VS.85).aspx">X-UA-Compatible</a> meta tag and step IE8 down to IE7 mode for this particular page.</p>

<p>It's still not perfect. I noticed a faint white bounding box poking through at lower opacities that forced me to slightly adjust hover effects for all versions of IE. But you know, for all that, it's darn well good enough.</p>

<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.3/jquery.min.js" type="text/javascript"></script>
<script type="text/javascript">

$(document).ready(function(){


	$("#test-2 li img").css({
		opacity: 0.99
	});

});
</script>]]>
      
   </content>
</entry>

<entry>
   <title>Smaller PNGs</title>
   <link rel="alternate" type="text/html" href="http://mezzoblue.com/archives/2010/04/15/smaller_pngs/" />
   <id>tag:mezzoblue.com,2010://2.1451</id>
   
   <published>2010-04-16T05:23:55Z</published>
   <updated>2010-04-19T15:29:02Z</updated>
   
   <summary>Last week I put together an animated infographic that required some flexibility. Alpha transparency was essential, but the number of images I needed to pull it off meant that my typical way of creating PNGs wasn&apos;t going to work. Let&apos;s...</summary>
   <content type="html" xml:lang="en" xml:base="http://mezzoblue.com/">
      <![CDATA[<p>Last week I put together an animated infographic that required some flexibility. Alpha transparency was essential, but the number of images I needed to pull it off meant that my typical way of creating PNGs wasn't going to work.</p>

<p>Let's be honest; Photoshop is absolutely terrible at saving transparent PNGs for web use. Your choices are between an 8-bit with 1-bit transparency (better than a GIF in terms of file size, but no better in terms of transparency options) or a huge 32-bit PNG with alpha transparency. There's no middle ground. You can run the resulting files through various PNG reduction utilities (<a href="http://advsys.net/ken/utils.htm">PNGOUT</a>, <a href="http://pmt.sourceforge.net/pngcrush/">Pngcrush</a>, or my personal favourite <a href="http://www.brothersoft.com/pngthing-245069.html">PngThing</a>) but when the savings are a few hundred bytes off an 80KB file, the returns are slim.</p>

<p>I'm not in the practice of using Fireworks, so those of you who do can start gloating now. But as I thought about the problem a bit, I remembered that Fireworks has a few more options. Specifically, I remembered that you can save out 8-bit PNGs with alpha transparency, which seemed like the right mix.</p>

<p>And the resulting lower byte counts were respectable: 95KB &rsaquo; 11.7KB. 28KB &rsaquo; 4.6KB. 38KB &rsaquo; 8.9KB. 36KB &rsaquo; 7.1KB. 45KB &rsaquo; 7.3KB. 28KB &rsaquo; 4.7KB. etc.</p>

<p>When I casually mentioned the smaller files I was able to produce on Twitter I was a little surprised by the response. Seems that a lot of people don't know about this, so a quick write-up feels like it's in order. Here's my process.</p>

<h3>1. Save out a full 32bit PNG from Photoshop</h3>
<p>Any file format with transparency will do really. You could probably even just open the PSD. But I start here.</p>

<h3>2. Load it into Fireworks.</h3>

<h3>3. In the Optimize palette, adjust the settings to PNG 8.</h3>
<p>You'll probably want to go further and find a colour level less than 256 that works with your image for more savings, but this is the starting point anyway.</p>
<div class="block-img image-holder-1up">
<img src="http://www.mezzoblue.com/articles/supplements/2010/04/fireworks.png" width="500" height="236" alt="screenshot of Fireforks Optimization panel" />
<p class="caption"><span class="caption-title">Figure:</span> an image open in Fireworks with the Optimize panel shown, adjusted to PNG 8, 32 colours, with Alpha Transparency selected.</p>
</div>

<h3>4.Export.</h3>
<p>File &gt; Export, then pick a spot for your smaller file.<p>

<p>And that's basically it. Clearly this only works for images that would normally do well with lower colour levels, you won't be using this for photographic elements any time soon. But for those that work, you can throw the result through one of the previously-mentioned optimization tools to shave off a few more bytes too.</p>]]>
      
   </content>
</entry>

<entry>
   <title>Illustrator to HTML5&apos;s Canvas</title>
   <link rel="alternate" type="text/html" href="http://mezzoblue.com/archives/2010/01/14/illustrator_/" />
   <id>tag:mezzoblue.com,2010://2.1450</id>
   
   <published>2010-01-15T02:15:29Z</published>
   <updated>2010-04-05T19:35:47Z</updated>
   
   <summary>I&apos;ve spent a bit of time playing around with HTML5&apos;s canvas element lately. It&apos;s a fun new toy and has a lot of potential to be useful. But the biggest headache I&apos;m finding so far is the lack of authoring...</summary>
   <content type="html" xml:lang="en" xml:base="http://mezzoblue.com/">
      <![CDATA[<p>I've spent a bit of time playing around with HTML5's <code>canvas</code> element lately. It's a fun new toy and has a lot of potential to be useful. But the biggest headache I'm finding so far is the lack of authoring tools.</p>

<p>SVG has been around for ages, whereas Canvas is still relatively new. (Mozilla's <a href="http://blog.vlad1.com/">Vladimir Vukićević</a> has a <a href="http://people.mozilla.com/~vladimir/xtech2006/">good overview presentation</a> of the differences between the two, and when and where to use each.) SVG support is built into plenty of graphic editing tools; Canvas support is so far sadly lacking, although <a href="http://www.bestkungfu.com/">Matt May</a> pointed me to <a href="http://www.youtube.com/watch?v=bP98Tfc4WWg">this YouTube video</a> that shows off the upcoming Canvas support Adobe's CS5 suite will have, whenever it becomes available.</p>

<p>In the meantime, most of the Canvas demos we've seen thus far have mostly  featured simple primitive shapes like lines and ellipses for good reason: it's too hard to build up a reasonably complex vector image by manually plotting bezier curves.</p>

<p>Over the past few days I've tried out various ways to get around this problem. I came up with two methods of taking vector shapes out of Illustrator and rendering them with Canvas, both involving an intermediate step as SVG first.</p>

<p>So to start, from Illustrator (or any other vector editing application capable of doing so) export your artwork to SVG. You'll find the SVG option in the Save As / Save a Copy dialog, and I've found the SVG profile you choose doesn't really make much of a difference (though for the sake of argument I've been using 1.1).</p>

<p>We'll use this happy little cloud image as our reference file:</p>

<div class="block-img image-holder-1up">
	<iframe src="http://www.mezzoblue.com/articles/supplements/2010/01/happy-cloud.svg" width="200" height="200"></iframe>

	<p><a href="http://www.mezzoblue.com/articles/supplements/2010/01/happy-cloud.svg">(download the SVG file)</a></p>
</div>

<h3>1) Manually</h3>

<p>This method is only theoretical so if you're looking for the actual how-to, skip ahead to #2. I figure it might be worth writing this up anyway because, even though I couldn't get it working, perhaps it'll provide enough of a starting point for someone else to pick up where I left off and build a proper converter.</p>

<p>SVG and Canvas are both essentially vector drawing tools; Canvas is more pixel-oriented, but you are certainly able to plot lines and curves mathematically. Canvas is also limited to fewer primitive shapes, but there are obvious parallels between the two.</p>

<p>I spent a bit of time looking into the bezier commands in particular. In SVG, to plot a bezier curve, you do something like this:</p>

<pre><code class="svg">  &lt;path d="C x1,y1 x2,y2 x,y" /&gt;
</code></pre>

<p>In Canvas, it's this instead:</p>

<pre><code class="javascript">  ctx.bezierCurveTo(x1,y1, x2,y2, x,y);
</code></pre>

<p>Different syntax, but the same basic components: you're drawing a line from the current pen position to the x, y value, and before that you have two additional points (x1, y1 and x2, y2) that set your handles. (More <a href="http://tutorials.jenkov.com/svg/path-element.html">SVG path commands</a>, <a href="http://www.whatwg.org/specs/web-apps/current-work/multipage/the-canvas-element.html#complex-shapes-(paths)">Canvas path methods</a>.) It's worth noting that SVG is more forgiving about commas; each coordinate must be separated by a comma for the Canvas method, but they're strictly optional in the SVG example. This is relevant because Illustrator's SVG export seems to be wildly inconsistent about when and how many commas each command uses.</p>

<p>Given the similarities, I thought it might be fairly straightforward to manually tweak the SVG output into Canvas drawing functions. <code>M</code> becomes <code>moveTo</code>, <code>C</code> becomes <code>bezierCurveTo</code>, and so forth.</p>

<pre><code class="svg">  &lt;path d="
    M 62.58, 31.96
    c -0.711,0 -1.811,0.062 -3.181,0.165
    c -0.566 -6.309 -5.862 -11.255 -12.318 -11.255
    c -2.363,0 -4.564,0.675 -6.442,1.824 "/&gt;
</code></pre>

<p>Becomes:</p>

<pre><code class="javascript">  ctx.moveTo(62.58, 31.96);
  ctx.bezierCurveTo(-0.711,0,-1.811,0.062,-3.181,0.165);
  ctx.bezierCurveTo(-0.566,-6.309,-5.862,-11.255,-12.318,-11.255);
  ctx.bezierCurveTo(-2.363,0,-4.564,0.675,-6.442,1.824);
</code></pre>


<p>This did not work. I suspect the absolute vs. relative coordinate difference between SVG's <code>c</code> and <code>C</code> commands tripped me up, but after a half hour or so of poking around this was all I had to show for it:</p>

<div class="block-img image-holder-1up">
<canvas id="ctx" width="200" height="100"></canvas>
<script>
function fill(){

	var canvas=document.getElementById('ctx');
	if (!canvas.getContext) return;
	var c=canvas.getContext('2d');

	c.fillStyle="#4a6481";	
	c.beginPath();
	c.moveTo(62.58, 31.96);
	c.bezierCurveTo(-0.711,0, -1.811,0.062, -3.181,0.165);
	c.bezierCurveTo(-0.566,-6.309,-5.862,-11.255,-12.318,-11.255);
	c.bezierCurveTo(-2.363,0,-4.564,0.675,-6.442,1.824);
	c.bezierCurveTo(-2.888,-2.688,-6.748,-4.344,-11.003,-4.344);
	c.bezierCurveTo(-8.934,0,-16.174,7.241,-16.174,16.175);
	c.bezierCurveTo(0,0.797,0.077,1.573,0.188,2.339);
	c.bezierCurveTo(7.187,37.298, 2.075, 42.663, 2.075, 49.236);
	c.bezierCurveTo(0, 6.855, 5.558, 12.413, 12.413, 12.413);
	c.bezierCurveTo(5.761, 0, 41.874, 0, 48.092, 0);
	c.bezierCurveTo(8.197, 0, 14.844 -6.646, 14.844 -14.846);
	c.bezierCurveTo(77.424, 38.607, 70.777, 31.96, 62.58, 31.96);
	c.closePath();
	c.fill();
}

fill();
</script>
</div>


<p>Still, even if I'd have managed to get it right, I'd rather not have to manually massage my SVG output every time I want a new Canvas drawing. Which leads me to method #2.</p>

<h3>2) Automatically</h3>

<p>One of the main reasons I bothered to attempt a manual conversion in the first place was because after an extensive search it appeared that people are mostly interested in converting <a href="http://code.google.com/p/canvas-svg/">Canvas to SVG</a>. There are very few articles and tools that cover going the other way, which is what we're after. Maybe I didn't come up with exactly the right search term, but I was finding so little I almost gave up entirely.</p>

<p>Then after one last shot in the dark, I managed to stumble across <a href="http://code.google.com/p/lindenb/wiki/SVGToCanvas">SVGToCanvas</a>, a Java library that promised to do exactly what it sounds like, with a few disclaimers and a major caveat:</p>

<ul>
	<li><strong>You need Java 6.</strong> Otherwise known as 1.6, this comes installed with Mac OS X Snow Leopard but previous versions will need to upgrade. I believe <a href="http://support.apple.com/downloads/Java_for_Mac_OS_X_10_5_Update_1">this</a> is the download necessary for Leopard, if you're on an even older version you're on your own. No idea what the Windows situation is, but <a href="http://www.java.com/en/download/index.jsp">this might be a good place to start</a>.</li>
	
	<li><strong>You need to run it on the command line.</strong> I know this will freak out some designers, but really, it's not terribly difficult.</li>
	
	<li><strong>You mainly get outlines for now.</strong> This would be the big ugly caveat. Sometimes you get colour and gradients, sometimes you get mixed-up colour and gradients, mostly you don't. Plan to re-add them manually. Hopefully this will work better in a future version of the library, but still, having outlines is a solid start.</li>
</ul>

<p>Still with me? Great, go grab the JAR file and drop it on your hard drive somewhere easy to find. For now, probably best to drop it in the same folder with the SVG files you're going to convert.</p>

<p>Now, load up the terminal, and find your way to the same directory. Here's a <a href="http://www.ee.surrey.ac.uk/Teaching/Unix/unix1.html">quick command line primer</a> that ought to get you going. The <code>cd</code>, <code>ls</code>, and <code>pwd</code> commands in particular are the ones you need.</p>

<p>(If you need a bit more help than that: put the SVG and JAR files in a folder on your Desktop called 'canvas'. When you open up the terminal, type this minus quotes: '<kbd>cd ~/Desktop/canvas</kbd>'. Hit return. You're good, keep reading.)</p>

<p>Run the converter with the following command:</p>

<pre><kbd>  java -jar svg2canvas.jar -o cloud.html cloud.svg</kbd></pre>

<p>From left to right: we're invoking Java with the SVGToCanvas library, then by <kbd>-o cloud.html</kbd> we're specifying the output will be written to <kbd>cloud.html</kbd>, otherwise it just displays the output in the terminal (which can be handy if you'd like to just copy and paste without managing temporary files). Then finally at the end, <kbd>cloud.svg</kbd> is the input SVG file that we had previously generated from Illustrator.</p>

<p>That generates an HTML file which contains a <code>canvas</code> element and the Javascript necessary to render the cloud:</p>


<div class="block-img image-holder-1up">
<canvas id='ctx1263521617450' width='200' height='200'></canvas>
<script>/* generated with svg2canvas by Pierre Lindenbaum http://plindenbaum.blogspot.com plindenbaum@yahoo.fr */function paint1263521617450(){var canvas=document.getElementById('ctx1263521617450');if (!canvas.getContext) return;var c=canvas.getContext('2d');c.fillStyle="white";c.strokeStyle="black";c.globalAlpha="1.0";c.lineWidth="1";c.lineCap="butt";c.lineJoin="round";c.mitterLimit="1";c.fillStyle="#496480";c.beginPath();c.moveTo(156.85,80.25);c.bezierCurveTo(155.10,80.25,152.43,80.39,149.04,80.64);c.bezierCurveTo(147.65,65.14,134.63,52.99,118.77,52.99);c.bezierCurveTo(112.97,52.99,107.55,54.62,102.94,57.43);c.bezierCurveTo(95.85,50.84,86.35,46.80,75.90,46.80);c.bezierCurveTo(53.95,46.80,36.15,64.60,36.15,86.55);c.bezierCurveTo(36.15,88.49,36.30,90.40,36.57,92.27);c.bezierCurveTo(20.71,93.35,8.17,106.56,8.17,122.70);c.bezierCurveTo(8.17,139.54,21.83,153.20,38.68,153.20);c.bezierCurveTo(52.83,153.20,141.57,153.20,156.85,153.20);c.bezierCurveTo(177.00,153.20,193.33,136.87,193.33,116.72);c.bezierCurveTo(193.33,96.58,176.99,80.25,156.85,80.25);c.closePath();c.moveTo(102.02,87.16);c.bezierCurveTo(102.02,84.18,104.43,81.77,107.41,81.77);c.lineTo(108.18,81.77);c.bezierCurveTo(111.16,81.77,113.57,84.18,113.57,87.16);c.lineTo(113.57,100.55);c.bezierCurveTo(113.57,103.53,111.16,105.94,108.18,105.94);c.lineTo(107.41,105.94);c.bezierCurveTo(104.43,105.94,102.02,103.53,102.02,100.55);c.lineTo(102.02,87.16);c.closePath();c.moveTo(76.78,87.16);c.bezierCurveTo(76.78,84.18,79.19,81.77,82.17,81.77);c.lineTo(82.94,81.77);c.bezierCurveTo(85.92,81.77,88.33,84.18,88.33,87.16);c.lineTo(88.33,100.55);c.bezierCurveTo(88.33,103.53,85.92,105.94,82.94,105.94);c.lineTo(82.17,105.94);c.bezierCurveTo(79.19,105.94,76.78,103.53,76.78,100.55);c.lineTo(76.78,87.16);c.closePath();c.moveTo(126.80,120.33);c.bezierCurveTo(123.12,129.11,110.68,135.02,95.83,135.02);c.bezierCurveTo(95.83,135.02,68.54,129.11,64.87,120.33);c.bezierCurveTo(63.97,118.17,64.98,115.70,67.13,114.80);c.bezierCurveTo(69.29,113.90,71.76,114.91,72.66,117.07);c.bezierCurveTo(74.59,121.67,83.36,126.57,95.83,126.57);c.bezierCurveTo(108.30,126.57,117.08,121.67,119.00,117.07);c.bezierCurveTo(119.90,114.92,122.38,113.90,124.53,114.80);c.bezierCurveTo(126.68,115.70,127.70,118.17,126.80,120.33);c.closePath();c.fill();c.stroke();}paint1263521617450();</script>
</div>


<p>In this case it worked, though it added a stroke. When it's just the outline, you can restore the colour by manually tweaking the code. Add a <code>fillStyle</code> method before the draw, and a <code>fill</code> after:</p>

<pre><code class="javascript">  ctx.fillStyle(#4a6481);

  ... (drawing commands here) ..

  ctx.fill();
</code></pre>

<p>Not too difficult for simple shapes. I'd hate to have to manually re-add the subtle gradients for more complicated illustrations, but it's nice to know the outline conversion is fairly robust:</p>


<div class="block-img image-holder-2up">
	<iframe src="http://www.mezzoblue.com/articles/supplements/2010/01/globe.svg" width="240" height="210"></iframe>
	<iframe src="http://www.mezzoblue.com/articles/supplements/2010/01/globe.html" width="240" height="210"></iframe>
	<p class="caption"><span class="caption-title">Figure:</span> SVG original on the left, the converted Canvas version on the right.</p>
</div>


<p>One more thing: I'd recommend flattening the vector art as much as possible. Join shapes that can be joined, expand effects and compound paths and masks, and generally clean up the artwork to as few points as possible. Smaller file sizes, more chance of success upon conversion.</p>

<p>So there you go. It's still a fairly painful way to get your vector work into a <code>canvas</code>, but until we get some better tools or built-in support for our existing tools, it's one way to fill the gap.</p>]]>
      
   </content>
</entry>

<entry>
   <title>Older Than...</title>
   <link rel="alternate" type="text/html" href="http://mezzoblue.com/archives/2010/01/12/older_than/" />
   <id>tag:mezzoblue.com,2010://2.1449</id>
   
   <published>2010-01-13T05:36:19Z</published>
   <updated>2010-03-05T21:09:26Z</updated>
   
   <summary>For no particular reason, I present to you a list of things that were true on August 27, 2001: The iPod, XBox, YouTube, Facebook, Flickr, Ubuntu, and Blu-Ray did not exist. IBM was still in the PC business, Handspring was...</summary>
   <content type="html" xml:lang="en" xml:base="http://mezzoblue.com/">
      <![CDATA[<p>For no particular reason, I present to you a list of things that were true on <a href="http://en.wikipedia.org/wiki/Internet_Explorer#Internet_Explorer_6">August 27, 2001</a>:</p>

<ul>

<li>The iPod, XBox, YouTube, Facebook, Flickr, Ubuntu, and Blu-Ray did not exist.</li>

<li>IBM was still in the PC business, Handspring was still around, and Blackberries were data-only devices with no telephone capabilities.</li>

<li>The Euro had not yet entered circulation, currencies like the Franc, Mark and Lira were still legal tender.</li>

<li>George Harrison, The Queen Mother, Gregory Peck, Barry White, Johnny Cash, Ronald Reagan, Ray Charles, Julia Child, Pope John Paul II, Johnny Carson, Steve Irwin, Gerald Ford and Michael Jackson were still alive.</li>

<li>SARS, Avian Flu, H1N1 were not in the common vernacular.</li>

<li>Enron and WorldCom were still in business.</li>

<li>Oil was $24/barrel, gold was $276/ounce, NASDAQ was at 1912.41, and the DOW was at 10,382.35.</li>

<li>The Concorde still flew.</li>

<li>The Petronas Towers were the tallest skyscrapers in the world. (They've been surpassed <a href="http://www.dailyworldbuzz.com/burj-dubai-dubai-tower-to-open-on-january-2010/4998/">twice</a> since.)</li>

<li>Lost and 24 had never aired, there were only four books in the Harry Potter series, and Arnold Schwarzenegger was still making movies.</li>

<li>Lance Armstrong had only won the Tour de France 3 times. (He went on to win 4 more.)</li>

<li>The most recent Boston Red Sox World Series win had been 1918 (which remained true until 2004).</li>

<li>The Netherlands was the only country in the world that legally recognized same sex marriages. (That stands at 7 now).</li>

<li>Charley, Ivan, Jeanne, Katrina, Dean, and Ike were not names associated with weather.</li>

<li>61 Extrasolar planets had been discovered. (Currently that's up to 424).</li>

<li>Pioneer 10 signals were still being received on Earth.</li>

</ul>]]>
      
   </content>
</entry>

<entry>
   <title>Dear Adobe</title>
   <link rel="alternate" type="text/html" href="http://mezzoblue.com/archives/2010/01/08/dear_adobe/" />
   <id>tag:mezzoblue.com,2010://2.1448</id>
   
   <published>2010-01-08T20:50:02Z</published>
   <updated>2010-03-09T20:09:00Z</updated>
   
   <summary>In the spirit of Dear Adobe, I submit the following two minute Photoshop gripe: As a sanity-check before posting I put this video out on Twitter, and received the following tidbits: The lack of ability to paste a hex value...</summary>
   <content type="html" xml:lang="en" xml:base="http://mezzoblue.com/">
      <![CDATA[<p>In the spirit of <a href="http://dearadobe.com/">Dear Adobe</a>, I submit the following two minute Photoshop gripe:</p>

<div class="flvPlayer">
<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" width="476" height="312">
<param name="movie" value="https://media.dreamhost.com/mediaplayer.swf?file=http://mezzoblue.com/articles/supplements/2010/01/ps-color-picker.mov&amp;autoStart=false;" />
<param name="quality" value="high" />
<param name="wmode" value="transparent" />
<embed src="https://media.dreamhost.com/mediaplayer.swf?file=http://mezzoblue.com/articles/supplements/2010/01/ps-color-picker.mov&amp;autoStart=false;" quality="high" wmode="transparent" width="476" height="312" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />
</object>
</div>

<p>As a sanity-check before posting I put this video out on Twitter, and received the following tidbits:</p>

<ul>
<li>The lack of ability to paste a hex value appears to be a Mac-only bug, in Windows it works. (Thanks <a href="http://twitter.com/cloudislands">@cloudislands</a>, <a href="http://twitter.com/friskdesign">@friskdesign</a>)</li>
<li>Within the Save for Web &amp; Devices dialog, if you use the eyedropper tool on the left to select a colour within the canvas, and then hit the Matte colour dropdown menu arrows and select Eyedropper Color, that works. (Thanks <a href="http://twitter.com/kyleridolfo">@kyleridolfo</a>, <a href="http://twitter.com/Yardboy">@Yardboy</a>, <a href="http://twitter.com/bradleysepos">@bradleysepos</a></li>
</ul>]]>
      
   </content>
</entry>

<entry>
   <title>Isolation</title>
   <link rel="alternate" type="text/html" href="http://mezzoblue.com/archives/2009/11/05/isolation/" />
   <id>tag:mezzoblue.com,2009://2.1447</id>
   
   <published>2009-11-06T01:57:21Z</published>
   <updated>2010-03-03T01:22:58Z</updated>
   
   <summary>You probably experience this on a regular basis: a client sends you an illustration or a logo they&apos;d like to use in a project, but it&apos;s a low-res bitmap or a flat image file with a background texture. Or both,...</summary>
   <content type="html" xml:lang="en" xml:base="http://mezzoblue.com/">
      <![CDATA[<p>You probably experience this on a regular basis: a client sends you an illustration or a logo they'd like to use in a project, but it's a low-res bitmap or a flat image file with a background texture. Or both, if you're really lucky. Sure, you can try and ask for a vector version, but more often than not what they originally sent was the best copy they had on hand.</p>

<p>I seem to have made something of a hobby out of trying to coax useful results out of this type of file. Over the years I've stumbled across far better ways of doing it than manually clipping the background with the the magic wand or various selection tools.</p>

<p>For the next time you're handed a less-than-ideal source image, here are a few of my tricks for isolating the part of the file I want to work with in Photoshop.</p>

<div class="block-img image-holder-1up">
<img src="http://www.mezzoblue.com/i/articles/2009/nov/text-start.jpg" width="266" height="309" alt="Firefox source image" />
</div>

<p>I'll use this Firefox promo image as an example. Yeah, I know I can find a vector version of this particular logo online, but it makes for a fairly good demo thanks to the complexity of the background.</p>

<p>Let's start with the text. A single, flat colour ends up being fairly easy to extract. The first step is using the Hue/Saturation sliders [<kbd>Ctrl</kbd> / <kbd>Cmd</kbd> + <kbd>U</kbd>] to drop the saturation all the way down to a value of -100:</p>

<div class="block-img image-holder-1up">
<img src="http://www.mezzoblue.com/i/articles/2009/nov/text-step1.jpg" width="266" height="309" alt="Converted to greyscale" />
</div>

<p>Then trim away the surrounding pixels to focus on the area you want:</p>

<div class="block-img image-holder-1up">
<img src="http://www.mezzoblue.com/i/articles/2009/nov/text-step2.jpg" width="173" height="45" alt="Cropped to text" />
</div>

<p>Next use the levels sliders [<kbd>Ctrl</kbd> / <kbd>Cmd</kbd> + <kbd>L</kbd>] to increase the contrast on either side so that the background is black and the text is white. The trick is doing it in a way that doesn't completely kill the anti-aliasing between the text and the background, while at the same time making sure the foreground/background colours are pure black and white. You don't want stray pixels on either side, otherwise nasty things will happen later on when you try using your results. If you just can't find a balance, use the brush tool to fill in the strays manually.</p>

<p>The best results come from images where the text is clearly a different shade than the background behind it. In this case it is, so I'm able to get a reasonably high-contrast result:</p>

<div class="block-img image-holder-1up">
<img src="http://www.mezzoblue.com/i/articles/2009/nov/text-step3.jpg" width="173" height="45" alt="Higher contrast" />
</div>

<p>At this point you have two choices. If you don't need the ability to change the colour of the text or apply layer effects, you can stop now and set the layer's blending mode to Screen or invert it (<kbd>Ctrl</kbd> / <kbd>Cmd</kbd> + <kbd>I</kbd>) and set the mode to Multiply. With the either of those blend modes you should be able to place this high-contrast layer over top of a background and it'll be treated as isolated text. The key being placing it on top of non-transparent background; if there are no pixels beneath for the layer to blend with, you won't be able to save it out the same way it renders in Photoshop.</p>

<p>For that extra control you need to take it further. By holding down <kbd>Ctrl</kbd> / <kbd>Cmd</kbd> and clicking on the image's layer in the Layers palette you can select just the outline; copy that to the clipboard, open the Channels palette, create a new Channel, and then paste the clipboard into that channel. If you've done it right it should look something like this:</p>

<div class="block-img image-holder-1up">
<img src="http://www.mezzoblue.com/i/articles/2009/nov/text-step4.png" width="536" height="375" alt="Channels palette, selection with marching ants" />
<p class="caption"><span class="caption-title">Figure:</span> Ctrl/Cmd + clicking on the channel produces selection marching ants in the preview. You can't see the animation, but they're there.</p>
</div>

<p>The same way you selected the outline of the image in the Layers palette, you can <kbd>Ctrl</kbd> / <kbd>Cmd</kbd> + click in the Channels palette and the selection will change to just the border between the background and foreground. If you switch back to the Layers palette and create a new Solid Color fill layer:</p>

<div class="block-img image-holder-1up">
<img src="http://www.mezzoblue.com/i/articles/2009/nov/text-step5.gif" width="219" height="376" alt="Creating solid colour layer" />
</div>

<p>The text now sits on an isolated layer that allows you to easily change the colour, apply layer effects, etc.</p>

<div class="block-img image-holder-1up">
<img src="http://www.mezzoblue.com/i/articles/2009/nov/text-step6.png" width="173" height="45" alt="Text with effects" />
</div>

<p>The icon is more complicated. We've got a strong orange foreground, but the globe and the background share some tones so extracting is going to be trickier. This is a fairly common scenario in the wild, but the good news is that it's still doable in most cases.</p>

<p>Let's be a little more selective about what we're trying extract this time. Start by focusing on the orange fox for now, we'll come back for the globe. The Select &gt; Color Range tool allows you to click an area and select all colours similar to that selection point, and the Fuzziness slider controls how loosely or tightly the selection matches that colour. Selecting the blue area instead of the orange produces a much higher-contrast outline of the orange area:</p>

<div class="block-img image-holder-1up">
<img src="http://www.mezzoblue.com/i/articles/2009/nov/icon-step1.gif" width="417" height="421" alt="Color range selection dialog" />
</div>

<p>Once you hit okay you're left with marching ants. The selection isn't useful yet, so back to the Channels palette we go. Create a new alpha channel and fill the selection with white:</p>

<div class="block-img image-holder-1up">
<img src="http://www.mezzoblue.com/i/articles/2009/nov/icon-step2.jpg" width="266" height="309" alt="Alpha channel with selection" />
</div>

<p>Now you can just pull up the Levels palette and, with the same high-contrast result in mind as the previous text example, adjust the levels until the fox is pure black and the background is as pure white as you can make it:</p>

<div class="block-img image-holder-1up">
<img src="http://www.mezzoblue.com/i/articles/2009/nov/icon-step3.jpg" width="265" height="257" alt="Higher contrast" />
</div>

<p>If you hit <kbd>Ctrl</kbd> / <kbd>Cmd</kbd> + click on the channel then head back to the Layers palette and select the original, you can click the Add Layer Mask button in the bottom of the palette and have the selection mask the image to just the orange areas we've managed to extract:</p>

<div class="block-img image-holder-1up">
<img src="http://www.mezzoblue.com/i/articles/2009/nov/icon-step4.png" width="265" height="257" alt="Isolated fox" />
</div>

<p>If you end up with too many fringe pixels from the background, you can hit <kbd>Ctrl</kbd> / <kbd>Cmd</kbd> + select the mask again, and use the Select &gt; Modify &gt; Contract tool to decrease the selection 1px on all sides. Invert this smaller selection with <kbd>Ctrl</kbd> / <kbd>Cmd</kbd> + <kbd>Shift</kbd> + <kbd>I</kbd>, then select and fill with black the layer mask to apply it. This will eat up a one pixel outline around the object, which should take care of the fringe without tossing out too much image data. Though it does depend on the size of the source image.</p>

<p>We now want to add the globe back in, so duplicate the layer and remove the mask to show the original image again. Manually trace the outline of the globe with the circular marquee tool, select the masked layer and fill that selection with white within the mask. And there we go, an isolated version of the Firefox icon that you can manipulate as you please:</p>

<div class="block-img image-holder-1up">
<img src="http://www.mezzoblue.com/i/articles/2009/nov/icon-step5.jpg" width="265" height="257" alt="Final isolated icon" />
</div>

<p>Extraction this way seems like a lot of work, but once you get the hang of it you'll find it's fairly quick work to go from a source image to something usable.</p>

<p>For relatively simple jobs like the text, the process is straightforward and can be done in a couple of seconds. For more complicated extraction as in the case of the icon, creative alpha masking combined with a bit of manual tweaking will usually get the job done.</p>

<p>(And I don't have to remind you to always use this for good and never for evil, do I?)</p>]]>
      
   </content>
</entry>

<entry>
   <title>WEFT-less</title>
   <link rel="alternate" type="text/html" href="http://mezzoblue.com/archives/2009/10/21/weft-less/" />
   <id>tag:mezzoblue.com,2009://2.1446</id>
   
   <published>2009-10-21T18:50:08Z</published>
   <updated>2010-03-09T20:09:04Z</updated>
   
   <summary>Last we left off, I&apos;d just started going down the road of playing with @font-face, sans IE. This is the follow-up where we bring Internet Explorer back into the equation and look at the hoops we need to jump through...</summary>
   <content type="html" xml:lang="en" xml:base="http://mezzoblue.com/">
      <![CDATA[<p><a href="http://mezzoblue.com/archives/2009/10/05/starting_wit/">Last we left off</a>, I'd just started going down the road of playing with <code>@font-face</code>, sans IE. This is the follow-up where we bring Internet Explorer back into the equation and look at the hoops we need to jump through to bring it in line.</p>

<p>A quick refresher: following a different path than every other browser out there, IE requires a custom-created, rights-managed font file called EOT (Embedded OpenType). The syntax to safely serve up an EOT to IE was shown in that <a href="http://mezzoblue.com/archives/2009/10/05/starting_wit/">previously-mentioned post</a>. What we're covering here is, how in the world do you create an EOT file in the first place?</p>

<p>Well, there's WEFT, Microsoft's one and only tool for creating EOT files. Let's try WEFT, shall we? Go to Microsoft's site for <a href="http://www.microsoft.com/typography/web/embedding/weft3/download.aspx">WEFT</a> and hit the download link. Wait, what's this business about Internet Explorer 4 and Windows 98? Uh-oh.</p>

<p>The most recent WEFT point release was in 2003, but if you look at the screenshots on <a href="http://www.microsoft.com/typography/web/embedding/weft3/tutorial.aspx">the tutorial for the most recent major version</a>, you might be able to guess what sort of an experience you're in for.</p>

<div class="block-img image-holder-1up">
<img src="http://www.mezzoblue.com/i/articles/2009/oct/weft-ie.gif" width="337" height="133" alt="IE, version x.old" />
<p class="caption"><span class="caption-title">Figure:</span> This is the era of browser WEFT was built during. Is that IE2? IE3? It's been so long I can't remember.</p>
</div>

<p>Obviously it's Windows-only. I grabbed a copy and tried it in Windows XP under Parallels. That went well:</p>

<div class="block-img image-holder-1up">
<img src="http://www.mezzoblue.com/i/articles/2009/oct/weft-broken.jpg" width="400" height="400" alt="WEFT in all its glory" />
<p class="caption"><span class="caption-title">Figure:</span> No WEFT for you. And Windows apps with images as toolbar backgrounds? So Win95.</p>
</div>

<p>I've booted multiple virtual installations of Windows XP under Parallels, but that's the oldest version of Windows I have on hand (what a ridiculous phrase to type) and it simply doesn't want to run.</p>

<p>I have managed to use WEFT in the past. Back in the late part of the 90's when it was still somewhat fresh, I distinctly remember grabbing a copy and converting some fonts to EOT. I also remember the GUI being a confusing pile of hurt, and the process being anything but transparent.</p>

<p>Essentially, you need to point WEFT at the page you're trying to embed the fonts in, so a) it can create domain-specific hooks and only run on that site (good luck getting the EOT working locally or on a staging server), and b) so it can subset the character set to only the glyphs you're actually using. The former is an overly-restrictive attempt at DRM. The latter is actually useful for controlling file sizes, aside from the total lack of manual control.</p>

<p>Microsoft mentions on the download page that some people report it working in virtualized Windows under OS X, and I have heard independent reports of it working for other people. But I've also heard I'm not the only one in the not-working camp. I guess if you get it working, consider yourself lucky in a pyrrhic sort of way.</p>

<p>But anyway, forget WEFT. Microsoft has clearly long given up on it. Abandonware isn't going to solve today's modern web design problems, what else have we got?</p>

<p>Searching that problem turned up Edward O'Connor's post from a few months back about his experience <a href="http://edward.oconnor.cx/2009/07/how-to-create-eot-files-without-microsoft-weft">installing command line tools that will ultimately generate EOT files</a>.</p>

<p>At this point I'm going to cut a very long story short and say that, despite being fairly comfortable hacking around a Terminal window and installing remote packages and the like, I wasted almost a day doing this with nothing to show for it. I suspect there's nothing wrong with Edward's methods, but some OTF files seem to complicate things in a way it simply doesn't account for. Others reportedly work; the ones I tried didn't.</p>

<p>(As an aside: there are a few web-based tools out there that do similar without the command line hackery. <a href="http://www.kirsle.net/wizards/ttf2eot.cgi">TTF 2 EOT</a> does what its name suggests, and there's a tool called Online Font Converter that supposedly converts OTF files to TTF and a few other formats. I'm not linking to that one because I'm a little suspicious of the site (AdSense-heavy, and the zip files it produced wouldn't open for me), but if you really want to find it just search for the capitalized title in the last sentence. But you're probably better of using FontSquirrel anyway, mentioned below.)</p>

<p>(As a second aside, you might be luckier than I was. You might be able to use any of these tools to go from OTF to EOT and wonder what in the world I'm talking about. Given that I'm definitely not the only one who had this problem, it seems likely that sooner or later you might run into a font that just doesn't want to convert. When that happens, keep reading.)</p>

<p>After spending that time hacking around in the Terminal I was ready to give up on the entire process of WEFT-less EOT files, and then Jonathan Snook happened to mention he had a method. A bit of dialogue resulted in my prodding him into doing a screencast, and voila:</p>

<p><a href="http://snook.ca/archives/html_and_css/screencast-converting-ttf2eot">Converting OTF or TTF to EOT</a></p>

<p>The really important bit here, the part that I couldn't get right before, is the manual adjustment in FontForge. The automated tools mentioned above in the OTF &rsaquo; EOT conversion chain don't account for the namerecord tweaking that seems essential to get an EOT rendering in Internet Explorer. I had previously installed a tool that <a href="http://karoshiethos.com/2009/08/05/creating-eot-files-with-ttf2eot/">converted TTF files into XML</a> so I could pull off the namerecord change in text. No such luck. FontForge's awful XWindows GUI tool was the only thing that worked for me. No really, it's <strong>ugly</strong>; the UI is even worse than WEFT. But it happens to work, which is its saving grace.</p>

<div class="block-img image-holder-1up">
<img src="http://www.mezzoblue.com/i/articles/2009/oct/fontforge.gif" width="400" height="275" alt="FontForge" />
<p class="caption"><span class="caption-title">Figure:</span> FontForge in all its glory.</p>
</div>


<p>Also, between the time I started writing this post and now, <a href="http://www.fontsquirrel.com/fontface/generator">FontSquirrel released a @font-face generator</a> that appears to automate the whole process. I haven't had a chance to test yet, so it's unclear to me whether it fixes the namerecord problems or not. If so, great, but one reason to still consider using FontForge is its ability to manually delete glyph records. Being able to drop Greek characters, accents and diacritics, ligatures, and other glyphs that aren't typically used on an English-speaking site is handy when you have 100k+ OTF files that you'd like to embed.</p>


<p>Finally, a couple of related links I've found interesting:</p>

<ul>
<li><a href="http://snook.ca/archives/html_and_css/becoming-a-font-embedding-master">Becoming a Font Embedding Master</a>, also from Jonathan Snook</li>
<li><a href="http://nicewebtype.com/notes/2009/10/20/where-to-get-web-fonts/">Where to Get Web Fonts</a> from Tim Brown at Nice Web Type</li>
<li><a href="http://www.typotheque.com/webfonts">Typotheque</a>, a foundry that explicitly allows web licensing of their catalogue, hosts them, and offers a really interesting pricing model. Worth a look.</li>
</ul>]]>
      
   </content>
</entry>

<entry>
   <title>Starting with @font-face</title>
   <link rel="alternate" type="text/html" href="http://mezzoblue.com/archives/2009/10/05/starting_wit/" />
   <id>tag:mezzoblue.com,2009://2.1445</id>
   
   <published>2009-10-06T04:07:56Z</published>
   <updated>2010-03-19T18:00:32Z</updated>
   
   <summary>I&apos;ve been using Cufón off and on since writing about font embedding back in May. It&apos;s a great hack, but browser progress since that time has been making me feel that the native CSS @font-face rule is becoming increasingly viable....</summary>
   <content type="html" xml:lang="en" xml:base="http://mezzoblue.com/">
      <![CDATA[<p>I've been using Cufón off and on since writing about <a href="http://mezzoblue.com/archives/2009/05/07/font_embeddi/">font embedding</a> back in May. It's a great hack, but browser progress since that time has been making me feel that the <a href="http://www.w3.org/TR/css3-fonts/#the-font-face-rule">native CSS</a> <code>@font-face</code> rule is becoming increasingly viable. Or, at least enough so that it seems like it's time to start dabbling.</p>

<p>Yes, I know of <a href="http://typekit.com/">TypeKit</a>. It's a great idea and there are some solid reasons to consider using it. But I'm still interested in using the native technology from time to time, which is where we begin.</p>

<p>Ignoring the <a href="http://cindyli.com/site/comments/font_embedding_and_licensing/">licensing issues</a> for now, the problems are those of syntax and technology. Syntax because Internet Explorer requires you to import a different file than every other browser. Technology because, well, Internet Explorer requires you to import a different file than every other browser.</p>

<p>If you just forget about IE for a minute then <code>@font-face</code> is surprisingly easy to use. Getting started requires a couple of lines of CSS and the right file in the right place. You can have a custom typeface imported into your page with just a little more work than applying a custom background image. Start with the <code>@font-face</code> declaration itself:</p>

<pre><code class="css">@font-face {
  font-family: 'Museo Sans';
  src: local('Museo Sans 500'), local('Museo Sans'), 
         url(MuseoSans_500.otf) format('opentype');
}</code></pre>

<p>What this is saying is: "hey browser, here's a font family called 'Museo Sans'. When you see reference to this font in the stylesheet please check whether the font exists on the user's local computer. If it doesn't then here's a file in OpenType format that you can use instead." I've specified two different faces for the local computer, both the generic family name (Museo Sans) and the specific weight I'd like to use (Museo Sans 500). This may not be strictly required depending on the typeface, but can't a bad idea.</p>

<p>Once you've defined the font-family all you have to do is reference it on elements you'd like to be rendered with it:</p>

<pre><code class="css">h1 {
	font-family: "Museo Sans", Arial, sans-serif;
}</code></pre>

<p>That's it, really. Firefox, Safari, Opera? The latest versions of these browsers all work like a charm.</p>

<p>It's when you remember that IE won't do anything with this that you start running into problems. Luckily, Paul Irish uncovered the magic voodoo incantation that selectively serves the right file to the right browser. The syntax is only marginally more complicated:</p>

<pre><code class="css">@font-face {
  font-family: 'Museo Sans';
  src: url(MuseoSans_500.eot);
  src: local('Museo Sans 500'), local('Museo Sans'), 
         url(MuseoSans_500.otf) format('opentype');
}</code></pre>

<p>I'll leave the explanation of why that particular rule order is important to <a href="http://paulirish.com/2009/bulletproof-font-face-implementation-syntax/">Paul's article</a>, but suffice it to say this is the syntax you should be using. (Also related, Paul's <a href="http://paulirish.com/type/">Rich Typography presentation</a> is worth spending some time flipping through.)</p>

<p>So that's the syntax part of the equation solved. But remember we also have a technological problem; IE doesn't do anything useful with OTF or TTF files. It requires a converted, proprietary (<a href="http://www.w3.org/Submission/EOT/">though proposed-to-be-open</a>) format called EOT. If you have a TTF or OTF file, how do you convert it to EOT?</p>

<p>More on this in a follow-up post in the near future. I'll spoil the punchline right now: the official tool for doing so is a horrible piece of abandonware that might work if you get lucky (I didn't). The alternatives are largely arcane command line tools that, apparently, work for some (not me).</p>

<p>However, there is a way. It ain't pretty. But it has the advantage of actually working.</p>]]>
      
   </content>
</entry>

<entry>
   <title>Updates</title>
   <link rel="alternate" type="text/html" href="http://mezzoblue.com/archives/2009/08/19/updates/" />
   <id>tag:mezzoblue.com,2009://2.1444</id>
   
   <published>2009-08-19T19:10:00Z</published>
   <updated>2009-08-19T19:38:32Z</updated>
   
   <summary><![CDATA[While it's been a fairly quiet summer around these parts, that doesn't necessarily mean I've been slacking off. Let's run down the list. New Chalkwork Icons &amp; Search Back in June while sitting around recovering from some minor surgery, I...]]></summary>
   <content type="html" xml:lang="en" xml:base="http://mezzoblue.com/">
      <![CDATA[<p>While it's been a fairly quiet summer around these parts, that doesn't necessarily mean I've been slacking off. Let's run down the list.</p>

<h3>New Chalkwork Icons &amp; Search</h3>

<p>Back in June while sitting around recovering from some minor surgery, I spent a weekend producing a new free icon set for payments and ecommerce called, naturally, <a href="http://www.mezzoblue.com/icons/chalkwork/payments/">Chalkwork Payments</a>. It highlighted a fairly obvious deficiency in the collection, so immediately after I set to work on a much larger commerce set. Creatively named <a href="http://www.mezzoblue.com/icons/chalkwork/commerce/">Chalkwork Commerce</a> of course.</p>

<div class="block-img">
<a href="http://www.mezzoblue.com/icons/chalkwork/commerce/"><img src="http://www.mezzoblue.com/i/articles/2009/aug/chalkwork-comm.gif" width="347" height="72" alt="Chalkwork Commerce Preview" /></a>
</div>

<p>Due to the growing size of the overall icon family (2500+ now), I decided a better way to find a specific icon was in order. So with a bit of PHP and metadata-creation elbow grease, I put together what I think is a fairly robust <a href="http://www.mezzoblue.com/icons/matcher/">search tool</a> that matches actions, metaphors, shapes, and colours.</p>

<p>Start with the fact that searching an image for context still isn't something computers are good at. Then factor in the subjective nature of what an icon stands for, and the way one image often means multiple things. I didn't really see a shortcut for doing the matching; it had to be a manual tagging job. I built a 110k index file that tags each icon in a dozen or so different ways. Here's one example:</p>


<div style="overflow: hidden; width: 100%; margin-bottom: 20px;">
<div style="float: left; width: 198px;">
<img src="http://mezzoblue.com/i/articles/2009/aug/chalkwork-matcher.gif" width="178" height="149" alt="Sample IconMatcher result" />
</div>
<div style="float: left; width: 302px; padding-top: 30px;">
<strong>Shipping (Ground)</strong> &#8211; <a href="http://www.mezzoblue.com/icons/matcher/index.php?q=action">action</a>, <a href="http://www.mezzoblue.com/icons/matcher/index.php?q=ship">ship</a>, <a href="http://www.mezzoblue.com/icons/matcher/index.php?q=shipping">shipping</a>, <a href="http://www.mezzoblue.com/icons/matcher/index.php?q=shipment">shipment</a>, <a href="http://www.mezzoblue.com/icons/matcher/index.php?q=shipped">shipped</a>, <a href="http://www.mezzoblue.com/icons/matcher/index.php?q=deliver">deliver</a>, <a href="http://www.mezzoblue.com/icons/matcher/index.php?q=delivery">delivery</a>, <a href="http://www.mezzoblue.com/icons/matcher/index.php?q=ground">ground</a>, <a href="http://www.mezzoblue.com/icons/matcher/index.php?q=truck">truck</a>, <a href="http://www.mezzoblue.com/icons/matcher/index.php?q=vehicle">vehicle</a>, <a href="http://www.mezzoblue.com/icons/matcher/index.php?q=automobile">automobile</a>, <a href="http://www.mezzoblue.com/icons/matcher/index.php?q=lorry">lorry</a>, <a href="http://www.mezzoblue.com/icons/matcher/index.php?q=lorries">lorries</a>, <a href="http://www.mezzoblue.com/icons/matcher/index.php?q=cargo">cargo</a>, <a href="wheel">wheel</a>, <a href="http://www.mezzoblue.com/icons/matcher/index.php?q=tire">tire</a>, <a href="http://www.mezzoblue.com/icons/matcher/index.php?q=tyre">tyre</a>, <a href="http://www.mezzoblue.com/icons/matcher/index.php?q=white">white</a>, <a href="http://www.mezzoblue.com/icons/matcher/index.php?q=red">red</a>
</div>
</div>

<p style="clear: left;">Hey, when you're off your feet recovering, you have a lot of time on your hands. I can't imagine I've covered every possible search, but that's good enough for now.</p>

<p>The funny thing is that I built this mainly as a sales tool, a way of saying look, I've got an icon that matches what you need even if it isn't labelled that way. But after launch it was pointed out it's also quite useful for people who have bought the icons, as a way of making those same connections since you probably don't have the entire list of what you've bought fresh in mind. Seems obvious in hindsight, but it was nice to have the work pay off in more than one way.</p>

<h3>Processing</h3>

<p>Back in June I sat in on a <a href="http://blog.blprnt.com/workshops">full day Processing workshop</a> with local Flash and Processing wiz <a href="http://twitter.com/blprnt">Jer Thorp</a>. I've been seeing a lot of interesting work with <a href="http://infosthetics.com/">data visualization</a> happening lately, and given that the language was <a href="http://processingjs.org/">ported to Javascript</a> last year, it seemed like a language I could spend some serious time digging into.</p>

<p>The workshop was a great way to kickstart an interest. I've spent the last month or two working up a small base of sketches (as each program is named) that are helping me work through the syntax, and more importantly the mental shift from designing for 2D text and images to the very different world of designing in 3D when change over time is a factor.</p>

<div class="block-img">
<a href="http://exnihilo.mezzoblue.com/"><img src="http://mezzoblue.com/i/articles/2009/aug/processing.png" width="400" height="400" alt="Various Processing sketches" /></a>
</div>

<p>I haven't yet got to the point where I'm doing anything terribly useful with it, but that hasn't stopped me from documenting the progress on a new blog I set up to keep from cluttering this one with something decidedly un-web. Check out <a href="http://exnihilo.mezzoblue.com/">Ex Nihilo</a> if you're interested in following along.</p>


<h3>WallBlank</h3>
 
<p>You might remember a post from last year called <a href="http://www.mezzoblue.com/archives/2008/03/04/producing/">Producing</a>, where I explored some options visual web designers have for creating products, aside from web and iPhone apps that require developer help.</p>

<p>Shawn Kelley took the idea to heart, and created a site called <a href="http://wallblank.com/">WallBlank</a> that sells limited edition prints late last year. In a nice example of things coming full circle, he asked me to contribute one of the Processing sketches I've been working with. That's now <a href="http://wallblank.com/products/bokeh-array">for sale</a>, you can buy one of a limited edition of 100 unique prints called "Bokeh Array".</p>

<div class="block-img">
<a href="http://wallblank.com/products/bokeh-array"><img src="http://mezzoblue.com/i/articles/2009/aug/processing2.gif" width="420" height="110" alt="WallBlank print examples" /></a>
</div>

<p>This one was particularly fun because I figured it would be worth taking full advantage of Processing's generative abilities; each print is unique, though they share a common palette for consistency. Sounds tricky, right? <a href="http://exnihilo.mezzoblue.com/2009/08/vector-output/">Not exactly.</a> Pressing a single button and getting 100 vector PDFs as output within a minute or two is just one of the many nice things about working with such a graphics-focused language.</p>

<h3>Site Issues</h3>

<p>It's possible you noticed over the past month this site's home page came and went a few times. Don't worry, it's not going anywhere.</p>

<p>My own fault most likely, but the <a href="http://delicious.com/">Delicious</a> API has been a bit problematic for me; the <a href="http://mezzoblue.com/archives/2009/01/03/not_a_test/">scripts</a> I've been using to pull in remote data cache it, but despite an interval of a few hours between checking for new data, there seem to be some API calls leaking out during that interval that trigger throttling. Delicious has a low tolerance for that sort of thing, and every so often there just wasn't anything showing up.</p>

<p>Combine that with a lack of posts or relevant Flickr photos recently, and the Google Reader items I'm sharing not actually showing up, and the entire home page was affected for a little while.</p>

<p>The Google Reader issue was interesting; at first I thought maybe they had changed something in the <a href="http://code.google.com/p/pyrfeed/wiki/GoogleReaderAPI">totally unofficial API</a>, but then I realized that when I'd bought and started using <a href="http://agilewebsolutions.com/products/1Password">1Password</a> I'd converted all my important passwords over to 32 character strings of random nonsense and I just hadn't updated it.</p>

<p>Simple to fix, and problem solved. Now that I can arbitrarily share any item on the web in Google Reader I'll likely be relying on Delicious less anyway.</p>

<p>How am I liking 1Password, incidentally? Quite a lot. You know that nagging feeling that you really shouldn't be using the same password for every web service out there, and that back-of-your-mind worry that one compromised site could lead to a massive online identity takeover, and that you really should do something about it, but it's really just too much of a pain in the ass to bother remembering all these different passwords, and oh forget it I'll just keep using the same insecure password as always?</p>

<p>Yeah, that's gone. My passwords look like this now: t0zDIHYqam&lt;n5jCFgqGVj&amp;Y"q=dPKmvY &#8212; and every site I use has a unique one. I actually do feel safer.</p>

<h3>AEA SF</h3>

<p>And one last thing in amongst all the randomness today. Coming up in December I'm speaking in San Francisco at <a href="http://aneventapart.com/2009/sanfrancisco/">An Event Apart</a>, which will be only my second speaking date of 2009. I've slowed down quite a lot this year, but AEA was a must. It's always an honour to share a stage with a roster of people like Jonathan Snook, George Oates, Andy Budd, Jeff Veen, and Jared Spool. AEA remains one of the best conferences in the business, and I hope to bring the proverbial awesome.</p>

<p>Want to come? Want a discount? I've got you covered. Use the code <em>AEADSCSS</em> when registering for $100 off. See you there.</p>]]>
      
   </content>
</entry>

</feed>
