<?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>Flex Examples &#187; fontAntiAliasType</title>
	<atom:link href="http://blog.flexexamples.com/tag/fontantialiastype/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.flexexamples.com</link>
	<description>Just a bunch of Adobe Flex Examples</description>
	<lastBuildDate>Wed, 26 Jan 2011 18:09:51 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Setting the font sharpness for a Label control in Flex</title>
		<link>http://blog.flexexamples.com/2008/08/21/setting-the-font-sharpness-for-a-label-control-in-flex/</link>
		<comments>http://blog.flexexamples.com/2008/08/21/setting-the-font-sharpness-for-a-label-control-in-flex/#comments</comments>
		<pubDate>Fri, 22 Aug 2008 06:05:01 +0000</pubDate>
		<dc:creator>Peter deHaan</dc:creator>
				<category><![CDATA[Label]]></category>
		<category><![CDATA[fontAntiAliasType]]></category>
		<category><![CDATA[fontSharpness]]></category>

		<guid isPermaLink="false">http://blog.flexexamples.com/2008/08/21/setting-the-font-sharpness-for-a-label-control-in-flex/</guid>
		<description><![CDATA[<p>The following example shows how you can set the font sharpness on a Flex Label control by setting the fontSharpness and fontAntiAliasType styles.</p> <p></p> &#60;?xml version="1.0" encoding="utf-8"?&#62; &#60;!-- http://blog.flexexamples.com/2008/08/21/setting-the-font-sharpness-for-a-label-control-in-flex/ --&#62; &#60;mx:Application name="Label_fontSharpness_test" xmlns:mx="http://www.adobe.com/2006/mxml" layout="vertical" verticalAlign="middle" backgroundColor="white"&#62; &#60;mx:Style&#62; @font-face { src: local("Arial"); fontFamily: ArialEmbedded; } @font-face { src: local("Base 02"); fontFamily: Base02Embedded; } &#60;/mx:Style&#62; &#60;mx:ApplicationControlBar dock="true"&#62; [...]]]></description>
			<content:encoded><![CDATA[<p>The following example shows how you can set the font sharpness on a Flex Label control by setting the <code>fontSharpness</code> and <code>fontAntiAliasType</code> styles.</p>
<p><span id="more-756"></span></p>
<pre class="code">
&lt;?xml version="1.0" encoding="utf-8"?&gt;
&lt;!-- http://blog.flexexamples.com/2008/08/21/setting-the-font-sharpness-for-a-label-control-in-flex/ --&gt;
&lt;mx:Application name="Label_fontSharpness_test"
        xmlns:mx="http://www.adobe.com/2006/mxml"
        layout="vertical"
        verticalAlign="middle"
        backgroundColor="white"&gt;

    &lt;mx:Style&gt;
        @font-face {
            src: local("Arial");
            fontFamily: ArialEmbedded;
        }

        @font-face {
            src: local("Base 02");
            fontFamily: Base02Embedded;
        }
    &lt;/mx:Style&gt;

    &lt;mx:ApplicationControlBar dock="true"&gt;
        &lt;mx:Form styleName="plain"&gt;
            &lt;mx:FormItem label="fontFamily:"&gt;
                &lt;mx:ComboBox id="comboBox"
                        dataProvider="[ArialEmbedded,Base02Embedded]" /&gt;
            &lt;/mx:FormItem&gt;
            &lt;mx:FormItem label="fontSharpness:" direction="horizontal"&gt;
                &lt;mx:HSlider id="slider"
                        minimum="-400"
                        maximum="400"
                        value="0"
                        snapInterval="10"
                        tickInterval="50"
                        liveDragging="true" /&gt;
                &lt;mx:Label text="{slider.value}" /&gt;
            &lt;/mx:FormItem&gt;
        &lt;/mx:Form&gt;
    &lt;/mx:ApplicationControlBar&gt;

    &lt;mx:Label id="lbl"
            text="The quick brown fox jumped over the lazy dog."
            fontFamily="{comboBox.selectedItem}"
            fontSize="16"
            fontAntiAliasType="advanced"
            fontSharpness="{slider.value}" /&gt;

&lt;/mx:Application&gt;
</pre>
<p class="information"><a href="http://blog.flexexamples.com/wp-content/uploads/Label_fontSharpness_test/bin/srcview/index.html">View source</a> is enabled in the following example.</p>
<p><iframe src="http://blog.flexexamples.com/wp-content/uploads/Label_fontSharpness_test/bin/main.html" width="100%" height="150"></iframe></p>
<p>You can also set the <code>fontSharpness</code> style in an external .CSS file or &lt;mx:Style /&gt; block, as seen in the following example:</p>
<p class="download"><a href="http://blog.flexexamples.com/wp-content/uploads/Label_fontSharpness_test/bin/srcview/source/main2.mxml.html">View MXML</a></p>
<pre class="code">
&lt;?xml version="1.0" encoding="utf-8"?&gt;
&lt;!-- http://blog.flexexamples.com/2008/08/21/setting-the-font-sharpness-for-a-label-control-in-flex/ --&gt;
&lt;mx:Application name="Label_fontSharpness_test"
        xmlns:mx="http://www.adobe.com/2006/mxml"
        layout="vertical"
        verticalAlign="middle"
        backgroundColor="white"&gt;

    &lt;mx:Style&gt;
        @font-face {
            src: local("Base 02");
            fontFamily: Base02Embedded;
        }

        Label {
            fontAntiAliasType: advanced;
            fontFamily: Base02Embedded;
            fontSize: 16;
            fontSharpness: 400;
        }
    &lt;/mx:Style&gt;

    &lt;mx:Label id="lbl"
            text="The quick brown fox jumped over the lazy dog." /&gt;

&lt;/mx:Application&gt;
</pre>
<p>Or, you can set the <code>fontSharpness</code> style using ActionScript, as seen in the following example:</p>
<p class="download"><a href="http://blog.flexexamples.com/wp-content/uploads/Label_fontSharpness_test/bin/srcview/source/main3.mxml.html">View MXML</a></p>
<pre class="code">
&lt;?xml version="1.0" encoding="utf-8"?&gt;
&lt;!-- http://blog.flexexamples.com/2008/08/21/setting-the-font-sharpness-for-a-label-control-in-flex/ --&gt;
&lt;mx:Application name="Label_fontSharpness_test"
        xmlns:mx="http://www.adobe.com/2006/mxml"
        layout="vertical"
        verticalAlign="middle"
        backgroundColor="white"&gt;

    &lt;mx:Style&gt;
        @font-face {
            src: local("Arial");
            fontFamily: ArialEmbedded;
        }

        @font-face {
            src: local("Base 02");
            fontFamily: Base02Embedded;
        }

        .myLabel {
            fontAntiAliasType: advanced;
            fontFamily: ArialEmbedded;
            fontSize: 16;
        }
    &lt;/mx:Style&gt;

    &lt;mx:Script&gt;
        &lt;![CDATA[
            import mx.events.ListEvent;
            import mx.events.SliderEvent;

            private function comboBox_change(evt:ListEvent):void {
                lbl.setStyle("fontFamily", comboBox.selectedItem);
            }

            private function slider_change(evt:SliderEvent):void {
                lbl.setStyle("fontSharpness", evt.value);
            }
        ]]&gt;
    &lt;/mx:Script&gt;

    &lt;mx:ApplicationControlBar dock="true"&gt;
        &lt;mx:Form styleName="plain"&gt;
            &lt;mx:FormItem label="fontFamily:"&gt;
                &lt;mx:ComboBox id="comboBox"
                        dataProvider="[ArialEmbedded,Base02Embedded]"
                        change="comboBox_change(event);" /&gt;
            &lt;/mx:FormItem&gt;
            &lt;mx:FormItem label="fontSharpness:" direction="horizontal"&gt;
                &lt;mx:HSlider id="slider"
                        minimum="-400"
                        maximum="400"
                        value="0"
                        snapInterval="10"
                        tickInterval="50"
                        liveDragging="true"
                        change="slider_change(event);" /&gt;
                &lt;mx:Label text="{slider.value}" /&gt;
            &lt;/mx:FormItem&gt;
        &lt;/mx:Form&gt;
    &lt;/mx:ApplicationControlBar&gt;

    &lt;mx:Label id="lbl"
            text="The quick brown fox jumped over the lazy dog."
            styleName="myLabel" /&gt;

&lt;/mx:Application&gt;
</pre>
<p class="alert">Base 02 font by <a href="http://www.stereo-type.net/">www.stereo-type.net</a>.</p>
<div class="evernoteSiteMemory"><a href="javascript:" onclick="Evernote.doClip({title: 'Setting the font sharpness for a Label control in Flex on FlexExamples.com',url: 'http://blog.flexexamples.com/2008/08/21/setting-the-font-sharpness-for-a-label-control-in-flex/',contentID: 'post-756',code: 'Pete9667',suggestNotebook: 'FlexExamples',suggestTags: 'fontAntiAliasType,fontSharpness',providerName: 'FlexExamples.com',styling: 'text' });return false" class="evernoteSiteMemoryLink"><img src="http://static.evernote.com/article-clipper-remember.png" class="evernoteSiteMemoryButton" />
				</a>				<div class="evernoteSiteMemoryClear">&nbsp;</div>
</div>]]></content:encoded>
			<wfw:commentRss>http://blog.flexexamples.com/2008/08/21/setting-the-font-sharpness-for-a-label-control-in-flex/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Setting the font thickness for a Label control in Flex</title>
		<link>http://blog.flexexamples.com/2008/08/21/setting-the-font-thickness-for-a-label-control-in-flex/</link>
		<comments>http://blog.flexexamples.com/2008/08/21/setting-the-font-thickness-for-a-label-control-in-flex/#comments</comments>
		<pubDate>Fri, 22 Aug 2008 05:18:13 +0000</pubDate>
		<dc:creator>Peter deHaan</dc:creator>
				<category><![CDATA[Label]]></category>
		<category><![CDATA[fontAntiAliasType]]></category>
		<category><![CDATA[fontThickness]]></category>

		<guid isPermaLink="false">http://blog.flexexamples.com/2008/08/21/setting-the-font-thickness-for-a-label-control-in-flex/</guid>
		<description><![CDATA[<p>The following example shows how you can set the font thickness on a Flex Label control by setting the fontThickness and fontAntiAliasType styles.</p> <p></p> <p class="download"><a href="http://blog.flexexamples.com/wp-content/uploads/Label_fontThickness_test/bin/srcview/source/main.mxml.html">View MXML</a></p> &#60;?xml version="1.0" encoding="utf-8"?&#62; &#60;!-- http://blog.flexexamples.com/2008/08/21/setting-the-font-thickness-for-a-label-control-in-flex/ --&#62; &#60;mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="vertical" verticalAlign="middle" backgroundColor="white"&#62; &#60;mx:Style&#62; @font-face { src: local("Base 02"); fontFamily: Base02Embedded; } &#60;/mx:Style&#62; &#60;mx:ApplicationControlBar dock="true"&#62; &#60;mx:Form styleName="plain"&#62; &#60;mx:FormItem label="fontThickness:" [...]]]></description>
			<content:encoded><![CDATA[<p>The following example shows how you can set the font thickness on a Flex Label control by setting the <code>fontThickness</code> and <code>fontAntiAliasType</code> styles.</p>
<p><span id="more-755"></span></p>
<p class="download"><a href="http://blog.flexexamples.com/wp-content/uploads/Label_fontThickness_test/bin/srcview/source/main.mxml.html">View MXML</a></p>
<pre class="code">
&lt;?xml version="1.0" encoding="utf-8"?&gt;
&lt;!-- http://blog.flexexamples.com/2008/08/21/setting-the-font-thickness-for-a-label-control-in-flex/ --&gt;
&lt;mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
        layout="vertical"
        verticalAlign="middle"
        backgroundColor="white"&gt;

    &lt;mx:Style&gt;
        @font-face {
            src: local("Base 02");
            fontFamily: Base02Embedded;
        }
    &lt;/mx:Style&gt;

    &lt;mx:ApplicationControlBar dock="true"&gt;
        &lt;mx:Form styleName="plain"&gt;
            &lt;mx:FormItem label="fontThickness:" direction="horizontal"&gt;
                &lt;mx:HSlider id="slider"
                        minimum="-200"
                        maximum="200"
                        value="0"
                        snapInterval="10"
                        tickInterval="20"
                        liveDragging="true" /&gt;
                &lt;mx:Label text="{slider.value}" /&gt;
            &lt;/mx:FormItem&gt;
        &lt;/mx:Form&gt;
    &lt;/mx:ApplicationControlBar&gt;

    &lt;mx:Label id="lbl"
            text="The quick brown fox jumped over the lazy dog."
            fontFamily="Base02Embedded"
            fontSize="16"
            fontAntiAliasType="advanced"
            fontThickness="{slider.value}" /&gt;

&lt;/mx:Application&gt;
</pre>
<p class="information"><a href="http://blog.flexexamples.com/wp-content/uploads/Label_fontThickness_test/bin/srcview/index.html">View source</a> is enabled in the following example.</p>
<p><iframe src="http://blog.flexexamples.com/wp-content/uploads/Label_fontThickness_test/bin/main.html" width="100%" height="150"></iframe></p>
<p>You can also set the <code>fontThickness</code> style using an external .CSS file or &lt;mx:Style /&gt; block, as seen in the following example:</p>
<p class="download"><a href="http://blog.flexexamples.com/wp-content/uploads/Label_fontThickness_test/bin/srcview/source/main2.mxml.html">View MXML</a></p>
<pre class="code">
&lt;?xml version="1.0" encoding="utf-8"?&gt;
&lt;!-- http://blog.flexexamples.com/2008/08/21/setting-the-font-thickness-for-a-label-control-in-flex/ --&gt;
&lt;mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
        layout="vertical"
        verticalAlign="middle"
        backgroundColor="white"&gt;

    &lt;mx:Style&gt;
        @font-face {
            src: local("Base 02");
            fontFamily: Base02Embedded;
        }

        Label {
            fontAntiAliasType: advanced;
            fontFamily: Base02Embedded;
            fontSize: 16;
            fontThickness: -200;
        }
    &lt;/mx:Style&gt;

    &lt;mx:Label id="lbl"
            text="The quick brown fox jumped over the lazy dog." /&gt;

&lt;/mx:Application&gt;
</pre>
<p>Or, you can set the <code>fontThickness</code> style using ActionScript, as seen in the following example:</p>
<p class="download"><a href="http://blog.flexexamples.com/wp-content/uploads/Label_fontThickness_test/bin/srcview/source/main3.mxml.html">View MXML</a></p>
<pre class="code">
&lt;?xml version="1.0" encoding="utf-8"?&gt;
&lt;!-- http://blog.flexexamples.com/2008/08/21/setting-the-font-thickness-for-a-label-control-in-flex/ --&gt;
&lt;mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
        layout="vertical"
        verticalAlign="middle"
        backgroundColor="white"&gt;

    &lt;mx:Style&gt;
        @font-face {
            src: local("Base 02");
            fontFamily: Base02Embedded;
        }
    &lt;/mx:Style&gt;

    &lt;mx:Script&gt;
        &lt;![CDATA[
            import mx.events.SliderEvent;

            private function slider_change(evt:SliderEvent):void {
                lbl.setStyle("fontThickness", evt.value);
            }
        ]]&gt;
    &lt;/mx:Script&gt;

    &lt;mx:ApplicationControlBar dock="true"&gt;
        &lt;mx:Form styleName="plain"&gt;
            &lt;mx:FormItem label="fontThickness:" direction="horizontal"&gt;
                &lt;mx:HSlider id="slider"
                        minimum="-200"
                        maximum="200"
                        value="0"
                        snapInterval="10"
                        tickInterval="20"
                        liveDragging="true"
                        change="slider_change(event);" /&gt;
                &lt;mx:Label text="{slider.value}" /&gt;
            &lt;/mx:FormItem&gt;
        &lt;/mx:Form&gt;
    &lt;/mx:ApplicationControlBar&gt;

    &lt;mx:Label id="lbl"
            text="The quick brown fox jumped over the lazy dog."
            fontFamily="Base02Embedded"
            fontSize="16"
            fontAntiAliasType="advanced" /&gt;

&lt;/mx:Application&gt;
</pre>
<p class="alert">Base 02 font by <a href="http://www.stereo-type.net/">www.stereo-type.net</a>.</p>
<div class="evernoteSiteMemory"><a href="javascript:" onclick="Evernote.doClip({title: 'Setting the font thickness for a Label control in Flex on FlexExamples.com',url: 'http://blog.flexexamples.com/2008/08/21/setting-the-font-thickness-for-a-label-control-in-flex/',contentID: 'post-755',code: 'Pete9667',suggestNotebook: 'FlexExamples',suggestTags: 'fontAntiAliasType,fontThickness',providerName: 'FlexExamples.com',styling: 'text' });return false" class="evernoteSiteMemoryLink"><img src="http://static.evernote.com/article-clipper-remember.png" class="evernoteSiteMemoryButton" />
				</a>				<div class="evernoteSiteMemoryClear">&nbsp;</div>
</div>]]></content:encoded>
			<wfw:commentRss>http://blog.flexexamples.com/2008/08/21/setting-the-font-thickness-for-a-label-control-in-flex/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Setting a font&#8217;s anti-alias type, sharpness, thickness and grid fit type in Flex</title>
		<link>http://blog.flexexamples.com/2007/10/24/setting-a-fonts-anti-alias-type-sharpness-thickness-and-grid-fit-type-in-flex/</link>
		<comments>http://blog.flexexamples.com/2007/10/24/setting-a-fonts-anti-alias-type-sharpness-thickness-and-grid-fit-type-in-flex/#comments</comments>
		<pubDate>Thu, 25 Oct 2007 03:43:45 +0000</pubDate>
		<dc:creator>Peter deHaan</dc:creator>
				<category><![CDATA[Fonts]]></category>
		<category><![CDATA[fontAntiAliasType]]></category>
		<category><![CDATA[fontGridFitType]]></category>
		<category><![CDATA[fontSharpness]]></category>
		<category><![CDATA[fontThickness]]></category>

		<guid isPermaLink="false">http://blog.flexexamples.com/2007/10/24/setting-a-fonts-anti-alias-type-sharpness-thickness-and-grid-fit-type-in-flex/</guid>
		<description><![CDATA[<p>The following example shows you how to change an embedded font&#8217;s appearance by setting the fontAntiAliasType style, fontSharpness style, fontThickness style, and fontGridFitType style.</p> <p>Full code after the jump.</p> <p></p> <p class="download"><a href="http://blog.flexexamples.com/wp-content/uploads/Label_fontAntiAliasType_test/main.mxml">View MXML</a></p> &#60;?xml version="1.0" encoding="utf-8"?&#62; &#60;!-- http://blog.flexexamples.com/2007/10/24/setting-a-fonts-anti-alias-type-sharpness-thickness-and-grid-fit-type-in-flex/ --&#62; &#60;mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="vertical" verticalAlign="middle" backgroundColor="white"&#62; &#60;mx:Style&#62; @font-face { src: local("Arial"); fontFamily: "ArialEmbedded"; } Label { [...]]]></description>
			<content:encoded><![CDATA[<p>The following example shows you how to change an embedded font&#8217;s appearance by setting the <code>fontAntiAliasType</code> style, <code>fontSharpness</code> style, <code>fontThickness</code> style, and <code>fontGridFitType</code> style.</p>
<p>Full code after the jump.</p>
<p><span id="more-252"></span></p>
<p class="download"><a href="http://blog.flexexamples.com/wp-content/uploads/Label_fontAntiAliasType_test/main.mxml">View MXML</a></p>
<pre class="code">
&lt;?xml version="1.0" encoding="utf-8"?&gt;
&lt;!-- http://blog.flexexamples.com/2007/10/24/setting-a-fonts-anti-alias-type-sharpness-thickness-and-grid-fit-type-in-flex/ --&gt;
&lt;mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
        layout="vertical"
        verticalAlign="middle"
        backgroundColor="white"&gt;

    &lt;mx:Style&gt;
        @font-face {
            src: local("Arial");
            fontFamily: "ArialEmbedded";
        }

        Label {
            fontFamily: ArialEmbedded;
        }
    &lt;/mx:Style&gt;

    &lt;mx:Array id="antiAliasTypes"&gt;
        &lt;mx:Object label="normal" /&gt;
        &lt;mx:Object label="advanced" /&gt;
    &lt;/mx:Array&gt;

    &lt;mx:Array id="gridFitTypes"&gt;
        &lt;mx:Object label="none" /&gt;
        &lt;mx:Object label="pixel" /&gt;
        &lt;mx:Object label="subpixel" /&gt;
    &lt;/mx:Array&gt;

    &lt;mx:Boolean id="isAdvanced"&gt;
        {antiAliasTypeComboBox.selectedIndex == 1}
    &lt;/mx:Boolean&gt;

    &lt;mx:ApplicationControlBar dock="true"&gt;
        &lt;mx:Form&gt;
            &lt;mx:FormItem label="fontSize:"&gt;
                &lt;mx:HSlider id="sizeSlider"
                        minimum="6"
                        maximum="24"
                        value="10"
                        liveDragging="true"
                        snapInterval="1"
                        tickInterval="1" /&gt;
            &lt;/mx:FormItem&gt;
            &lt;mx:FormItem label="rotation:"&gt;
                &lt;mx:HSlider id="rotationSlider"
                        minimum="-3"
                        maximum="3"
                        value="0"
                        liveDragging="true"
                        snapInterval="0.1"
                        tickInterval="1" /&gt;
            &lt;/mx:FormItem&gt;
            &lt;mx:FormItem label="fontAntiAliasType:"&gt;
                &lt;mx:ComboBox id="antiAliasTypeComboBox"
                        dataProvider="{antiAliasTypes}" /&gt;
            &lt;/mx:FormItem&gt;
            &lt;mx:FormItem label="fontSharpness:"
                    enabled="{isAdvanced}"&gt;
                &lt;mx:HSlider id="sharpnessSlider"
                        minimum="-400"
                        maximum="400"
                        value="0"
                        liveDragging="true"
                        snapInterval="1"
                        tickInterval="20" /&gt;
            &lt;/mx:FormItem&gt;
            &lt;mx:FormItem label="fontThickness:"
                    enabled="{isAdvanced}"&gt;
                &lt;mx:HSlider id="thicknessSlider"
                        minimum="-200"
                        maximum="200"
                        value="0"
                        liveDragging="true"
                        snapInterval="1"
                        tickInterval="10" /&gt;
            &lt;/mx:FormItem&gt;
            &lt;mx:FormItem label="fontGridFitType:"
                    enabled="{isAdvanced}"&gt;
                &lt;mx:ComboBox id="gridFitTypeComboBox"
                        dataProvider="{gridFitTypes}" /&gt;
            &lt;/mx:FormItem&gt;
        &lt;/mx:Form&gt;
    &lt;/mx:ApplicationControlBar&gt;

    &lt;mx:Label id="lbl"
            text="The quick brown fox jumped over the lazy dog."
            fontSize="{sizeSlider.value}"
            fontAntiAliasType="{antiAliasTypeComboBox.selectedItem.label}"
            fontSharpness="{sharpnessSlider.value}"
            fontThickness="{thicknessSlider.value}"
            fontGridFitType="{gridFitTypeComboBox.selectedItem.label}"
            rotation="{rotationSlider.value}"
            truncateToFit="false" /&gt;

&lt;/mx:Application&gt;
</pre>
<p class="information"><a href="http://blog.flexexamples.com/wp-content/uploads/Label_fontAntiAliasType_test/bin/srcview/index.html">View source</a> is enabled in the following example.</p>
<p><iframe src="http://blog.flexexamples.com/wp-content/uploads/Label_fontAntiAliasType_test/bin/main.html" width="100%" height="300"></iframe></p>
<div class="evernoteSiteMemory"><a href="javascript:" onclick="Evernote.doClip({title: 'Setting a font\&#039;s anti-alias type, sharpness, thickness and grid fit type in Flex on FlexExamples.com',url: 'http://blog.flexexamples.com/2007/10/24/setting-a-fonts-anti-alias-type-sharpness-thickness-and-grid-fit-type-in-flex/',contentID: 'post-252',code: 'Pete9667',suggestNotebook: 'FlexExamples',suggestTags: 'fontAntiAliasType,fontGridFitType,fontSharpness,fontThickness',providerName: 'FlexExamples.com',styling: 'text' });return false" class="evernoteSiteMemoryLink"><img src="http://static.evernote.com/article-clipper-remember.png" class="evernoteSiteMemoryButton" />
				</a>				<div class="evernoteSiteMemoryClear">&nbsp;</div>
</div>]]></content:encoded>
			<wfw:commentRss>http://blog.flexexamples.com/2007/10/24/setting-a-fonts-anti-alias-type-sharpness-thickness-and-grid-fit-type-in-flex/feed/</wfw:commentRss>
		<slash:comments>8</slash:comments>
		</item>
		<item>
		<title>Specifying certain unicode-ranges for embedded fonts</title>
		<link>http://blog.flexexamples.com/2007/08/07/specifying-certain-unicode-ranges-for-embedded-fonts/</link>
		<comments>http://blog.flexexamples.com/2007/08/07/specifying-certain-unicode-ranges-for-embedded-fonts/#comments</comments>
		<pubDate>Wed, 08 Aug 2007 05:15:44 +0000</pubDate>
		<dc:creator>Peter deHaan</dc:creator>
				<category><![CDATA[Embed]]></category>
		<category><![CDATA[Fonts]]></category>
		<category><![CDATA[@font face]]></category>
		<category><![CDATA[easing]]></category>
		<category><![CDATA[fontAntiAliasType]]></category>
		<category><![CDATA[unicode range]]></category>

		<guid isPermaLink="false">http://blog.flexexamples.com/2007/08/07/specifying-certain-unicode-ranges-for-embedded-fonts/</guid>
		<description><![CDATA[<p>In a previous post (&#8220;<a href="http://blog.flexexamples.com/2007/08/06/embedding-and-animating-fonts-in-a-flex-application/">Embedding and animating fonts in a Flex application</a>&#8220;), we looked at embedding a font in a Flex application so we could animate, rotate, and set the alpha for a Text control. Well, as we learnt, sometimes embedding a whole font face can dramatically increase the size of the final SWF [...]]]></description>
			<content:encoded><![CDATA[<p>In a previous post (&#8220;<a href="http://blog.flexexamples.com/2007/08/06/embedding-and-animating-fonts-in-a-flex-application/">Embedding and animating fonts in a Flex application</a>&#8220;), we looked at embedding a font in a Flex application so we could animate, rotate, and set the alpha for a Text control. Well, as we learnt, sometimes embedding a whole font face can dramatically increase the size of the final SWF output. In this post we&#8217;ll look at only specifying a certain range of characters for an embedded font, which will help reduce file sizes.</p>
<p>Full code after the jump.</p>
<p><span id="more-66"></span></p>
<p>Before we get too far, we&#8217;ll quickly look at some of the font basics. If you&#8217;re a Windows user, a good place to start is with the Character Map application. Its a little Window&#8217;s utility that gets installed on most modern operating systems and lets you quickly browse a font&#8217;s supported characters, different character sets, filter characters by Unicode subranges, search for certain characters (such as &copy; or &reg;), see a characters Unicode value as well as character code. It also lets you quickly copy certain characters to the clipboard for easy copy-pasting between applications. Because I can never remember where the application gets installed, or where to find its icon, it is usually just easiest to type &#8220;charmap&#8221; from a command prompt. If you have a modern-day keyboard, hit Windows+R to bring up the Run dialog, type &#8220;charmap&#8221;, hit Enter, and get ready to be amazed! Most of the features I mentioned before are cleverly hidden behind the &#8220;Advanced view&#8221; checkbox, so if you&#8217;re feeling up to the challenge check that checkbox to go to advanced view, otherwise the basic view will do just fine for now. At the top of the Character Map application is a Font drop down menu which lists all the fonts you currently have installed on your system. If you just downloaded a TrueType font (TTF) and didn&#8217;t install it into the Fonts directory (C:\Windows\Fonts by default), it won&#8217;t be listed here. Don&#8217;t worry if your specific font isn&#8217;t listed here, it isn&#8217;t the end of the world. Select any old font and click around.</p>
<p>If you want to embed the numbers 0-9, you would click on &#8220;0&#8243; and note it&#8217;s Unicode value (U+0030), then click on &#8220;9&#8243; and do the same (U+0039). Now, in your Flex application, you would specify this range in the @font-family style block like so:</p>
<pre class="code">
unicode-range: U+0030-U+0039;
</pre>
<p>If you wanted to specify multiple ranges, you would just separate them with commas:</p>
<pre class="code">
unicode-range:
    U+0030-U+0039, /* 0-9 */
    U+0041-U+0051, /* Uppercase A-Z */
    U+0052-U+007A; /* Lowercase a-z */
</pre>
<p>And if you just want to embed the whole range of all uppercase, lowercase, punctuation, and symbols, you could just specify the following unicode range:</p>
<pre class="code">
@font-face {
    src: url('assets/base02.ttf');
    font-family: Base02;
    unicode-range: U+0021-U+007B; /* whole range of uppercase, lowercase, symbols and punctuation. */
}
</pre>
<p>Again, use the character map if you want to find additional character such as the copyright symbol (&#0169;) or other symbols.</p>
<p class="alert">Remember, all fonts may not include special &#8220;extended&#8221; characters such as copyright symbols, dollar signs, fractions, pound signs, euro signs, etc. Make sure you check that your font includes the characters you need.</p>
<p>Now, with that out of the way, lets look at a full sample of unicode-range embedding in action!</p>
<p class="download"><a href="http://blog.flexexamples.com/wp-content/uploads/Font_antiAliasType_test_2/main1.mxml">View MXML</a></p>
<pre class="code" lang="actionscript">
&lt;?xml version="1.0" encoding="utf-8"?&gt;
&lt;!-- http://blog.flexexamples.com/2007/08/07/specifying-certain-unicode-ranges-for-embedded-fonts/ --&gt;
&lt;mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
        layout="vertical"
        verticalAlign="middle"
        backgroundColor="white"&gt;

    &lt;mx:Script&gt;
        &lt;![CDATA[
            /* Import all the easing classes so its
               easier to switch between them on the
               fly without tweaking import statements. */
            import mx.effects.easing.*;
        ]]&gt;
    &lt;/mx:Script&gt;

    &lt;mx:Style&gt;
        @font-face {
            src: url('assets/base02.ttf');
            font-family: Base02;
            unicode-range: U+0021-U+007B; /* whole range of uppercase, lowercase, symbols and punctuation. */
        }

        .MyEmbeddedFont {
            font-family: Base02;
            font-size: 14px;
        }
    &lt;/mx:Style&gt;

    &lt;!-- Set zoom effect for 2.5 seconds (2500 milliseconds) and use the Elastic.easeOut easing method. --&gt;
    &lt;mx:Zoom id="zoom" duration="2500" easingFunction="Elastic.easeOut" target="{embeddedText}" /&gt;

    &lt;!-- Use advanced font anti-aliasing for the embedded font, set the rotation to 5 degrees, alpha to 80% and loop the animation. --&gt;
    &lt;mx:Text id="embeddedText" text="The quick brown fox jumped over the lazy dog." styleName="MyEmbeddedFont" rotation="5" alpha="0.8" fontAntiAliasType="advanced" creationComplete="zoom.play();" effectEnd="zoom.play()" /&gt;

&lt;/mx:Application&gt;
</pre>
<p>Shocking? No, not really, because we saw the new unicode-range style earlier in the pre-code discussion. But what kind of filesize savings did we encounter by only embedding a &#8220;small range&#8221; of characters? Well, in this case, none really. The Base02 font really only has the regular letters, numbers, punctuation and symbols to begin with, so our SWF size is still ~260 KB, same as the previous article where we didn&#8217;t specify a range at all.</p>
<p>But what if we only specify the exact characters that we need, the uppercase &#8220;T&#8221;, full range of lowercase letters and the period? Well, as luck has it, I did just that:</p>
<p class="download"><a href="http://blog.flexexamples.com/wp-content/uploads/Font_antiAliasType_test_2/main2.mxml">View MXML</a></p>
<pre class="code" lang="actionscript">
&lt;?xml version="1.0" encoding="utf-8"?&gt;
&lt;!-- http://blog.flexexamples.com/2007/08/07/specifying-certain-unicode-ranges-for-embedded-fonts/ --&gt;
&lt;mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
        layout="vertical"
        verticalAlign="middle"
        backgroundColor="white"&gt;

    &lt;mx:Script&gt;
        &lt;![CDATA[
            /* Import all the easing classes so its
               easier to switch between them on the
               fly without tweaking import statements. */
            import mx.effects.easing.*;
        ]]&gt;
    &lt;/mx:Script&gt;

    &lt;mx:Style&gt;
        @font-face {
            src: url('assets/base02.ttf');
            font-family: Base02;
            unicode-range:
                U+0054-U+0054, /* T */
                U+0061-U+007A, /* a-z */
                U+002E-U+002E; /* . (period) */
        }

        .MyEmbeddedFont {
            font-family: Base02;
            font-size: 14px;
        }
    &lt;/mx:Style&gt;

    &lt;!-- Set zoom effect for 2.5 seconds (2500 milliseconds) and use the Elastic.easeOut easing method. --&gt;
    &lt;mx:Zoom id="zoom" duration="2500" easingFunction="Elastic.easeOut" target="{embeddedText}" /&gt;

    &lt;!-- Use advanced font anti-aliasing for the embedded font, set the rotation to 5 degrees, alpha to 80% and loop the animation. --&gt;
    &lt;mx:Text id="embeddedText" text="The quick brown fox jumped over the lazy dog." styleName="MyEmbeddedFont" rotation="5" alpha="0.8" fontAntiAliasType="advanced" creationComplete="zoom.play();" effectEnd="zoom.play()" /&gt;

&lt;/mx:Application&gt;
</pre>
<p>Yeah, the same big snippet for a minor little tweak, but hey. I&#8217;m sure it makes somebody&#8217;s life easier if they can grab all the code in one place instead of copying from two sources.</p>
<p>So, with the bare minimum of characters embedded, what is the new file size of the SWF? My main SWF file is now down to 193 KB (down from ~260 KB), which is about 74% of its original size, and only 46 KB larger than the same example without any embedded font. Not too bad for a tiny bit of work! Of course, its pretty easy when you know exactly which characters are used. If we were using the font for multiple text fields or a TextInput/TextArea control you would probably need to embed the whole range of characters since you couldn&#8217;t be sure of what the user would be entering.</p>
<p class="information">View source is enabled in the following example.</p>
<p><iframe src="http://blog.flexexamples.com/wp-content/uploads/Font_antiAliasType_test_2/bin/main.html" width="100%" height="200"></iframe></p>
<p class="alert">Base 02 font by <a href="http://www.stereo-type.net/">www.stereo-type.net</a>.</p>
<div class="evernoteSiteMemory"><a href="javascript:" onclick="Evernote.doClip({title: 'Specifying certain unicode-ranges for embedded fonts on FlexExamples.com',url: 'http://blog.flexexamples.com/2007/08/07/specifying-certain-unicode-ranges-for-embedded-fonts/',contentID: 'post-66',code: 'Pete9667',suggestNotebook: 'FlexExamples',suggestTags: '@font face,easing,fontAntiAliasType,unicode range',providerName: 'FlexExamples.com',styling: 'text' });return false" class="evernoteSiteMemoryLink"><img src="http://static.evernote.com/article-clipper-remember.png" class="evernoteSiteMemoryButton" />
				</a>				<div class="evernoteSiteMemoryClear">&nbsp;</div>
</div>]]></content:encoded>
			<wfw:commentRss>http://blog.flexexamples.com/2007/08/07/specifying-certain-unicode-ranges-for-embedded-fonts/feed/</wfw:commentRss>
		<slash:comments>8</slash:comments>
		</item>
		<item>
		<title>Embedding and animating fonts in a Flex application</title>
		<link>http://blog.flexexamples.com/2007/08/06/embedding-and-animating-fonts-in-a-flex-application/</link>
		<comments>http://blog.flexexamples.com/2007/08/06/embedding-and-animating-fonts-in-a-flex-application/#comments</comments>
		<pubDate>Tue, 07 Aug 2007 05:58:28 +0000</pubDate>
		<dc:creator>Peter deHaan</dc:creator>
				<category><![CDATA[Embed]]></category>
		<category><![CDATA[Fonts]]></category>
		<category><![CDATA[Zoom]]></category>
		<category><![CDATA[@font face]]></category>
		<category><![CDATA[easing]]></category>
		<category><![CDATA[fontAntiAliasType]]></category>

		<guid isPermaLink="false">http://blog.flexexamples.com/2007/08/06/embedding-and-animating-fonts-in-a-flex-application/</guid>
		<description><![CDATA[<p>I meant to post this earlier, and I already touched on font embedding in an earlier post (<a href="http://blog.flexexamples.com/2007/08/05/building-a-basic-controller-for-the-videodisplay-control/">Building a basic controller for the VideoDisplay control</a>), but here&#8217;s a quick little way to embed a font in a Flex application.</p> <p>In this example we embed a font (the awesome &#8220;Base 02&#8243; PC TrueType font (TTF) [...]]]></description>
			<content:encoded><![CDATA[<p>I meant to post this earlier, and I already touched on font embedding in an earlier post (<a href="http://blog.flexexamples.com/2007/08/05/building-a-basic-controller-for-the-videodisplay-control/">Building a basic controller for the VideoDisplay control</a>), but here&#8217;s a quick little way to embed a font in a Flex application.</p>
<p>In this example we embed a font (the awesome &#8220;Base 02&#8243; PC TrueType font (TTF) from <a href="http://www.stereo-type.net/">http://www.stereo-type.net/</a>), animate it using the Zoom effect and the Elastic.easeOut easing method. We also set the <code>rotation</code> and <code>alpha</code> properties (which you can&#8217;t do with non-embedded fonts), and we set the <code>fontAntiAliasType</code> to &#8220;advanced&#8221; to give the font a cleaner look. Finally we use the <code>effectEnd</code> event to loop the animation.</p>
<p><span id="more-62"></span></p>
<p class="download"><a href="http://blog.flexexamples.com/wp-content/uploads/Font_antiAliasType_test/main.mxml">View MXML</a></p>

<div class="wp_syntax"><div class="code"><pre class="mxml" style="font-family:monospace;"><span style="color: #000000;">&lt;?xml version=<span style="color: #ff0000;">&quot;1.0&quot;</span> encoding=<span style="color: #ff0000;">&quot;utf-8&quot;</span>?<span style="color: #7400FF;">&gt;</span></span>
<span style="color: #000000;"><span style="color: #808080; font-style: italic;">&lt;!-- http://blog.flexexamples.com/2007/08/06/embedding-and-animating-fonts-in-a-flex-application/ --&gt;</span></span>
<span style="color: #000000;"><span style="color: #7400FF;">&lt;mx:Application</span> name=<span style="color: #ff0000;">&quot;Font_antiAliasType_test&quot;</span></span>
<span style="color: #000000;">        xmlns:mx=<span style="color: #ff0000;">&quot;http://www.adobe.com/2006/mxml&quot;</span></span>
<span style="color: #000000;">        layout=<span style="color: #ff0000;">&quot;vertical&quot;</span></span>
<span style="color: #000000;">        verticalAlign=<span style="color: #ff0000;">&quot;middle&quot;</span></span>
<span style="color: #000000;">        backgroundColor=<span style="color: #ff0000;">&quot;white&quot;</span><span style="color: #7400FF;">&gt;</span></span>
&nbsp;
    <span style="color: #339933;">&lt;mx:Script&gt;</span>
<span style="color: #339933;">        &lt;![CDATA[</span>
<span style="color: #339933;">            /* Import all the easing classes so its easier to switch between</span>
<span style="color: #339933;">               them on the fly without tweaking import statements. */</span>
<span style="color: #339933;">            import mx.effects.easing.*;</span>
<span style="color: #339933;">        ]]&gt;</span>
<span style="color: #339933;">    &lt;/mx:Script&gt;</span>
&nbsp;
    <span style="color: #000000;"><span style="color: #7400FF;">&lt;mx:Style</span><span style="color: #7400FF;">&gt;</span></span>
        @font-face {
            src: url('assets/base02.ttf');
            font-family: Base02;
        }
&nbsp;
        .MyEmbeddedFont {
            font-family: Base02;
            font-size: 16px;
        }
    <span style="color: #000000;"><span style="color: #7400FF;">&lt;/mx:Style</span><span style="color: #7400FF;">&gt;</span></span>
&nbsp;
    <span style="color: #000000;"><span style="color: #808080; font-style: italic;">&lt;!-- Set zoom effect for 2.5 seconds (2500 milliseconds) and use the </span>
<span style="color: #000000;">         Elastic.easeOut easing method. --&gt;</span></span>
    <span style="color: #000000;"><span style="color: #7400FF;">&lt;mx:Zoom</span> id=<span style="color: #ff0000;">&quot;zoom&quot;</span></span>
<span style="color: #000000;">            duration=<span style="color: #ff0000;">&quot;2500&quot;</span></span>
<span style="color: #000000;">            easingFunction=<span style="color: #ff0000;">&quot;Elastic.easeOut&quot;</span></span>
<span style="color: #000000;">            target=<span style="color: #ff0000;">&quot;{embeddedText}&quot;</span> <span style="color: #7400FF;">/&gt;</span></span>
&nbsp;
    <span style="color: #000000;"><span style="color: #808080; font-style: italic;">&lt;!-- Use advanced font anti-aliasing for the embedded font, set the rotation</span>
<span style="color: #000000;">         to 5 degrees, alpha to 80% and loop the animation. --&gt;</span></span>
    <span style="color: #000000;"><span style="color: #7400FF;">&lt;mx:Text</span> id=<span style="color: #ff0000;">&quot;embeddedText&quot;</span></span>
<span style="color: #000000;">            text=<span style="color: #ff0000;">&quot;The quick brown fox jumped over the lazy dog.&quot;</span></span>
<span style="color: #000000;">            styleName=<span style="color: #ff0000;">&quot;MyEmbeddedFont&quot;</span></span>
<span style="color: #000000;">            rotation=<span style="color: #ff0000;">&quot;5&quot;</span></span>
<span style="color: #000000;">            alpha=<span style="color: #ff0000;">&quot;0.8&quot;</span></span>
<span style="color: #000000;">            fontAntiAliasType=<span style="color: #ff0000;">&quot;advanced&quot;</span></span>
<span style="color: #000000;">            creationComplete=<span style="color: #ff0000;">&quot;zoom.play();&quot;</span></span>
<span style="color: #000000;">            effectEnd=<span style="color: #ff0000;">&quot;zoom.play()&quot;</span> <span style="color: #7400FF;">/&gt;</span></span>
&nbsp;
<span style="color: #000000;"><span style="color: #7400FF;">&lt;/mx:Application</span><span style="color: #7400FF;">&gt;</span></span></pre></div></div>

<p class="information"><a href="http://blog.flexexamples.com/wp-content/uploads/Font_antiAliasType_test/bin/srcview/">View source</a> is enabled in the following example.</p>
<p><iframe src="http://blog.flexexamples.com/wp-content/uploads/Font_antiAliasType_test/bin/main.html" width="100%" height="200"></iframe></p>
<p class="alert">Base 02 font by <a href="http://www.stereo-type.net/">www.stereo-type.net</a>.</p>
<p class="alert">It is important to note that embedding fonts can dramatically increase the size of generated SWFs. The size of the SWF above is roughly 260 KB (the base02.ttf file (not included in the ZIP) on its own is 177 KB). By comparison, if embedded fonts were not used, the file size of the SWF would have been only 147 KB, although the rotation and alpha effects would not have been possible. In a future entry I&#8217;ll cover how to embed certain characters/ranges of a font-face to reduce the overall size.</p>
<div class="evernoteSiteMemory"><a href="javascript:" onclick="Evernote.doClip({title: 'Embedding and animating fonts in a Flex application on FlexExamples.com',url: 'http://blog.flexexamples.com/2007/08/06/embedding-and-animating-fonts-in-a-flex-application/',contentID: 'post-62',code: 'Pete9667',suggestNotebook: 'FlexExamples',suggestTags: '@font face,easing,fontAntiAliasType',providerName: 'FlexExamples.com',styling: 'text' });return false" class="evernoteSiteMemoryLink"><img src="http://static.evernote.com/article-clipper-remember.png" class="evernoteSiteMemoryButton" />
				</a>				<div class="evernoteSiteMemoryClear">&nbsp;</div>
</div>]]></content:encoded>
			<wfw:commentRss>http://blog.flexexamples.com/2007/08/06/embedding-and-animating-fonts-in-a-flex-application/feed/</wfw:commentRss>
		<slash:comments>11</slash:comments>
		</item>
	</channel>
</rss>

