<?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; load config</title>
	<atom:link href="http://blog.flexexamples.com/tag/load-config/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>Embedding local system fonts in Flex 4</title>
		<link>http://blog.flexexamples.com/2010/01/21/embedding-local-system-fonts-in-flex-4/</link>
		<comments>http://blog.flexexamples.com/2010/01/21/embedding-local-system-fonts-in-flex-4/#comments</comments>
		<pubDate>Thu, 21 Jan 2010 14:48:44 +0000</pubDate>
		<dc:creator>Peter deHaan</dc:creator>
				<category><![CDATA[beta2]]></category>
		<category><![CDATA[Fonts]]></category>
		<category><![CDATA[@font face]]></category>
		<category><![CDATA[Gumbo]]></category>
		<category><![CDATA[load config]]></category>
		<category><![CDATA[local()]]></category>

		<guid isPermaLink="false">http://blog.flexexamples.com/?p=2311</guid>
		<description><![CDATA[<p>In a previous example, <a href="http://blog.flexexamples.com/2007/10/09/embedding-fonts-by-name-instead-of-location/">&#8220;Embedding fonts by name instead of location&#8221;</a>, we saw how you could embed a font in Flex by specifying the font name instead of a location by using the local() function instead of the src() function when embedding a font.</p> <p>The following example shows how you can load a system [...]]]></description>
			<content:encoded><![CDATA[<p>In a previous example, <a href="http://blog.flexexamples.com/2007/10/09/embedding-fonts-by-name-instead-of-location/">&#8220;Embedding fonts by name instead of location&#8221;</a>, we saw how you could  embed a font in Flex by specifying the font name instead of a location by using the <code>local()</code> function instead of the <code>src()</code> function when embedding a font.</p>
<p>The following example shows how you can load a system font in Flex 4 by specifying a custom Flex configuration file and specifying a local font path.</p>
<p>Full code after the jump.</p>
<p><span id="more-2311"></span></p>
<p class="alert">The following example(s) require Flash Player 10 and the Adobe Flex 4 SDK. To download the Adobe Flash Builder 4 trial, see <a href="http://bit.ly/crThlI">http://www.adobe.com/products/flex/</a>. To download the latest nightly build of the Flex 4 SDK, see <a href="http://bit.ly/Flex4SDK">http://opensource.adobe.com/wiki/display/flexsdk/Download+Flex+4</a>.<br/><strong>For more information on getting started with Flex 4 and Flash Builder 4, see the official <a href="http://bit.ly/dCkecm">Adobe Flex Team blog</a>.</strong></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/2010/01/21/embedding-local-system-fonts-in-flex-4/ --&gt;</span></span>
<span style="color: #000000;"><span style="color: #7400FF;">&lt;s:Application</span> name=<span style="color: #ff0000;">&quot;Spark_fontFace_local_test&quot;</span></span>
<span style="color: #000000;">               xmlns:fx=<span style="color: #ff0000;">&quot;http://ns.adobe.com/mxml/2009&quot;</span></span>
<span style="color: #000000;">               xmlns:s=<span style="color: #ff0000;">&quot;library://ns.adobe.com/flex/spark&quot;</span><span style="color: #7400FF;">&gt;</span></span>
&nbsp;
    <span style="color: #000000;"><span style="color: #808080; font-style: italic;">&lt;!-- -load-config+=local-font-config.xml --&gt;</span></span>
&nbsp;
    <span style="color: #000000;"><span style="color: #7400FF;">&lt;fx:Style</span><span style="color: #7400FF;">&gt;</span></span>
        @namespace s &quot;library://ns.adobe.com/flex/spark&quot;;
&nbsp;
        @font-face {
            src: local(&quot;Arial&quot;);
            fontFamily: &quot;MyFont&quot;;
            unicodeRange: U+0020-00FF;
        }
&nbsp;
        s|Label {
            fontFamily: &quot;MyFont&quot;;
            fontSize: 44;
        }
    <span style="color: #000000;"><span style="color: #7400FF;">&lt;/fx:Style</span><span style="color: #7400FF;">&gt;</span></span>
&nbsp;
    <span style="color: #000000;"><span style="color: #7400FF;">&lt;s:Label</span> id=<span style="color: #ff0000;">&quot;myLabel&quot;</span></span>
<span style="color: #000000;">            text=<span style="color: #ff0000;">&quot;Hello World&quot;</span></span>
<span style="color: #000000;">            rotation=<span style="color: #ff0000;">&quot;15&quot;</span></span>
<span style="color: #000000;">            horizontalCenter=<span style="color: #ff0000;">&quot;0&quot;</span> verticalCenter=<span style="color: #ff0000;">&quot;0&quot;</span> <span style="color: #7400FF;">/&gt;</span></span>
&nbsp;
<span style="color: #000000;"><span style="color: #7400FF;">&lt;/s:Application</span><span style="color: #7400FF;">&gt;</span></span></pre></div></div>

<p>Next we need to create a custom Flex config file (in this case <em>local-font-config.xml</em>, and save this file in your project&#8217;s /src/ folder) and specify a local font path, as seen in the following example:</p>

<div class="wp_syntax"><div class="code"><pre class="xml" style="font-family:monospace;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;?xml</span> <span style="color: #000066;">version</span>=<span style="color: #ff0000;">&quot;1.0&quot;</span> <span style="color: #000066;">encoding</span>=<span style="color: #ff0000;">&quot;utf-8&quot;</span><span style="color: #000000; font-weight: bold;">?&gt;</span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;flex-config<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;compiler<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;fonts<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
            <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;local-font-paths<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
                <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;path-element<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>C:/Temp/fonts<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/path-element<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
                <span style="color: #808080; font-style: italic;">&lt;!--&lt;path-element&gt;/System/Library/Fonts/&lt;/path-element&gt;--&gt;</span>
            <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/local-font-paths<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/fonts<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/compiler<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/flex-config<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></pre></div></div>

<p>In the previous config file, you specify a folder where the Flex compiler should look for &#8220;local&#8221; fonts. In this case I have a C:\Temp\fonts\ folder which has a series of subdirectories containing .TTF and .OTF fonts.</p>
<p>Finally, you need to specify the custom config file in Flash Builder&#8217;s project properties dialog box (for more information, see <a href="http://blog.flexexamples.com/2008/12/21/using-a-custom-flex-configxml-file-in-flex-builder-3/">&#8220;Using a custom flex-config.xml file in Flex Builder 3&#8243;</a>).</p>
<ol>
<li>Select Project &gt; Properties from Flex Builder&#8217;s main menu.</li>
<li>Select &#8220;Flex Compiler&#8221; from the left hand menu.</li>
<li>In the Additional compiler arguments text field add the following argument: <strong><em>-load-config+=local-font-config.xml</em></strong></li>
</ol>
<p class="alert">This entry is based on a beta version of the Flex 4 SDK and therefore is very likely to change as development of the Flex SDK continues. The API can (and will) change causing examples to possibly not compile in newer versions of the Flex 4 SDK.</p>
<div class="evernoteSiteMemory"><a href="javascript:" onclick="Evernote.doClip({title: 'Embedding local system fonts in Flex 4 on FlexExamples.com',url: 'http://blog.flexexamples.com/2010/01/21/embedding-local-system-fonts-in-flex-4/',contentID: 'post-2311',code: 'Pete9667',suggestNotebook: 'FlexExamples',suggestTags: '@font face,Gumbo,load config,local()',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/2010/01/21/embedding-local-system-fonts-in-flex-4/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Using a custom flex-config.xml file in Flex Builder 3</title>
		<link>http://blog.flexexamples.com/2008/12/21/using-a-custom-flex-configxml-file-in-flex-builder-3/</link>
		<comments>http://blog.flexexamples.com/2008/12/21/using-a-custom-flex-configxml-file-in-flex-builder-3/#comments</comments>
		<pubDate>Sun, 21 Dec 2008 20:19:49 +0000</pubDate>
		<dc:creator>Peter deHaan</dc:creator>
				<category><![CDATA[Compiler]]></category>
		<category><![CDATA[Flex Builder]]></category>
		<category><![CDATA[Flex Builder 3]]></category>
		<category><![CDATA[Fonts]]></category>
		<category><![CDATA[flex config.xml]]></category>
		<category><![CDATA[load config]]></category>
		<category><![CDATA[unicodeRange]]></category>

		<guid isPermaLink="false">http://blog.flexexamples.com/2008/12/21/using-a-custom-flex-configxml-file-in-flex-builder-3/</guid>
		<description><![CDATA[<p>The following example shows how you can use a custom configuration file in a Flex Builder Flex project by specifying an additional compiler argument, -load-config.</p> <p>Full code after the jump.</p> <p></p> <p class="download"><a href="http://blog.flexexamples.com/wp-content/uploads/LoadConfig_fonts_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/12/21/using-a-custom-flex-configxml-file-in-flex-builder-3/ --&#62; &#60;mx:Application name="LoadConfig_fonts_test" xmlns:mx="http://www.adobe.com/2006/mxml" layout="vertical" verticalAlign="middle" backgroundColor="white"&#62; &#60;mx:Style&#62; @font-face { src: url("assets/ARIAL.TTF"); fontFamily: "ArialEmbedded"; unicodeRange: [...]]]></description>
			<content:encoded><![CDATA[<p>The following example shows how you can use a custom configuration file in a Flex Builder Flex project by specifying an additional compiler argument, <code>-load-config</code>.</p>
<p>Full code after the jump.</p>
<p><span id="more-908"></span></p>
<p class="download"><a href="http://blog.flexexamples.com/wp-content/uploads/LoadConfig_fonts_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/12/21/using-a-custom-flex-configxml-file-in-flex-builder-3/ --&gt;
&lt;mx:Application name="LoadConfig_fonts_test"
        xmlns:mx="http://www.adobe.com/2006/mxml"
        layout="vertical"
        verticalAlign="middle"
        backgroundColor="white"&gt;

    &lt;mx:Style&gt;
        @font-face {
            src: url("assets/ARIAL.TTF");
            fontFamily: "ArialEmbedded";
            unicodeRange: "englishRange";
        }

        Text {
            fontFamily: "ArialEmbedded";
            fontSize: 32;
            color: red;
        }
    &lt;/mx:Style&gt;

    &lt;mx:ApplicationControlBar dock="true"&gt;
        &lt;mx:Form styleName="plain"&gt;
            &lt;mx:FormItem label="alpha:"&gt;
                &lt;mx:HSlider id="slider"
                        minimum="0.0"
                        maximum="1.0"
                        value="1.0"
                        snapInterval="0.05"
                        tickInterval="0.1"
                        liveDragging="true" /&gt;
            &lt;/mx:FormItem&gt;
        &lt;/mx:Form&gt;
    &lt;/mx:ApplicationControlBar&gt;

    &lt;mx:Text id="txt" width="300" alpha="{slider.value}"&gt;
        &lt;mx:text&gt;The quick brown fox jumps over the lazy dog. 1234567890 &#x00A9;&lt;/mx:text&gt;
    &lt;/mx:Text&gt;

&lt;/mx:Application&gt;
</pre>
<p>Next, create a custom configuration XML file named fontConfig.xml and save it in a /config/ subdirectory in your project&#8217;s /src/ directory. The folder structure isn&#8217;t important, but it helps keep the source code and configuration files separated. The fontConfig.xml file is a modified version of the flex-config.xml file found in the Flex SDK&#8217;s /frameworks/ directory. In this example we simply specify a single named font range which specifies a unicode range of U+0020 (<em>space</em>) to U+007E (~).</p>
<p class="download"><a href="">config/fontConfig.xml</a></p>
<pre class="code">
&lt;?xml version="1.0"?&gt;
&lt;flex-config&gt;
   &lt;compiler&gt;
      &lt;fonts&gt;
          &lt;!-- Defines ranges that can be used across multiple font-face declarations. --&gt;
          &lt;!-- See flash-unicode-table.xml for more examples. --&gt;
          &lt;languages&gt;
              &lt;language-range&gt;
                  &lt;lang&gt;englishRange&lt;/lang&gt;
                  &lt;range&gt;U+0020-U+007E&lt;/range&gt;
              &lt;/language-range&gt;
          &lt;/languages&gt;
      &lt;/fonts&gt;
   &lt;/compiler&gt;
&lt;/flex-config&gt;
</pre>
<p>Finally, in Flex Builder, right click on the Flex Project folder in the Flex Navigator and select Properties from the context menu. Select the Flex Compiler section of the dialog menu and in the <em>Additional compiler arguments:</em> text box add the following text:</p>
<blockquote><p>
-load-config+=config/fontConfig.xml
</p></blockquote>
<p><img src="http://blog.flexexamples.com/wp-content/uploads/LoadConfig_fonts_test/Figure1.jpg" /><br />
<strong>Figure 1.</strong> Additional compiler arguments.</p>
<p class="information"><a href="http://blog.flexexamples.com/wp-content/uploads/LoadConfig_fonts_test/bin/srcview/">View source</a> is enabled in the following example.</p>
<p><iframe src="http://blog.flexexamples.com/wp-content/uploads/LoadConfig_fonts_test/bin/main.html" width="100%" height="250"></iframe></p>
<div class="evernoteSiteMemory"><a href="javascript:" onclick="Evernote.doClip({title: 'Using a custom flex-config.xml file in Flex Builder 3 on FlexExamples.com',url: 'http://blog.flexexamples.com/2008/12/21/using-a-custom-flex-configxml-file-in-flex-builder-3/',contentID: 'post-908',code: 'Pete9667',suggestNotebook: 'FlexExamples',suggestTags: 'flex config.xml,load config,unicodeRange',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/12/21/using-a-custom-flex-configxml-file-in-flex-builder-3/feed/</wfw:commentRss>
		<slash:comments>14</slash:comments>
		</item>
	</channel>
</rss>

