<?xml version="1.0" encoding="UTF-8"?><!-- generator="wordpress/2.2.1" -->
<rss version="2.0" 
	xmlns:content="http://purl.org/rss/1.0/modules/content/">
<channel>
	<title>Comments on: Displaying different fonts in a dropdown menu on a ComboBox control in Flex</title>
	<link>http://blog.flexexamples.com/2008/07/31/displaying-different-fonts-in-a-dropdown-menu-on-a-combobox-control-in-flex/</link>
	<description>A bunch of examples for Adobe Flex and ActionScript</description>
	<pubDate>Thu, 08 Jan 2009 12:13:05 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.2.1</generator>

	<item>
		<title>By: Chris M</title>
		<link>http://blog.flexexamples.com/2008/07/31/displaying-different-fonts-in-a-dropdown-menu-on-a-combobox-control-in-flex/#comment-16447</link>
		<author>Chris M</author>
		<pubDate>Tue, 28 Oct 2008 16:38:09 +0000</pubDate>
		<guid>http://blog.flexexamples.com/2008/07/31/displaying-different-fonts-in-a-dropdown-menu-on-a-combobox-control-in-flex/#comment-16447</guid>
		<description>do you know how to get a combo box in a rich text editor to do this.  Trying to do it in AS3 not MXML.</description>
		<content:encoded><![CDATA[<p>do you know how to get a combo box in a rich text editor to do this.  Trying to do it in AS3 not MXML.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Chris</title>
		<link>http://blog.flexexamples.com/2008/07/31/displaying-different-fonts-in-a-dropdown-menu-on-a-combobox-control-in-flex/#comment-16381</link>
		<author>Chris</author>
		<pubDate>Thu, 23 Oct 2008 18:25:20 +0000</pubDate>
		<guid>http://blog.flexexamples.com/2008/07/31/displaying-different-fonts-in-a-dropdown-menu-on-a-combobox-control-in-flex/#comment-16381</guid>
		<description>I just figured this one out.  Make sure that if you embed a font, that every font used by the movie is embedded.  Because if flex tries to use a font that is not embedded, Flex will automatically switch to using system fonts.  IT WILL IGNORE YOUR EMBEDDED FONTS.

In my project, I was embedding 2 non-system fonts.  The Rich Text editor by default uses Verdana to display your text size, font, all the control components that belong to the Rich Text Editor...  And since I didn't embed Verdana, Flex ignored my embedded fonts, and forced the movie to use Verdana.  After I embedded the system font (Verdana) everything worked as expected.</description>
		<content:encoded><![CDATA[<p>I just figured this one out.  Make sure that if you embed a font, that every font used by the movie is embedded.  Because if flex tries to use a font that is not embedded, Flex will automatically switch to using system fonts.  IT WILL IGNORE YOUR EMBEDDED FONTS.</p>
<p>In my project, I was embedding 2 non-system fonts.  The Rich Text editor by default uses Verdana to display your text size, font, all the control components that belong to the Rich Text Editor&#8230;  And since I didn&#8217;t embed Verdana, Flex ignored my embedded fonts, and forced the movie to use Verdana.  After I embedded the system font (Verdana) everything worked as expected.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Chris</title>
		<link>http://blog.flexexamples.com/2008/07/31/displaying-different-fonts-in-a-dropdown-menu-on-a-combobox-control-in-flex/#comment-16305</link>
		<author>Chris</author>
		<pubDate>Mon, 20 Oct 2008 15:50:23 +0000</pubDate>
		<guid>http://blog.flexexamples.com/2008/07/31/displaying-different-fonts-in-a-dropdown-menu-on-a-combobox-control-in-flex/#comment-16305</guid>
		<description>Peter,

You are right, you cant' mix device and embedded fonts in a text field.  If I embed a device font like you did in your example, I get the same result, it works perfectly.  

But, if I use a compiled swf containing a whole fontfamily, or embed a true type or open type font, I can't get the fonts to render right.  I can assign a font like in the example below, but if I try to utilize the fontfamilyarray, you get a default font rendering.  The underlying html though, shows the correct font selection, the rendering in the RTE only doesn't show the right font.

I can get a font (AABIGFICTION) to work like this:
&lt;pre class="code"&gt;
&#60;mx:Style&#62;
	@font-face {
		src:url("AABIGFICTION.swf");
		fontFamily: "AABIGFICTION";
		}
		@font-face {
		src:url("Baskerville_Old_Face.swf");
		fontFamily: "Baskerville_Old_Face";
		}

&#60;/mx:Style&#62;

&#60;mx:Script&#62;
&#60;![CDATA[
private function returnHandler():void {	

RTE.fontFamilyArray = ["AABIGFICTION", "Baskerville_Old_Face"];
}
	]]&#62;
&#60;/mx:Script&#62;

&#60;mx:RichTextEditor id="RTE" title="Title" width="440" fontFamily="AABIGFICTION" height="368" creationComplete="returnHandler();"&#62;
&lt;/pre&gt;</description>
		<content:encoded><![CDATA[<p>Peter,</p>
<p>You are right, you cant&#8217; mix device and embedded fonts in a text field.  If I embed a device font like you did in your example, I get the same result, it works perfectly.  </p>
<p>But, if I use a compiled swf containing a whole fontfamily, or embed a true type or open type font, I can&#8217;t get the fonts to render right.  I can assign a font like in the example below, but if I try to utilize the fontfamilyarray, you get a default font rendering.  The underlying html though, shows the correct font selection, the rendering in the RTE only doesn&#8217;t show the right font.</p>
<p>I can get a font (AABIGFICTION) to work like this:</p>
<pre class="code">
&lt;mx:Style&gt;
	@font-face {
		src:url("AABIGFICTION.swf");
		fontFamily: "AABIGFICTION";
		}
		@font-face {
		src:url("Baskerville_Old_Face.swf");
		fontFamily: "Baskerville_Old_Face";
		}

&lt;/mx:Style&gt;

&lt;mx:Script&gt;
&lt;![CDATA[
private function returnHandler():void {	

RTE.fontFamilyArray = ["AABIGFICTION", "Baskerville_Old_Face"];
}
	]]&gt;
&lt;/mx:Script&gt;

&lt;mx:RichTextEditor id="RTE" title="Title" width="440" fontFamily="AABIGFICTION" height="368" creationComplete="returnHandler();"&gt;
</pre>
]]></content:encoded>
	</item>
	<item>
		<title>By: peterd</title>
		<link>http://blog.flexexamples.com/2008/07/31/displaying-different-fonts-in-a-dropdown-menu-on-a-combobox-control-in-flex/#comment-16304</link>
		<author>peterd</author>
		<pubDate>Mon, 20 Oct 2008 15:16:15 +0000</pubDate>
		<guid>http://blog.flexexamples.com/2008/07/31/displaying-different-fonts-in-a-dropdown-menu-on-a-combobox-control-in-flex/#comment-16304</guid>
		<description>Chris,

I don't believe you can mix embedded fonts and non-embedded fonts in a text field (but of course, I could be wrong). I did a quick test and it seems my text was disappearing after selecting some text and changing the font family.

That said, if I only use embedded fonts in the RichTextEditor, then this code seems to work:
&lt;pre class="code"&gt;
&#60;?xml version=&#34;1.0&#34; encoding=&#34;utf-8&#34;?&#62;
&#60;mx:Application xmlns:mx=&#34;http://www.adobe.com/2006/mxml&#34;&#62;

    &#60;mx:Style&#62;
        @font-face {
            src: local(&#34;Verdana&#34;);
            fontFamily: &#34;VerdanaEmbedded&#34;;
        }
        @font-face {
            src: local(&#34;Arial&#34;);
            fontFamily: &#34;ArialEmbedded&#34;;
        }
        @font-face {
            src: local(&#34;Comic Sans MS&#34;);
            fontFamily: &#34;ComicSansMSEmbedded&#34;;
        }
    &#60;/mx:Style&#62;

    &#60;mx:Script&#62;
        &#60;![CDATA[
            private function init():void {
                richTextEditor.fontFamilyArray = [&#34;VerdanaEmbedded&#34;, &#34;ArialEmbedded&#34;, &#34;ComicSansMSEmbedded&#34;];
            }
        ]]&#62;
    &#60;/mx:Script&#62;

    &#60;mx:RichTextEditor id=&#34;richTextEditor&#34;
            creationComplete=&#34;init();&#34; /&#62;

&#60;/mx:Application&#62;
&lt;/pre&gt;

Of course, since the RichTextEditor control allows users to change the text to bold or italic (or both), you'd want to embed the regular font face as well as the combination of bold, italic, and bold+italic font faces (so embed four font faces per font family).

Hope that helps,

Peter</description>
		<content:encoded><![CDATA[<p>Chris,</p>
<p>I don&#8217;t believe you can mix embedded fonts and non-embedded fonts in a text field (but of course, I could be wrong). I did a quick test and it seems my text was disappearing after selecting some text and changing the font family.</p>
<p>That said, if I only use embedded fonts in the RichTextEditor, then this code seems to work:</p>
<pre class="code">
&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt;
&lt;mx:Application xmlns:mx=&quot;http://www.adobe.com/2006/mxml&quot;&gt;

    &lt;mx:Style&gt;
        @font-face {
            src: local(&quot;Verdana&quot;);
            fontFamily: &quot;VerdanaEmbedded&quot;;
        }
        @font-face {
            src: local(&quot;Arial&quot;);
            fontFamily: &quot;ArialEmbedded&quot;;
        }
        @font-face {
            src: local(&quot;Comic Sans MS&quot;);
            fontFamily: &quot;ComicSansMSEmbedded&quot;;
        }
    &lt;/mx:Style&gt;

    &lt;mx:Script&gt;
        &lt;![CDATA[
            private function init():void {
                richTextEditor.fontFamilyArray = [&quot;VerdanaEmbedded&quot;, &quot;ArialEmbedded&quot;, &quot;ComicSansMSEmbedded&quot;];
            }
        ]]&gt;
    &lt;/mx:Script&gt;

    &lt;mx:RichTextEditor id=&quot;richTextEditor&quot;
            creationComplete=&quot;init();&quot; /&gt;

&lt;/mx:Application&gt;
</pre>
<p>Of course, since the RichTextEditor control allows users to change the text to bold or italic (or both), you&#8217;d want to embed the regular font face as well as the combination of bold, italic, and bold+italic font faces (so embed four font faces per font family).</p>
<p>Hope that helps,</p>
<p>Peter</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Chris</title>
		<link>http://blog.flexexamples.com/2008/07/31/displaying-different-fonts-in-a-dropdown-menu-on-a-combobox-control-in-flex/#comment-16300</link>
		<author>Chris</author>
		<pubDate>Mon, 20 Oct 2008 13:53:25 +0000</pubDate>
		<guid>http://blog.flexexamples.com/2008/07/31/displaying-different-fonts-in-a-dropdown-menu-on-a-combobox-control-in-flex/#comment-16300</guid>
		<description>Love the site, lots of good nuggets.

Building upon this topic, any ideas how to add an embedded font to a Rich Text Editor?  Not just assign the embedded font, but append multiple to the RTE.  I've always been able to push a &lt;code&gt;fontName&lt;/code&gt; to the &lt;code&gt;fontFamilyArray&lt;/code&gt;, but the font never renders in the RTE, I always get a default font to render.

Example:
&lt;pre class="code"&gt;
&#60;mx:Style&#62;
    @font-face {
        src:url("AABIGFICTION.swf");
        fontFamily: "AABIGFICTION";
    }
&#60;/mx:Style&#62;

&#60;mx:Script&#62;
    RTE.fontFamilyArray.push('AABIGFICTION');
&#60;/mx:Script&#62;

&#60;mx:RichTextEditor fontAntiAliasType="advanced" x="134" y="21" id="RTE" title="Title" width="440" height="368" enabled="true"&#62;&#60;/:RichTextEditor&#62;
&lt;/pre&gt;</description>
		<content:encoded><![CDATA[<p>Love the site, lots of good nuggets.</p>
<p>Building upon this topic, any ideas how to add an embedded font to a Rich Text Editor?  Not just assign the embedded font, but append multiple to the RTE.  I&#8217;ve always been able to push a <code>fontName</code> to the <code>fontFamilyArray</code>, but the font never renders in the RTE, I always get a default font to render.</p>
<p>Example:</p>
<pre class="code">
&lt;mx:Style&gt;
    @font-face {
        src:url("AABIGFICTION.swf");
        fontFamily: "AABIGFICTION";
    }
&lt;/mx:Style&gt;

&lt;mx:Script&gt;
    RTE.fontFamilyArray.push('AABIGFICTION');
&lt;/mx:Script&gt;

&lt;mx:RichTextEditor fontAntiAliasType="advanced" x="134" y="21" id="RTE" title="Title" width="440" height="368" enabled="true"&gt;&lt;/:RichTextEditor&gt;
</pre>
]]></content:encoded>
	</item>
	<item>
		<title>By: peterd</title>
		<link>http://blog.flexexamples.com/2008/07/31/displaying-different-fonts-in-a-dropdown-menu-on-a-combobox-control-in-flex/#comment-15812</link>
		<author>peterd</author>
		<pubDate>Wed, 24 Sep 2008 00:44:26 +0000</pubDate>
		<guid>http://blog.flexexamples.com/2008/07/31/displaying-different-fonts-in-a-dropdown-menu-on-a-combobox-control-in-flex/#comment-15812</guid>
		<description>George,

&lt;pre class="code"&gt;
&#60;mx:Label text="{comboBox.selectedItem.fontName}" /&#62;
&lt;/pre&gt;

Peter</description>
		<content:encoded><![CDATA[<p>George,</p>
<pre class="code">
&lt;mx:Label text="{comboBox.selectedItem.fontName}" /&gt;
</pre>
<p>Peter</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: George</title>
		<link>http://blog.flexexamples.com/2008/07/31/displaying-different-fonts-in-a-dropdown-menu-on-a-combobox-control-in-flex/#comment-15806</link>
		<author>George</author>
		<pubDate>Tue, 23 Sep 2008 16:47:54 +0000</pubDate>
		<guid>http://blog.flexexamples.com/2008/07/31/displaying-different-fonts-in-a-dropdown-menu-on-a-combobox-control-in-flex/#comment-15806</guid>
		<description>I cannot seem to figure out how to pull the selected font to a textbox so I can see what is selected. I have tried all kinds of things:
{myFont.labelField}
{myFont.selectedItem.label}

The comboBox id is myFont

Any insight would be great

Thanks
G.</description>
		<content:encoded><![CDATA[<p>I cannot seem to figure out how to pull the selected font to a textbox so I can see what is selected. I have tried all kinds of things:<br />
{myFont.labelField}<br />
{myFont.selectedItem.label}</p>
<p>The comboBox id is myFont</p>
<p>Any insight would be great</p>
<p>Thanks<br />
G.</p>
]]></content:encoded>
	</item>
</channel>
</rss>
