<?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>Some Random Dude &#187; semantics</title>
	<atom:link href="http://www.somerandomdude.com/tag/semantics/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.somerandomdude.com</link>
	<description>Some Random Dude is a blog by P.J. Onori that covers design &#38; technology in the broadest sense possible.</description>
	<lastBuildDate>Tue, 07 Feb 2012 14:37:00 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Font-Embedding Icons the Right Way&#8212;A Legitimate Alternative to Images</title>
		<link>http://www.somerandomdude.com/2012/01/31/font-embedding-icons-the-right-way/</link>
		<comments>http://www.somerandomdude.com/2012/01/31/font-embedding-icons-the-right-way/#comments</comments>
		<pubDate>Tue, 31 Jan 2012 14:00:18 +0000</pubDate>
		<dc:creator>P.J. Onori</dc:creator>
				<category><![CDATA[Design]]></category>
		<category><![CDATA[css]]></category>
		<category><![CDATA[font]]></category>
		<category><![CDATA[font-embedding]]></category>
		<category><![CDATA[html]]></category>
		<category><![CDATA[icon]]></category>
		<category><![CDATA[Iconic]]></category>
		<category><![CDATA[semantics]]></category>
		<category><![CDATA[unicode]]></category>

		<guid isPermaLink="false">http://www.somerandomdude.com/?p=11874</guid>
		<description><![CDATA[Using fonts to display icons have shown potential but carry significant downsides. A slight adjustment to the method makes it ready for primetime. ]]></description>
			<content:encoded><![CDATA[<p>When I released <a href="work/iconic">Iconic</a> in font format it got a lot of positive feedback. However, it had one significant technical issues that kept it from being practical. The glyphs in the font had no logical assignment to Unicode characters, making the output semantically unsound. A few months back, <a href="http://www.codestyle.org/">Philip Shaw</a> shared <a href="http://www.codestyle.org/css/at-font-face/StandardUnicodeIconsWebFonts.shtml">a much improved method for glyph assignment</a> which I have implemented in the current version of Iconic. I thought it would be worthwhile to share that approach so that others may adopt it and that a standard can hopefully form.<span id="more-11874"></span><br />
<style>@font-face { font-family: 'IconicStroke'; src: url('/wp-content/fonts/iconic_stroke/iconic_stroke.eot?') format('embedded-opentype'); } @font-face { font-family:'IconicStroke'; font-weight: normal; font-style: normal; src: url('/wp-content/fonts/iconic_stroke/iconic_stroke.ttf') format('truetype'); } .iconic { display:inline-block; font-family: 'IconicStroke'; } .sun_stroke:before {content:'\2600';}.mail:before {content:'\2709';}.star:before {content:'\2605';}.moon_stroke:before {content:'\263e';}.cog:before {content:'\2699';}.bolt:before {font-size:32px; vertical-align:.15em; content:'\26a1'; margin-right:.25em; color:#5d504f; text-shadow:0px 1px 1px rgba(0,0,0,.3); opacity:.8; }.dial:before {content:'\e058';} span.iconic, table.demo span { font-size:36px; line-height:1.5em; } table { width:100%; font-family:"Helvetica", Arial, sans-serif; font-size:14px; } table td.icon { text-align:center; } table th, table td { padding:10px 20px;} .bolt:hover:before { color:#ff1e00; } span.iconic.bolt {padding:15px 0; font-size:48px; display:block; text-align:center;}</style>
<p>It is common knowledge that Unicode has an amazing amount of characters, many of which are non-letter symbols (e.g., <a href="http://en.wikipedia.org/wiki/Arrow_(symbol)">Arrows</a>, <a href="http://en.wikipedia.org/wiki/Currency_Symbol">Currency Symbols</a>, <a href="http://en.wikipedia.org/wiki/Geometric_Shapes">Geometic Shapes</a>, etc.). There are many Unicode symbols that represent common icons seen in interfaces. Therefore it makes sense semantically to bind icon glyphs with Unicode characters that represent the same basic subject matter. In doing so there are significant advantages around backwards compatibility. If the fonts do not load or the browser does not support font embedding it will fall back to the Unicode default (if one exists).</p>
<section>
<h1>Example</h1>
<p>The table below shows how the icon font for <a href="/work/iconic">Iconic</a> matches its own icons with Unicode equivalents. The third column shows glyphs from Iconic and the fourth shows the default Unicode glyphs. <em>Note: If you&#8217;re reading this in an RSS reader, you will only see the default icons. Duh.</em></p>
<table class="demo">
<tr>
<th>Name</th>
<th>Unicode Value</th>
<th>Iconic Glyph</th>
<th>Default Glyph</th>
</tr>
<tr>
<td>Sun</td>
<td>0&#215;2600</td>
<td class="icon"><span class='iconic sun_stroke'></span></td>
<td class="icon"><span class='sun_stroke'></span></td>
</tr>
<tr>
<td>Mail</td>
<td>0&#215;2709</td>
<td class="icon"><span class='iconic mail'></span></td>
<td class="icon"><span class='mail'></span></td>
</tr>
<tr>
<td>Key</td>
<td>0&#215;2602</td>
<td class="icon"><span class='iconic cog'></span></td>
<td class="icon"><span class='cog'></span></td>
</tr>
<tr>
<td>Star</td>
<td>0&#215;2605</td>
<td class="icon"><span class='iconic star'></span></td>
<td class="icon"><span class='star'></span></td>
</tr>
<tr>
<td>Moon</td>
<td>0x263e</td>
<td class="icon"><span class='iconic moon_stroke'></span></td>
<td class="icon"><span class='moon_stroke'></span></td>
</tr>
</table>
</section>
<section>
<h1>The Nitty-Gritty</h1>
<p>I went through the specifics of code in my <a href="/2010/05/04/font-embedding-icons/">previous article</a>, but I thought it would be worth showing again. Here is the basic CSS used (I have no doubt there are better ways to write this code, please feel free to share any feedback by commenting):</p>
<p><code>
<pre>@font-face {
  font-family: 'IconicStroke';
  font-weight: normal;
  font-style: normal;
  src: url('iconic_stroke.eot?') format('embedded-opentype');
}
@font-face {
  font-family:'IconicStroke';
  font-weight: normal;
  font-style: normal;
  src: url('iconic_stroke.ttf') format('truetype');
}
.iconic {
  display:inline-block;
  font-family:'IconicStroke';
}
.bolt:before {
  content:'\26a1';
  font-size:32px;
  vertical-align:.15em;
  margin-right:.25em;
  color:#5d504f;
  opacity:.8;
  text-shadow:0px 1px 1px rgba(0,0,0,.3);
}
</pre>
<p></code></p>
<p>For this demo, I simply rap the content in a span, although you could also use an empty <code>span</code> tag to contain the icon for more control.</p>
<p><code>
<pre>
&lt;span class="iconic bolt"&gt;Lightning&lt;/span&gt;
</pre>
<p></code></p>
<p>The code above results in the example below:</p>
<p><span class="iconic bolt big">Icon With Text</span></p>
<p>There are a lot of attributes applied to the example&#8217;s icon which show the advantage of using font icons. The icon can easily be resized, colored, rotated, scaled and adjusted with filters&mdash;all at runtime. No more re-saving images when you need to make a change.<br />
</section>
<section>
<h1>Managing Extensibility</h1>
<p>The most obvious outstanding issue is how to deal with icons that do not have a Unicode equivalent. Philip had a solution for that as well. Unicode has various private ranges which are sequestered for this exact purpose. Iconic uses the <a href="http://en.wikibooks.org/wiki/Unicode/Character_reference/E000-EFFF">E000-EFFF range</a> in these cases. Since there are no official assignments in this range, using them creates no semantic conflicts. However, any glyph that does not have a character assigned to it will display a placeholder (&#xE000;). This causes an issue for browsers that don&#8217;t support <code>@font-face</code>, so designers &amp; developers still need to perform a check that a browser supports <code>@font-face</code> before employing this method.<br />
</section>
<section>
<h1>Open Issues and Next Steps</h1>
<p>There are still some issues that will need to be worked out, most notably a bug in Webkit that will not display glyphs at high Unicode hex values with the <code>content:before</code> rule. I have <a href="https://bugs.webkit.org/show_bug.cgi?id=74815">posted a bug</a> and hopefully it will be fixed soon.</p>
<p>This is a major step in the right direction. From my perspective, this new method makes icon font rendering a legitimate and powerful approach towards displaying icons. I want to thank Philip Shaw who shared this idea and <a href="http://about.me/yann.hourdel">Yann Hourdel</a> who helped me create the <a href="https://github.com/somerandomdude/Iconic/tree/master/scripts/font%20creation">font creation scripts</a> for Iconic. While Iconic is free and open source, I would like to offer these icons on services such as <a href="http://typekit.com">TypeKit</a> and <a href="http://www.google.com/webfonts">Google Web Fonts</a>. The more demand there is for icon fonts, the greater chance they will be accepted at some point.</p>
<p>On a side note, the help I received through this process was one major reason why I <a href="https://github.com/somerandomdude/Iconic">open sourced Iconic</a>. The new Iconic font faces were a community effort and it would not have happened without the tremendous help and feedback given by so many people. Speaking of feedback, I would love to hear your feedback on this method and how we can continue to improve upon this idea.<br />
</section>
]]></content:encoded>
			<wfw:commentRss>http://www.somerandomdude.com/2012/01/31/font-embedding-icons-the-right-way/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
	</channel>
</rss>

<!-- Performance optimized by W3 Total Cache. Learn more: http://www.w3-edge.com/wordpress-plugins/

Minified using apc (Feed is rejected)
Page Caching using apc
Database Caching 1/9 queries in 0.005 seconds using apc
Object Caching 269/287 objects using apc

Served from: www.somerandomdude.com @ 2012-02-09 17:49:52 -->
