Tim,
Thanks for the detailed reply. Unfortunately, this only fixes half the problem... With your recommended changes in place, the size of the TextArea now restores after a brief flicker, but the HTML formatting of the content is still lost.
Even if I reassign the HTML text to the TextArea inside your updateTextSize function so it happens after the font change is complete, only the raw text appears, and the formatting (even non-font-dependent formatting such as <br/>, <li> etc.) is lost. I read and appreciate your point about the bold face text requiring an embedded bold font, but even the non font-dependent formatting (as above) is lost.
Any ideas on how to restore the formatting after the font change?
Thanks again,
Toby
--- In
flexcoders@..., "Tim Hoff" <TimHoff@...> wrote:
>
>
> I'll let the engineers let you know why this is happening. But, you can
> get it to work with the following steps (hack):
>
> 1) Remove height="200" from the test Text control.
>
> 2) Add this function:
>
> private function updateTextSize():void
> {
> test.invalidateSize();
> }
>
> 3) On the ComboBox change event, execute callLater(updateTextSize);
>
> Note: If you use embedded fonts, a boldface font must be available for
> <b></b> to work.
>
> -TH
>
> --- In
flexcoders@..., "tphipps" <toby.phipps@> wrote:
> >
> > Hi all,
> >
> > I've seeing some strange behaviour with a mx:Text component using
> htmlText.
> >
> > It seems that when the fontFamily of the text component is changed at
> runtime from an embedded font to a device font (or vice versa), the
> content is truncated, and the HTML formatting lost. However, when
> changing from one device font to another (or one embedded font to
> another), it works just fine.
> >
> > Take this example (view source enabled but without the actual font
> files included - any OTF should work fine):
>
http://dev.nx.sg/lab/fontchange/FontChange.html> >
> > This app initializes the text component with some htmlText using a
> device font ("_sans" in this case). Once loaded, try changing the font
> to another device font (e.g. Courier New or Myriad) with the dropdown.
> Everything's fine. Now change to an embedded font, and note the
> truncation and loss of formatting.
> >
> > The reverse happens if I initalize the field with an embedded font -
> changing to another embedded font works fine but changing to a device
> font ends up truncating again.
> >
> > Anyone got any ideas how to make this work?
> >
> > Thanks,
> > Toby.
> >
>