<?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>User Agent Man &#187; cleartype</title>
	<atom:link href="http://www.useragentman.com/blog/tag/cleartype/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.useragentman.com/blog</link>
	<description>A Blog about Client Side Web Technology</description>
	<lastBuildDate>Thu, 26 Jan 2012 03:14:32 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>How to Make ClearType, @font-face Fonts and CSS Visual Filters Play Nicely Together</title>
		<link>http://www.useragentman.com/blog/2010/09/02/how-to-make-cleartype-font-face-fonts-and-css-visual-filters-play-nicely-together/</link>
		<comments>http://www.useragentman.com/blog/2010/09/02/how-to-make-cleartype-font-face-fonts-and-css-visual-filters-play-nicely-together/#comments</comments>
		<pubDate>Thu, 02 Sep 2010 20:49:51 +0000</pubDate>
		<dc:creator>zoltan</dc:creator>
				<category><![CDATA[@font-face]]></category>
		<category><![CDATA[ClearType]]></category>
		<category><![CDATA[CSS]]></category>
		<category><![CDATA[CSS3]]></category>
		<category><![CDATA[Fonts]]></category>
		<category><![CDATA[IE Visual Filters]]></category>
		<category><![CDATA[anti-aliased text]]></category>
		<category><![CDATA[blocky text]]></category>
		<category><![CDATA[cleartype]]></category>
		<category><![CDATA[CSS Filters]]></category>
		<category><![CDATA[IE]]></category>
		<category><![CDATA[ie filters]]></category>
		<category><![CDATA[Internet Explorers]]></category>
		<category><![CDATA[matrix]]></category>
		<category><![CDATA[opacity]]></category>
		<category><![CDATA[Visual Filters]]></category>

		<guid isPermaLink="false">http://www.useragentman.com/blog/?p=1526</guid>
		<description><![CDATA[<img src="http://www.useragentman.com/blog/wp-content/uploads/2010/09/ieBadAntiAliasFront.png" /> Ever had a problem with using IE's Alpha Visual Filter and getting blocky text? A solution has been found, and it doesn't use JavaScript.  I expect to hear a sigh of relief from many developers.]]></description>
			<content:encoded><![CDATA[<div class="importantNotes">
<h3>Update (Sept. 3, 2010)</h3>
<ul>
<li>This article originally has the <code>filter</code> and <code>-ms-filter</code> rules reversed, which is against <a href="http://blogs.msdn.com/b/ie/archive/2008/09/08/microsoft-css-vendor-extensions.aspx">Microsoft&#8217;s best practices</a> for IE8.  This error has been corrected.</li>
<li>Thanks to <a href="http://www.zomigi.com">Zoe Mickley Gillenwater</a> for pointing out that IE8 needs to have all the filter functions (i.e. all the stuff in the double quotes) on one line.</li>
</ul>
</div>
<p>The modern web developer wants to be able to use a variety of CSS3 effects together, but sometimes doing this in IE can be challenging, especially if you don&#8217;t want to use JavaScript.  Let&#8217;s take a look a common problem with IE: blocky text in IE when using IE Visual filters on a block of text.  For example, if you&#8217;ve ever tried to do <a href="http://davidwalsh.name/css-opacity">the cross-browser CSS opacity trick</a> to implement opacity in IE6, this problem manifests itself when the <strong>text is styled with no background color</strong>.  A developer uses this well-known cross browser CSS-foo to make this work:</p>
<blockquote class="code">
<pre>
#badAntiAliasing {
	opacity: 0.5;

        /* IE 8 */
        -ms-filter: "progid:DXImageTransform.Microsoft.Alpha(opacity=50)";

        /* IE 6,7 */
	filter: progid:DXImageTransform.Microsoft.Alpha(opacity=50);

}
</pre>
</blockquote>
<p>And it looks great in every browser, but <strong>it looks like crap in Internet Explorer 6 with ClearType turned on.</strong>  It is especially pronounced when using @font-face embedding with fonts that assume that some sort of anti-aliasing technology is being used.  The example below uses <a href="http://www.fonts.info/info/press/free-fonts-for-font-face-embedding.htm">Graublau Sans Web</a> with the Alpha filter to illustrate the issue:</p>
<table class="dataTable" style="margin-top: 1em">
<thead>
<tr>
<th>Opacity Solution in IE</th>
<th>Opacity Solution in every other browser</th>
</tr>
</thead>
<tbody>
<tr>
<td><a href="http://www.useragentman.com/blog/wp-content/uploads/2010/09/ieBadAntiAlias.png"><img src="http://www.useragentman.com/blog/wp-content/uploads/2010/09/ieBadAntiAlias.png" alt="" title="ieBadAntiAlias" width="361" height="58" class="alignnone size-full wp-image-1530" /></a></td>
<td><a href="http://www.useragentman.com/blog/wp-content/uploads/2010/09/firefoxAntiAlias.png"><img src="http://www.useragentman.com/blog/wp-content/uploads/2010/09/firefoxAntiAlias.png" alt="" title="firefoxAntiAlias" width="360" height="50" class="alignnone size-full wp-image-1529" /></a></td>
</tr>
</tbody>
</table>
<p>This has been a known problem with IE ever since 2006 when ClearType&#8217;s product manager, Peter Gurevich, <a href="http://blogs.msdn.com/b/ie/archive/2006/08/31/730887.aspx">announced on the IEBlog their decision to disable ClearType on elements that use any Visual Filter</a>.  If you read the comments on this blog article, you will see many upset developers.  I was one of them, since this not only affects the <a href="http://msdn.microsoft.com/en-us/library/ms532967%28v=VS.85%29.aspx">Alpha Filter</a>, but all of <a href="http://msdn.microsoft.com/en-us/library/ms532849%28v=VS.85%29.aspx">IE&#8217;s Visual Filters</a>, some of which I use in cssSandpaper to get IE to support CSS3 properties like <code>transform</code>.</p>
<p>Today, however, we can rejoice.  There is a <strong>usable workaround that will make ClearType rendered fonts look nice when using Visual Filters</strong>.  In our example above, here is what needs to be done:</p>
<blockquote class="code">
<pre>
body.ie6 #goodAntiAliasing,
body.ie7 #goodAntiAliasing,
body.ie8 #goodAntiAliasing {
	background-color: <span class="hilite">white</span>;
}

#goodAntiAliasing {
	opacity: 0.5;

        /* IE 8: yes, it is ugly but it has to be on one line. :-( */
        -ms-filter: "progid:DXImageTransform.Microsoft.Chroma(<span class="hilite">color='white'</span>) progid:DXImageTransform.Microsoft.Alpha(opacity=50)";

        /* IE 6,7 is more flexible: it can be on multiple lines. */
	filter: progid:DXImageTransform.Microsoft.Chroma(<span class="hilite">color='white'</span>)
                progid:DXImageTransform.Microsoft.Alpha(opacity=50);

}
</pre>
</blockquote>
<p>What is going on here?</p>
<ol>
<li>The first rule sets the background color of the container to a color that is represents the color of the majority of the background image on the page.  <strong>Note that this rule uses <a href="http://paulirish.com/2008/conditional-stylesheets-vs-css-hacks-answer-neither/">Paul Irish&#8217;s Conditional CSS Pattern</a> to serve it only to IE.</strong></li>
<li>The second rule executes two of IE&#8217;s Visual Filters:
<ul>
<li>the Chroma Visual Filter, which tells IE &#8220;Please make this color transparent&#8221;.  The color we choose to make transparent is the one we selected in the first rule.</li>
<li>the Alpha Visual Filter, which does the opacity trick</li>
</ul>
</ol>
<table class="dataTable">
<thead>
<tr>
<th>Default Opacity in IE</th>
<th>New Opacity Solution in IE</th>
</tr>
</thead>
<tbody>
<tr>
<td><a href="http://www.useragentman.com/blog/wp-content/uploads/2010/09/ieBadAntiAlias.png"><img src="http://www.useragentman.com/blog/wp-content/uploads/2010/09/ieBadAntiAlias.png" alt="" title="ieBadAntiAlias" width="361" height="58" class="alignnone size-full wp-image-1530" /></a></td>
<td><a href="http://www.useragentman.com/blog/wp-content/uploads/2010/09/ieBadAntiAlias.png"><img src="http://www.useragentman.com/blog/wp-content/uploads/2010/09/ieGoodAntiAlias.png" alt="" title="ieBadAntiAlias" width="361" height="58" class="alignnone size-full wp-image-1530" /></a></td>
</tr>
</tbody>
</table>
<p><strong>These filters must be in the order given</strong>, and not the other way around.  Note also that care must be given that <strong>the color chosen to be transparent should be the average color of what is behind the text being styled</strong>, otherwise you will get less than optimal results.  If this background is a complex image, just use the colour that&#8217;s used most often.</p>
<p>This fixes not only the IE opacity problem, but also issues with other Visual Filters, such as <code>Matrix</code>.  I will be updating cssSandpaper to use this trick so that transformed objects in IE won&#8217;t look so blocky.</p>
<p><a class="exampleLink" href="/tests/fontFacePlusFilter/">Take a look at the solution in action (make sure you look at it in IE in order to get the full effect)</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.useragentman.com/blog/2010/09/02/how-to-make-cleartype-font-face-fonts-and-css-visual-filters-play-nicely-together/feed/</wfw:commentRss>
		<slash:comments>14</slash:comments>
		</item>
		<item>
		<title>More @font-face fun</title>
		<link>http://www.useragentman.com/blog/2009/10/09/more-font-face-fun/</link>
		<comments>http://www.useragentman.com/blog/2009/10/09/more-font-face-fun/#comments</comments>
		<pubDate>Sat, 10 Oct 2009 00:53:36 +0000</pubDate>
		<dc:creator>zoltan</dc:creator>
				<category><![CDATA[@font-face]]></category>
		<category><![CDATA[CSS]]></category>
		<category><![CDATA[Fonts]]></category>
		<category><![CDATA[SVG]]></category>
		<category><![CDATA[@font-face. opera. chrome]]></category>
		<category><![CDATA[anti-aliasing]]></category>
		<category><![CDATA[cleartype]]></category>
		<category><![CDATA[svg fonts]]></category>

		<guid isPermaLink="false">http://www.useragentman.com/blog/?p=237</guid>
		<description><![CDATA[My first post @font-face in Depth got a huge amount of unexpected attention.  Thank you all for your comments and criticism.  Since the post, there have been quite a bit of information I have read about and thought I should share. SVG fonts for Opera and Chrome Jonathan Snook wrote a great article regarding Opera [...]]]></description>
			<content:encoded><![CDATA[<p>My first post <a href="/blog/2009/09/20/font-face-in-depth/">@font-face in Depth</a> got a <strong>huge</strong> amount of unexpected attention.  Thank you all for your comments and criticism.  Since the post, there have been quite a bit of information I have read about and thought I should share.</p>
<h2>SVG fonts for Opera and Chrome</h2>
<p><a href="http://www.snook.ca/">Jonathan Snook</a> wrote a great article <a href="http://www.snook.ca/archives/html_and_css/becoming-a-font-embedding-master">regarding Opera 10 and Google Chrome supporting SVG fonts</a> (Chrome can load them without any pesky command line switch!).   He mentions how to convert TrueType fonts to this format using <a href="http://xml.apache.org/batik/">Batik</a>, and that by removing all the <code>&lt;hkren&gt;</code> elements inside the file&#8217;s XML can make the font smaller than the original TrueType file.  Too bad the browsers don&#8217;t support this format.</p>
<h2>Opera&#8217;s buggy implementation</h2>
<p>I noticed after I launched my first @font-face article that Opera was not loading the fonts on my blog when users visited more than one page.  It turns out that Opera 10&#8242;s implementation of @font-face is a little buggy.  When you feed it a page with an embedded font, you may not see the embedded fonts properly, like in the screenshot below:</p>
<p><div id="attachment_238" class="wp-caption aligncenter" style="width: 310px"><a href="http://www.useragentman.com/blog/wp-content/uploads/2009/10/screenshotOpera.png"><img class="size-medium wp-image-238 " title="screenshotOpera" src="http://www.useragentman.com/blog/wp-content/uploads/2009/10/screenshotOpera-300x215.png" alt="screenshotOpera" width="300" height="215" /></a><p class="wp-caption-text">Opera sometimes doesn&#39;t load the font at all, and removes other styling (click to enlarge).</p></div></p>
<p><a href="http://readableweb.com/opera-admits-font-face-bugs-in-opera-10/">According to Opera</a>, this happens when &#8220;specifying different weights and styles for a single font-family name&#8221;.  Håkon Wium Lie, the company&#8217;s Chief Technology Officer , <a href="http://devfiles.myopera.com/articles/751/webfonts-workaround.html">has described a work-around</a> until the company can fix the problem properly.</p>
<p>I am debating whether to implement the work around on my site, or to wait for Opera to fix the problem and patch all Opera 10 installations via auto-update (I&#8217;m leaning towards the latter).</p>
<h2>Performance Issues With Font Embedding</h2>
<p>One of the comments on the last article came from <a href="http://stevesouders.com/">Steve Souders</a> who had <a href="/blog/2009/09/20/font-face-in-depth/#comment-37">performance concerns with font-embedding</a>.  Paul Irish came back with information showing the <a href="http://paulirish.com/2009/fighting-the-font-face-fout/">when browsers load the fonts, and what they do before the font is loaded</a>.  He also shows how to use JavaScript to make the loading behaviour consistent between browsers.</p>
<p>The performance issues with font-embedding is something I am going to be keeping an eye on, especially when it comes to font-services, which the OpenType site believes will be <a href="http://opentype.info/blog/2009/07/29/why-webfont-services-are-the-future-of-fonts-on-the-web/">the future of web font distribution for commercial fonts</a>.  Although it doesn&#8217;t seem like much of an issue currently (my blog <em>seems</em> to load quickly), I don&#8217;t want to do anything that would slow down my web applications &#8211; especially if I am using them just to make the text look a little prettier.</p>
<h2>Windows XP Rendering Issues</h2>
<p>Boing-Boing had a bad experience with font-embedding.  Turns out <a href="http://www.webmonkey.com/blog/Boing_Boing_s_Redesign_Uncovers_the_Dark_Side_of_Web_Fonts">they got a lot of complaints when they decided to incorporate it into their website</a>.  The reason: some users didn&#8217;t have ClearType turned on, and the font Boing-Boing chose looked &#8220;like ass&#8221; without ClearType.</p>
<p>Below are screenshots of this site without ClearType on:</p>
<p><div id="attachment_250" class="wp-caption aligncenter" style="width: 449px"><img class="size-full wp-image-250" title="ieNoAA" src="http://www.useragentman.com/blog/wp-content/uploads/2009/10/ieNoAA.png" alt="ieNoAA" width="439" height="336" /><p class="wp-caption-text">Internet Explorer without ClearType</p></div></p>
<p style="text-align: center;">
<p><div id="attachment_251" class="wp-caption aligncenter" style="width: 465px"><img class="size-full wp-image-251" title="firefoxNoAA" src="http://www.useragentman.com/blog/wp-content/uploads/2009/10/firefoxNoAA.png" alt="Firefox without ClearType" width="455" height="327" /><p class="wp-caption-text">Firefox without ClearType</p></div></p>
<p>The article stated that there are quite a few XP computers which apparently don&#8217;t have ClearType on by default. I wonder if there are any stats to back that up. If so, then developers embed fonts into pages should test that scenario as well.  It does look different.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.useragentman.com/blog/2009/10/09/more-font-face-fun/feed/</wfw:commentRss>
		<slash:comments>10</slash:comments>
		</item>
	</channel>
</rss>

