<?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>greenideas &#187; font-face</title>
	<atom:link href="http://mwhenry.com/blog/tag/font-face/feed/" rel="self" type="application/rss+xml" />
	<link>http://mwhenry.com/blog</link>
	<description>A blog by Matt Henry</description>
	<lastBuildDate>Fri, 02 Jul 2010 23:26:44 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>Ugly font-variant bug</title>
		<link>http://mwhenry.com/blog/2010/04/ugly-font-variant-bug/</link>
		<comments>http://mwhenry.com/blog/2010/04/ugly-font-variant-bug/#comments</comments>
		<pubDate>Thu, 22 Apr 2010 18:21:52 +0000</pubDate>
		<dc:creator>Matt Henry</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[browsers]]></category>
		<category><![CDATA[CSS]]></category>
		<category><![CDATA[font-face]]></category>
		<category><![CDATA[typography]]></category>
		<category><![CDATA[webfonts]]></category>

		<guid isPermaLink="false">http://mwhenry.com/blog/?p=96</guid>
		<description><![CDATA[Here’s an annoying little bug that manifests when you try to set a CSS font-variant property (say, small-caps) with a font that doesn’t provide the requested variant. For instance, here is some text in League Gothic, pulled in via @font-face: League Gothic doesn’t have its own small caps variant. So what happens when you tell [...]]]></description>
			<content:encoded><![CDATA[<p>Here’s an annoying little bug that manifests when you try to set a CSS font-variant property (say, small-caps) with a font that doesn’t provide the requested variant. For instance, here is some text in League Gothic, pulled in via <code>@font-face</code>:</p>
<p><img src="http://mwhenry.com/blog/images/lg-normal.png" alt="Sample of league gothic text, rendered normally"/></p>
<p>League Gothic doesn’t have its own small caps variant. So what happens when you tell the browser to give you one anyway? Here it is with <code>font-variant: small-caps</code> applied as rendered in Firefox:</p>
<p><img src="http://mwhenry.com/blog/images/lg-sc-firefox.png" alt="Sample of league gothic small caps, rendered correctly in Firefox" /></p>
<p>So far, so good. But here’s what you get when you add small caps to League Gothic in Webkit:</p>
<p><img src="http://mwhenry.com/blog/images/lg-sc-webkit.png" alt="Sample of league gothic small caps, which falls back to the default font in Webkit" /></p>
<p>Whoops! Webkit-based browsers (I tested this in Safari, Webkit Nightly, and Chrome for OSX), when they don’t find the specified variant in the font itself, just go to the next font in the stack. In this case, it’s the browser’s default font.</p>
<p>So which behavior is correct? The CSS2 spec essentially left it up to implementors to decide whether or not they would dynamically scale the font to implement small caps. CSS3 removes the ambiguity:</p>
<blockquote><p>If a genuine small-caps font is not available, user agents should simulate a small-caps font, for example by taking a normal font and replacing the lowercase letters by scaled uppercase characters. (<a href="http://www.w3.org/TR/css3-fonts/#small-caps-the-font-variant-property"><cite>CSS fonts module level 3</cite></a>)</p></blockquote>
<p>Although a typographic purist might take issue with this behavior (Bringhurst rails against the practice of “rolling your own” variants by dynamically scaling the existing face), this is what the spec says browsers are supposed to do. And in fact, this is what Firefox does. Webkit, on the other hand, checks each font in the stack in order until it finds one that supplies the desired variant. As in the example above, if there’s nothing else in the stack, it will fall back on the browser’s default font. </p>
<p>Unfortunately, there aren’t really any workarounds for this bug. But it should serve to remind you yet again that it’s super-important to put a good deal of thought into your font stack. Always try to build a stack where all of the fonts are as similar as possible, so when something like this happens, your design doesn’t break too badly.</p>
<p>For reference, or if you’d like to see how your browser of choice handles these cases, <a href="http://mwhenry.com/blog/examples/font-variant/">here are some test cases together on a separate page.</a></p>
]]></content:encoded>
			<wfw:commentRss>http://mwhenry.com/blog/2010/04/ugly-font-variant-bug/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Font-face Support Table</title>
		<link>http://mwhenry.com/blog/2009/12/font-face-support-table/</link>
		<comments>http://mwhenry.com/blog/2009/12/font-face-support-table/#comments</comments>
		<pubDate>Fri, 04 Dec 2009 19:26:08 +0000</pubDate>
		<dc:creator>Matt Henry</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[CSS]]></category>
		<category><![CDATA[font-face]]></category>
		<category><![CDATA[typography]]></category>
		<category><![CDATA[web standards]]></category>
		<category><![CDATA[webfonts]]></category>

		<guid isPermaLink="false">http://mwhenry.com/blog/?p=84</guid>
		<description><![CDATA[I’ve been sitting on this for a little while, so I thought I’d just go ahead and publish it. For an in-depth explanation of how I got these results, check out this post. In a nutshell, it shows that all of the main desktop browsers support some kind of @font-face format, so as long as [...]]]></description>
			<content:encoded><![CDATA[<p>I’ve been sitting on this for a little while, so I thought I’d just go ahead and publish it. For an in-depth explanation of how I got these results, check out <a href="http://mwhenry.com/blog/2009/11/webfonts-and-mobile-devices/">this post.</a> In a nutshell, it shows that all of the main desktop browsers support some kind of @font-face format, so as long as you use something like the Bulletproof font-face syntax, your fonts will render in all of the the major browsers (e.g. those with &gt; 3% market share). On mobile, it’s still a Mobile Safari-only party.</p>
<table id="fontFaceSupport" class="results" cellspacing="0" width="100%">
<caption>Webfont format support by browser</caption>
<thead>
<tr class="font-types">
<th></th>
<th>Embedded Open Type (.eot)</th>
<th>TrueType (.ttf)</th>
<th>OpenType (otf)</th>
<th>Web Open Font Format (.woff)</th>
<th>SVG (.svg)</th>
</tr>
<tr>
<th colspan="6">Mobile Browsers<a href="#fontFaceSupport-note1"><sup>1</sup></a></th>
</tr>
</thead>
<tfoot>
<tr>
<td colspan="6"><a href="#fontFaceSupport"><sup id="fontFaceSupport-note1">1</sup></a> I haven’t had a chance to test Mozilla’s portable offerings</td>
</tr>
</tfoot>
<tbody>
<tr>
<th>Mobile IE (≤ WinMo 6.5)</th>
<td class="no">No</td>
<td class="no">No</td>
<td class="no">No</td>
<td class="no">No</td>
<td class="no">No</td>
</tr>
<tr>
<th>Opera Mini (≤ v4.2)</th>
<td class="no">No</td>
<td class="no">No</td>
<td class="no">No</td>
<td class="no">No</td>
<td class="no">No</td>
</tr>
<tr>
<th>Opera Mobile (9.7 Beta WinMo)</th>
<td class="no">No</td>
<td class="no">No</td>
<td class="no">No</td>
<td class="no">No</td>
<td class="no">No</td>
</tr>
<tr>
<th>Palm WebOS </th>
<td class="no">No</td>
<td class="no">No</td>
<td class="no">No</td>
<td class="no">No</td>
<td class="no">No</td>
</tr>
<tr>
<th>Mobile Safari (3.1)</th>
<td class="no">No</td>
<td class="no">No</td>
<td class="no">No</td>
<td class="no">No</td>
<td class="yes">Yes!</td>
</tr>
<tr>
<th>Android (≥ 2.2 SDK)</th>
<td class="no">No</td>
<td class="yes">Yes</td>
<td class="yes">Yes</td>
<td class="no">No</td>
<td class="no">No</td>
</tr>
</tbody>
<thead>
<tr>
<th colspan="6">Desktop Browsers (Incomplete. I’ll be filling this in more over time)</th>
</tr>
</thead>
<tbody>
<tr>
<th>IE (≥ 5.5)</th>
<td class="yes">Yes</td>
<td class="no">No</td>
<td class="no">No</td>
<td class="no">No</td>
<td class="no">No</td>
</tr>
<tr>
<th>Firefox</th>
<td class="no">No</td>
<td class="yes">Yes (≥ 3.5)</td>
<td class="yes">Yes (≥ 3.5)</td>
<td class="yes">Yes (≥ 3.6)</td>
<td class="no">No</td>
</tr>
<tr>
<th>Safari</th>
<td class="no">No</td>
<td class="yes">Yes (≥ 3.1)</td>
<td class="yes">Yes (≥ 3.1)</td>
<td class="no">No</td>
<td class="yes">Yes (≥ 3.1)</td>
</tr>
<tr>
<th>Opera</th>
<td class="no">No</td>
<td class="yes">Yes</td>
<td class="yes">Yes</td>
<td class="no">No</td>
<td class="yes">Yes</td>
</tr>
<tr>
<th>Chrome</th>
<td class="no">No</td>
<td class="no">No</td>
<td class="no">No</td>
<td class="no">No</td>
<td class="yes">Yes (≥ 3.0)</td>
</tr>
</tbody>
</table>
]]></content:encoded>
			<wfw:commentRss>http://mwhenry.com/blog/2009/12/font-face-support-table/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Webfonts and Mobile Devices</title>
		<link>http://mwhenry.com/blog/2009/11/webfonts-and-mobile-devices/</link>
		<comments>http://mwhenry.com/blog/2009/11/webfonts-and-mobile-devices/#comments</comments>
		<pubDate>Tue, 10 Nov 2009 23:32:55 +0000</pubDate>
		<dc:creator>Matt Henry</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[CSS]]></category>
		<category><![CDATA[font-face]]></category>
		<category><![CDATA[typography]]></category>
		<category><![CDATA[web standards]]></category>
		<category><![CDATA[webfonts]]></category>

		<guid isPermaLink="false">http://mwhenry.com/blog/?p=58</guid>
		<description><![CDATA[If you pay even a little attention to emerging trends in Web Standards, you’re no doubt familiar with the explosion in interest in the CSS @font-face property. This property goes back to CSS2, and has been supported in IE as far back as 5.5, but @font-face support is being added at a rapid pace to [...]]]></description>
			<content:encoded><![CDATA[<div class="image"><img src="/blog/images/chunk.gif" alt="" /></div>
<p>If you pay even a little attention to emerging trends in Web Standards, you’re no doubt familiar with the explosion in interest in the CSS <code>@font-face</code> property. This property goes back to CSS2, and has been supported in IE as far back as 5.5, but <code>@font-face</code> support is being added at a rapid pace to other browsers, hence the recent surge of interest.</p>
<p>As someone who spends his days developing for mobile platforms, I wanted to check on how <code>@font-face</code> support was progressing in mobile browsers. Read on to see what I found out.</p>
<h3>Methodology</h3>
<p>I put together a <a href="/blog/examples/font-face-test/">test page</a> I used to check the extent of <code>@font-face</code> support.</p>
<p>I made test elements and separate font families for each font format being tested (e.g. there’s a font family called “ChunkFive SVG” that will only be applied to the <code>span#SVG</code> test element. View source on the sample page for more details). I checked for <code>@font-face</code> support with three criteria (two automated):</p>
<ol>
<li>Ask each test element what font-family it thinks it is being rendered with. This is done via the <code>window.getComputedStyle()</code> method (and why I’m sticking with testing W3C compliant browsers at the moment). If all goes well, the return value should be some variant of ChunkFive.</li>
<li>Check to see if the rendered text is wider than text rendered in the browser’s default font. For the test to pass, it has to be wider, since there are font size bugs in Mobile Safari (see below).</li>
<li>Eyeball it. In some cases, the criteria above aren’t met, so the <code>@font-face</code> implementation is incorrect, but it’s close enough to be saved with some extra TLC.</li>
</ol>
<p>I also included a test case based on <a href="http://paulirish.com/2009/bulletproof-font-face-implementation-syntax/">Paul Irish’s Bulletproof @font-face syntax</a> as a bit of a sanity check and for the sake of having a less contrived example. Lastly, I threw in samples of Cufon and sIFR text, just for comparison.</p>
<p>All that said, here’s what I came up with.</p>
<h3>Results</h3>
<h4>Mobile Safari 3.0</h4>
<p>Support for <code>@font-face</code> in Mobile Safari is currently broken in several frustrating ways:</p>
<ol>
<li>Certain formats (e.g. TTF &amp; OTF), when applied, falsely report that they have been successfully applied. That is, if you check the value of font-family from getComputedStyle() on that element, it will return the <code>@font-face value</code>, even though it doesn’t render as such. (<strong>Update 11/13:</strong> As Paul Irish correctly pointed out in the comments to this post, Opera is actually the only browser that returns the font that’s actually used when <code>getComputedStyle()</code> is called.)</li>
<li>What’s worse, is that when this situation occurs, if no fallback <code>font-family</code> is specified, the text will render with the browser’s default <code>font-family</code> (as you’d expect), but <em>it does so at less than the default font size</em>. Fortunately, if you specify a fallback value in the <code>font-family</code> declaration, it will render the fallback typeface at the correct size, so always remember to pick a degradation path for your fonts.</li>
<li>Another issue with text size arises if you use the SVG format to get around the lack of support for other formats on the iPhone. While you can indeed use SVG fonts in your font-face rules on the iPhone, text rendered in SVG fonts will render at smaller than expected sizes. So if you opt for this strategy, just plan for this consequence, and correct the font sizes accordingly.  Desktop browsers that support SVG fonts (Safari &amp; Chrome) don’t exhibit this bug, so you need to target this font-size fix to mobile browsers. You can easily handle this case with a <code>@media</code> query in your stylesheet. Users of the Bulletproof Syntax will see this bug, since it will fall through to SVG on Mobile Safari.
<div class="image alignRight"><img src="/blog/images/SVGfail.png" alt="Mobile Safari renders SVG text too small" /><span class="caption">SVG fonts on Mobile Safari render too small out of the box.</span></div>
</li>
<li>Another (possibly more academic) issue is that calling <code>getComputedStyle()</code> on text rendered with an SVG font will not return the font-family value in your <code>@font-face</code> declaration, even though it renders with that font family. This could prove troublesome if you’re using Javascript to test the success of your font rendering.</li>
</ol>
<p>So if you need to use <code>@font-face</code> on Mobile Safari today, you should be sure to include an SVG version in your <code>@font-face</code> declaration, and you should patch any text size bugs with a <code>@media</code> query. (If you’re not familiar with @media queries, you should <a href="http://www.w3.org/TR/css3-mediaqueries/">read up on them</a>.)</p>
<p>Incidentally, Opera 10 on the desktop also shows a slight variation in font-size when using SVG fonts as well. However, since it supports TrueType and OpenType formats, this shouldn’t cause any particular issues if you’re using the bulletproof syntax (that’s why it’s bulletproof, yo).</p>
<h4>Android 2.0 SDK</h4>
<p>Short and not so sweet: There is no support in the Android 2.0 SDK for any webfont format. If you’re targeting Android, use Cufon.</p>
<h4>Palm WebOS</h4>
<p>Like Android, there is currently no support whatsoever for @font-face in WebOS. Additionally, in my (not at all extensive) tests, Cufon didn’t even appear to work at all (as in no text was rendered).</p>
<h3>Summary</h3>
<p>In short, if you want your mobile site to join the Nice Web Type bandwagon, you have a little more work to do than for your desktop site. Of all of the modern WebKit-based mobile browsers, only Mobile Safari provides any kind of @font-face support. And even that support is buggy and incomplete. However, if you are aware of these limitations ahead of time (which you ought to be by this point in the post), you have a couple of tricks in your back pocket to keep things running smoothly.</p>
<h3>What’s Next?</h3>
<p>In the next little while, I’ll extend these tests to cover IE on WinMo and also do a similar write-up for <code>@font-face</code> support in desktop browsers and tabulate all of the results in a little more formal manner.</p>
<p><strong>Update:</strong> In case anyone wants to take a look under the hood of these tests without jumping through hoops in Firebug or View Source, the test code is <a href="http://github.com/greenideas/font-face-test">up on Github</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://mwhenry.com/blog/2009/11/webfonts-and-mobile-devices/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
	</channel>
</rss>
