0 Replies Latest reply on Jan 22, 2009 5:38 PM by (GordonSmith)

    [svn] 4634: 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.

    Level 1
      Revision: 4634
      Author:   gosmith@adobe.com
      Date:     2009-01-22 17:38:56 -0800 (Thu, 22 Jan 2009)

      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




      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:
      --------------
          flex/sdk/trunk/asdoc/build.xml
          flex/sdk/trunk/build.xml
          flex/sdk/trunk/frameworks/projects/framework/build.xml
          flex/sdk/trunk/frameworks/projects/framework/defaults.css
          flex/sdk/trunk/frameworks/projects/framework/src/FrameworkClasses.as
          flex/sdk/trunk/frameworks/projects/framework/src/mx/core/UIComponent.as
          flex/sdk/trunk/frameworks/projects/framework/src/mx/styles/metadata/TextStyles.as

      Added Paths:
      -----------
          flex/sdk/trunk/frameworks/projects/framework/src/mx/core/UITLFTextField.as