I'm trying to use embedded fonts in htmlText. I've embedded the font in the Style tag:
Now if I add it to a Text component like:
<mx:Text id="myText" htmlText="This is some text" fontFamily="myFont" />
it all works fine. If I try to use the <font> tag inside the htmlText like
myText.htmlText = "<font face='myFont'>This is some text</font>";
with a component <mx:Text id="myText" /> it doesn't work. If I use a font that's not embedded like
myText.htmlText = "<font face=Georgia'>This is some text</font>";
it works fine. So my question: how can I use the <font face=.. > tag in htmlText with embedded fonts?
The underlying flash.text.TextField that actually does the display of text needs to have a flag flipped to tell it to use embedded fonts. By specifying an embedded fontFamily in the MXML, the Flex framework figures out that it is embedded and flips that flag.
If you want to use different font tags in your html, all of the fontFamily specified must be in the same SWF and all must be embedded. Then specify in the MXML one of the embedded fonts and override that font with the font tags in the html. You can also call setStyle("fontFamily", "myFont") before setting the htmlText in ActionScript.
Flex SDK Developer
Adobe Systems Inc.