« Return to Thread: htmlText truncation when changing from embedded to device font

Re: htmlText truncation when changing from embedded to device font

by turbo_vb :: Rate this Message:

Reply to Author | View in Thread


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.
>


 « Return to Thread: htmlText truncation when changing from embedded to device font