<?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; embeddedCFF</title>
	<atom:link href="http://blog.flexexamples.com/tag/embeddedcff/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 ligature level on a Spark TextInput control in Flex Gumbo</title>
		<link>http://blog.flexexamples.com/2008/10/21/setting-the-ligature-level-on-an-fxtextinput-control-in-flex-gumbo/</link>
		<comments>http://blog.flexexamples.com/2008/10/21/setting-the-ligature-level-on-an-fxtextinput-control-in-flex-gumbo/#comments</comments>
		<pubDate>Wed, 22 Oct 2008 05:12:19 +0000</pubDate>
		<dc:creator>Peter deHaan</dc:creator>
				<category><![CDATA[beta1]]></category>
		<category><![CDATA[FontLookup]]></category>
		<category><![CDATA[LigatureLevel]]></category>
		<category><![CDATA[needsSWF]]></category>
		<category><![CDATA[TextInput (Spark)]]></category>
		<category><![CDATA[embeddedCFF]]></category>
		<category><![CDATA[Gumbo]]></category>

		<guid isPermaLink="false">http://blog.flexexamples.com/2008/10/21/setting-the-ligature-level-on-an-fxtextinput-control-in-flex-gumbo/</guid>
		<description><![CDATA[<p>In earlier examples, <a href="http://blog.flexexamples.com/2008/10/15/embedding-fonts-in-flex-gumbo/">&#8220;Embedding fonts in Flex Gumbo&#8221;</a> and <a href="http://blog.flexexamples.com/2008/10/20/setting-the-typographic-case-on-an-fxtextarea-control-in-flex-gumbo/">&#8220;Setting the typographic case on a Spark TextArea control in Flex Gumbo&#8221;</a>, we&#8217;ve seen how to embed fonts in Flex Gumbo.</p> <p>The following example shows how you can set the ligature level on a Spark TextInput control in Flex 4/Gumbo by setting the ligatureLevel [...]]]></description>
			<content:encoded><![CDATA[<p>In earlier examples, <a href="http://blog.flexexamples.com/2008/10/15/embedding-fonts-in-flex-gumbo/">&#8220;Embedding fonts in Flex Gumbo&#8221;</a> and <a href="http://blog.flexexamples.com/2008/10/20/setting-the-typographic-case-on-an-fxtextarea-control-in-flex-gumbo/">&#8220;Setting the typographic case on a Spark TextArea control in Flex Gumbo&#8221;</a>, we&#8217;ve seen how to embed fonts in Flex Gumbo.</p>
<p>The following example shows how you can set the ligature level on a Spark TextInput control in Flex 4/Gumbo by setting the <code>ligatureLevel</code> style to one of the static constants in the flash.text.engine.LigatureLevel class.</p>
<p>Full code after the jump.</p>
<p><span id="more-838"></span></p>
<p class="alert">To use the following code, you must have Flash Player 10 and a Flex Gumbo SDK installed in your Flex Builder 3. For more information on downloading and installing the Gumbo SDK into Flex Builder 3, see <a href="http://blog.flexexamples.com/2008/08/02/using-the-beta-gumbo-sdk-in-flex-builder-3/">&#8220;Using the beta Gumbo SDK in Flex Builder 3&#8243;</a>.</p>
<p class="download"><a href="http://blog.flexexamples.com/wp-content/uploads/FxTextInput_ligatureLevel_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/10/21/setting-the-ligature-level-on-an-fxtextinput-control-in-flex-gumbo/ --&gt;
&lt;s:Application name="Spark_TextInput_ligatureLevel_test"
        xmlns:fx="http://ns.adobe.com/mxml/2009"
        xmlns:s="library://ns.adobe.com/flex/spark"
        xmlns:mx="library://ns.adobe.com/flex/halo"&gt;

    &lt;fx:Style&gt;
        @font-face {
            src: url("assets/ACaslonPro-Regular.otf");
            fontFamily: "AdobeCaslonProEmbedded";
            cff: true;
            unicodeRange: U+0020-007B;
        }
    &lt;/fx:Style&gt;

    &lt;fx:Script&gt;
        &lt;![CDATA[
            import mx.events.ItemClickEvent;
            import flash.text.engine.LigatureLevel;

            private function toggleButtonBar_itemClick(evt:ItemClickEvent):void {
                textInput.setStyle("ligatureLevel", evt.item);
            }
        ]]&gt;
    &lt;/fx:Script&gt;

    &lt;fx:Declarations&gt;
        &lt;fx:Array id="arr"&gt;
            &lt;fx:String&gt;{LigatureLevel.MINIMUM}&lt;/fx:String&gt;
            &lt;fx:String&gt;{LigatureLevel.COMMON}&lt;/fx:String&gt;
            &lt;fx:String&gt;{LigatureLevel.UNCOMMON}&lt;/fx:String&gt;
            &lt;fx:String&gt;{LigatureLevel.EXOTIC}&lt;/fx:String&gt;
        &lt;/fx:Array&gt;
    &lt;/fx:Declarations&gt;

    &lt;mx:ApplicationControlBar width="100%" cornerRadius="0"&gt;
        &lt;mx:Form styleName="plain"&gt;
            &lt;mx:FormItem label="ligatureLevel:"&gt;
                &lt;mx:ToggleButtonBar id="toggleButtonBar"
                        dataProvider="{arr}"
                        itemClick="toggleButtonBar_itemClick(event);" /&gt;
            &lt;/mx:FormItem&gt;
        &lt;/mx:Form&gt;
    &lt;/mx:ApplicationControlBar&gt;

    &lt;s:TextInput id="textInput"
            text="fi fj fl ft ffi ffj ffl ct st Th"
            fontFamily="AdobeCaslonProEmbedded"
            fontSize="48"
            fontLookup="embeddedCFF"
            horizontalCenter="0"
            verticalCenter="0" /&gt;

&lt;/s:Application&gt;
</pre>
<p class="information"><a href="http://blog.flexexamples.com/wp-content/uploads/FxTextInput_ligatureLevel_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/FxTextInput_ligatureLevel_test/bin/main.html" width="100%" height="250"></iframe></p>
<p>You can also set the <code>ligatureLevel</code> style in an external .CSS file or &lt;Style /&gt; block, as seen in the following example:</p>
<p class="download"><a href="http://blog.flexexamples.com/wp-content/uploads/FxTextInput_ligatureLevel_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/10/21/setting-the-ligature-level-on-an-fxtextinput-control-in-flex-gumbo/ --&gt;
&lt;s:Application name="Spark_TextInput_ligatureLevel_test"
        xmlns:fx="http://ns.adobe.com/mxml/2009"
        xmlns:s="library://ns.adobe.com/flex/spark"
        xmlns:mx="library://ns.adobe.com/flex/halo"&gt;

    &lt;fx:Style&gt;
        @namespace s "library://ns.adobe.com/flex/spark";

        @font-face {
            src: url("assets/ACaslonPro-Regular.otf");
            fontFamily: "AdobeCaslonProEmbedded";
            cff: true;
            unicodeRange: U+0020-007B;
        }

        s|TextInput {
            fontFamily: "AdobeCaslonProEmbedded";
            fontSize: 48;
            fontLookup: "embeddedCFF";
            ligatureLevel: "exotic";
        }
    &lt;/fx:Style&gt;

    &lt;s:TextInput id="fxTextInput"
            text="fi fj fl ft ffi ffj ffl ct st Th"
            horizontalCenter="0"
            verticalCenter="0" /&gt;

&lt;/s:Application&gt;
</pre>
<p>Or, you can set the <code>ligatureLevel</code> style in MXML, as seen in the following example:</p>
<p class="download"><a href="http://blog.flexexamples.com/wp-content/uploads/FxTextInput_ligatureLevel_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/10/21/setting-the-ligature-level-on-an-fxtextinput-control-in-flex-gumbo/ --&gt;
&lt;s:Application name="Spark_TextInput_ligatureLevel_test"
        xmlns:fx="http://ns.adobe.com/mxml/2009"
        xmlns:s="library://ns.adobe.com/flex/spark"
        xmlns:mx="library://ns.adobe.com/flex/halo"&gt;

    &lt;fx:Style&gt;
        @font-face {
            src: url("assets/ACaslonPro-Regular.otf");
            fontFamily: "AdobeCaslonProEmbedded";
            cff: true;
            unicodeRange: U+0020-007B;
        }
    &lt;/fx:Style&gt;

    &lt;s:TextInput id="fxTextInput"
            text="fi fj fl ft ffi ffj ffl ct st Th"
            fontFamily="AdobeCaslonProEmbedded"
            fontSize="48"
            fontLookup="embeddedCFF"
            ligatureLevel="exotic"
            horizontalCenter="0"
            verticalCenter="0"
            width="75%" /&gt;

&lt;/s:Application&gt;
</pre>
<p>Due to popular demand, here is the &#8220;same&#8221; example in a more ActionScript friendly format:</p>
<p class="download"><a href="http://blog.flexexamples.com/wp-content/uploads/FxTextInput_ligatureLevel_test/bin/srcview/source/main4.mxml.html">View MXML</a></p>
<pre class="code">
&lt;?xml version="1.0" encoding="utf-8"?&gt;
&lt;!-- http://blog.flexexamples.com/2008/10/21/setting-the-ligature-level-on-an-fxtextinput-control-in-flex-gumbo/ --&gt;
&lt;s:Application name="Spark_TextInput_ligatureLevel_test"
        xmlns:fx="http://ns.adobe.com/mxml/2009"
        xmlns:s="library://ns.adobe.com/flex/spark"
        xmlns:mx="library://ns.adobe.com/flex/halo"
        initialize="init();"&gt;

    &lt;fx:Script&gt;
        &lt;![CDATA[
            import flash.text.engine.FontLookup;
            import flash.text.engine.LigatureLevel;

            import mx.containers.ApplicationControlBar;
            import mx.containers.Form;
            import mx.containers.FormItem;
            import mx.controls.ToggleButtonBar;
            import mx.events.ItemClickEvent;

            import spark.components.TextInput;

            [Embed(source="assets/ACaslonPro-Regular.otf",
                        fontFamily="AdobeCaslonProEmbedded",
                        cff="true",
                        unicodeRange="U+0020-007B",
                        mimeType="application/x-font")]
            private const MyEmbeddedFont:Class;

            private var toggleButtonBar:ToggleButtonBar;
            private var textInput:TextInput;
            private var arr:Array;

            private function init():void {
                arr = [];
                arr.push(LigatureLevel.MINIMUM);
                arr.push(LigatureLevel.COMMON);
                arr.push(LigatureLevel.UNCOMMON);
                arr.push(LigatureLevel.EXOTIC);

                toggleButtonBar = new ToggleButtonBar();
                toggleButtonBar.dataProvider = arr;
                toggleButtonBar.addEventListener(ItemClickEvent.ITEM_CLICK, toggleButtonBar_itemClick);

                var formItem:FormItem = new FormItem();
                formItem.label = "ligatureLevel:";
                formItem.addChild(toggleButtonBar);

                var form:Form = new Form();
                form.styleName = "plain";
                form.addChild(formItem);

                var appControlBar:ApplicationControlBar;
                appControlBar = new ApplicationControlBar();
                appControlBar.percentWidth = 100;
                appControlBar.setStyle("cornerRadius", 0);
                appControlBar.addChild(form);
                addElementAt(appControlBar, 0);

                textInput = new TextInput();
                textInput.text = "fi fj fl ft ffi ffj ffl ct st Th";
                textInput.setStyle("fontFamily", "AdobeCaslonProEmbedded");
                textInput.setStyle("fontSize", 48);
                textInput.setStyle("fontLookup", FontLookup.EMBEDDED_CFF);
                textInput.horizontalCenter = 0;
                textInput.verticalCenter = 0;
                textInput.percentWidth = 90;
                addElement(textInput);
            }

            private function toggleButtonBar_itemClick(evt:ItemClickEvent):void {
                textInput.setStyle("ligatureLevel", evt.item);
            }
        ]]&gt;
    &lt;/fx:Script&gt;

&lt;/s:Application&gt;
</pre>
<p class="alert">This entry is based on a beta version of the Flex Gumbo 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 Gumbo SDK.</p>
<p>For more information on the LigatureLevel class in Flash Player 10, see <a href="http://livedocs.adobe.com/flex/gumbo/langref/flash/text/engine/LigatureLevel.html">http://livedocs.adobe.com/flex/gumbo/langref/flash/text/engine/LigatureLevel.html</a>.</p>
<div class="evernoteSiteMemory"><a href="javascript:" onclick="Evernote.doClip({title: 'Setting the ligature level on a Spark TextInput control in Flex Gumbo on FlexExamples.com',url: 'http://blog.flexexamples.com/2008/10/21/setting-the-ligature-level-on-an-fxtextinput-control-in-flex-gumbo/',contentID: 'post-838',code: 'Pete9667',suggestNotebook: 'FlexExamples',suggestTags: 'embeddedCFF,Gumbo',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/10/21/setting-the-ligature-level-on-an-fxtextinput-control-in-flex-gumbo/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>

