 //  Styles
 //--------------------------------------
 
-include "../styles/metadata/AdvancedTextLayoutFormatStyles.as"
-include "../styles/metadata/BasicTextLayoutFormatStyles.as"
-include "../styles/metadata/NonInheritingTextLayoutFormatStyles.as"
+include "../styles/metadata/BasicInheritingTextStyles.as"
+include "../styles/metadata/BasicNonInheritingTextStyles.as"
+include "../styles/metadata/AdvancedInheritingTextStyles.as"
+include "../styles/metadata/AdvancedNonInheritingTextStyles.as"
 
 //--------------------------------------
 //  Other metadata

    
    /**
     *  @private
     *  This object is determined by the CSS styles of the RichText
     *  and is updated by createTextFlow() when the hostFormatsInvalid flag
     *  is true.
     */
    private var hostFormat:ITextLayoutFormat;

    /**
     *  @private
     *  This flag indicates whether hostCharacterFormat, hostParagraphFormat,
     *  and hostContainerFormat need to be recalculated from the CSS styles
     *  of the RichText. It is set true by stylesInitialized() and also
     *  when styleChanged() is called with a null argument, indicating that
     *  multiple styles have changed.
     */
    private var hostFormatChanged:Boolean = true;

    /**
     *  @private
     */
    private var textFlow:TextFlow;

    /**
     *  @private
     */
    private var textChanged:Boolean = false;

    /**
     *  @private
     */
    private var contentChanged:Boolean = false;

    /**
     *  @private
     *  This flag is set to true if the 'text' needs to be extracted
     *  from the 'content'.
     */
    private var textInvalid:Boolean = false;

    /**
     *  @private
     *  Holds the last recorded value of the module factory
     *  used to create the font.
     */
    mx_internal var embeddedFontContext:IFlexModuleFactory;

    //--------------------------------------------------------------------------
    //

    {
        super.styleChanged(styleProp);

        // The old hostFormat is invalid
        // and a new one must be created.
        hostFormat = null;
        
		invalidateTextLines();
		invalidateProperties();
		invalidateSize();
		invalidateDisplayList();
	}

	//--------------------------------------------------------------------------
	//
	//  Overridden methods: TextGraphicElement
	//
	//--------------------------------------------------------------------------
	
	/**
	 *  @private
	 *  Returns true to indicate all lines were composed.
	 */
	override mx_internal function composeTextLines(width:Number = NaN,
												   height:Number = NaN):Boolean
	{
		super.composeTextLines(width, height);
		
		// Don't want this handler firing when we're re-composing the text lines.
		if (factory is TextFlowTextLineFactory && _textFlow != null)
		{
			_textFlow.removeEventListener(DamageEvent.DAMAGE,
										  textFlow_damageHandler);
		}
		
		
		// Set the composition bounds to be used by createTextLines().
		// If the width or height is NaN, it will be computed by this method
		// by the time it returns.
		// The bounds are then used by the addTextLines() method
		// to determine the isOverset flag.
		// The composition bounds are also reported by the measure() method.
		bounds.x = 0;
		bounds.y = 0;
		bounds.width = isNaN(width) ? maxWidth : width;
		bounds.height = height;
		
		removeTextLines();
		releaseTextLines();
		
		createTextLines();
		
		addTextLines(DisplayObjectContainer(drawnDisplayObject));
		
		// Figure out if the text overruns the available space for composition.
		isOverset = isTextOverset(width, height);
		
		// Just recomposed so reset.
		invalidateCompose = false;
		
		// Listen for "damage" events in case the textFlow is 
		// modified programatically.
		if (factory is TextFlowTextLineFactory && _textFlow != null)
		{
			_textFlow.addEventListener(DamageEvent.DAMAGE, 
									   textFlow_damageHandler);
		}  
		
		// Created all lines.
		return true;      
	}
	
    //--------------------------------------------------------------------------
    //
    //  Methods
    //
    //--------------------------------------------------------------------------

    /**
     *  @private
     */
    private function createTextFlowFromContent(content:Object):TextFlow
    {
        var textFlow:TextFlow = new TextFlow();

        // The whiteSpaceCollapse format determines how whitespace
        // is processed when the children are set.
        staticTextLayoutFormat.whiteSpaceCollapse =
            getStyle("whiteSpaceCollapse");
        textFlow.hostFormat = staticTextLayoutFormat;

        textFlow.mxmlChildren = content is Array ?
        						content as Array :
        						[ content ];

        return textFlow;
    }

	/**
	 *  @private
	 */
	private function getEmbeddedFontContext():IFlexModuleFactory
	{
		var moduleFactory:IFlexModuleFactory;
		
		var fontLookup:String = getStyle("fontLookup");
		if (fontLookup != FontLookup.DEVICE)
		{
			var font:String = getStyle("fontFamily");
			var bold:Boolean = getStyle("fontWeight") == "bold";
			var italic:Boolean = getStyle("fontStyle") == "italic";
			
			moduleFactory = embeddedFontRegistry.getAssociatedModuleFactory(
				font, bold,	italic,
				this, fontContext);
			
			// If we found the font, then it is embedded. 
			// But some fonts are not listed in info()
			// and are therefore not in the above registry.
			// So we call isFontFaceEmbedded() which gets the list
			// of embedded fonts from the player.
			if (!moduleFactory) 
			{
				var sm:ISystemManager;
				if (fontContext != null && fontContext is ISystemManager)
					sm = ISystemManager(fontContext);
				else if (parent is IUIComponent)
					sm = IUIComponent(parent).systemManager;
				
				staticTextFormat.font = font;
				staticTextFormat.bold = bold;
				staticTextFormat.italic = italic;
				
				if (sm != null && sm.isFontFaceEmbedded(staticTextFormat))
					moduleFactory = sm;
			}
		}
		
		if (!moduleFactory && fontLookup == FontLookup.EMBEDDED_CFF)
		{
			// if we couldn't find the font and somebody insists it is
			// embedded, try the default fontContext
			moduleFactory = fontContext;
		}
		
		return moduleFactory;
	}
		
	/**
	 *  @private
	 *  Uses TextLineFactory to compose the textFlow
