Transferred from the Adobe Open Source Subversion Repository
Transferred from the Adobe Open Source Subversion Repository

Revision: 4634
Author:   gosmith@adobe.com
Date:     2009-01-23T01:38:56.754915Z

Log Message: 
-----------
First part of glue code for allowing Halo components to use the new Text Layout Framework, in order to get functionality such as bidirectional text.

Background:

TLF is making this possible by implementing a TLFTextField class. It is a Sprite that uses TLF to implement the same properties and methods as the legacy TextField class in the Player. Thanks to the createInFontContext() bottleneck method in UIComponent, it can be used by a properly-written Halo component (such as those in Flex 3) without any modifications to the component.

Note: Text should render similarly -- but is unlikely to render identically -- when a component uses TLFTextField vs. TextField. The width and height may be different, affecting layout; text could wrap differently; etc. This is a fact-of-life based on the fact that TLF/FTE and TextField are completely different text engines.

Whether a Halo component uses TLF or not to render text will be determined in Flex 4 by a new style, textFieldClass. (Gumbo components always use TLF.)

TLFTextField is currently only partially implemented. It does not yet support scrolling, selection, editing, multiple formats, or htmlText. Therefore it can only be used for simple display text, such as a Button label.

Details:

The TextStyles.as bucket 'o text styles now includes a non-inheriting textFieldClass style. It can be set to either mx.core.UITextField or mx.core.UITLFTextField. These are the Flex framework's wrapper classes around the lower-level classes flash.text.TextField (in the Player) and its TLF-based workalike, flashx.textLayout.controls.TLFTextField.

The global selector in defaults.css currently sets it to mx.core.UITextField using a ClassReference directive. For the time being, all Halo components will continue to use the "real" TextField.

The new UITLFTextField is a copy of UITextField, except that it extends TLFTextField instead of TextField. This class has been added to FrameworkClasses.as because no classes in framework.swc have a dependency on it. It will get soft-linked into applcations via the textFieldClass style.

The TLFTextField class currently lives in a fourth TLF SWC, textLayout_textField.swc. This SWC has been added to various build scripts. The external-library-path for building framework.swc now includes all four TLF SWCs, because UITLFTextField can't be compiled and linked without them. However, since they are external they aren't linked into framework.swc.

Properly-written Halo UIComponents access their text fields only through the IUITextField interface, and they create text fields like this:

textField = IUITextField(createInFontContext(UITextField));

(The reason for using createInFontContext() is to support embedded fonts that are embedded in a different SWF.)

The createInFontContext() method of UIComponent has been modified to use the textFieldClass style to determine whether to create a UITextField or a UITLFTextField.

With these changes, you can now write code like

<mx:Button label="OK"/>
<mx:Button label="OK" textFieldClass="mx.core.UITLFTextField"/>

to get two Buttons, the first of which uses UITextField (because this is the value of textFieldClass in the global selector) and the second of which uses UITLFTextField. They look very similar, which is good!

Currently, both Buttons are being measured by using an offscreen TextField. A subsequent checkin will make components rendering using UITLFTextField measure themselves using an offscreen TLFTextField so that measurement and rendering are consistent.

QE Notes: None
Doc Notes: None
Bugs: None
Reviewer: Deepa

Modified Paths:
--------------
<path kind="file" action="M">/flex/sdk/trunk/build.xml</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/framework/src/mx/styles/metadata/TextStyles.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/framework/build.xml</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/framework/defaults.css</path>
<path kind="file" action="M">/flex/sdk/trunk/asdoc/build.xml</path>
<path kind="file" action="A">/flex/sdk/trunk/frameworks/projects/framework/src/mx/core/UITLFTextField.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/framework/src/FrameworkClasses.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/framework/src/mx/core/UIComponent.as</path>

git-svn-id: 7146a936b37d36e51ea0d66f8acbe0b8281bc7b7@1253825 13f79535-47bb-0310-9956-ffa450edef68

danteinforno/flex-sdk,apache/flex-sdk,shyamalschandra/flex-sdk,adufilie/flex-sdk,apache/flex-sdk,danteinforno/flex-sdk,SlavaRa/flex-sdk,adufilie/flex-sdk,danteinforno/flex-sdk,apache/flex-sdk,adufilie/flex-sdk,danteinforno/flex-sdk,adufilie/flex-sdk,adufilie/flex-sdk,danteinforno/flex-sdk,apache/flex-sdk,shyamalschandra/flex-sdk,apache/flex-sdk,adufilie/flex-sdk,shyamalschandra/flex-sdk,SlavaRa/flex-sdk,shyamalschandra/flex-sdk,apache/flex-sdk,SlavaRa/flex-sdk,shyamalschandra/flex-sdk,SlavaRa/flex-sdk,SlavaRa/flex-sdk,danteinforno/flex-sdk,SlavaRa/flex-sdk,shyamalschandra/flex-sdk