Skip to main content
Participating Frequently
November 19, 2010
Question

AntiAliasing broken when using TLF with HtmlText

  • November 19, 2010
  • 1 reply
  • 1287 views

Hey Guys, I'm struggling with two issues using TLF within Flash CS5.

1) I'm unable to get Anti-aliasing to work when using TLFTextFields in combination with htmlText.

If I draw a TLFTextField on the stage within Flash IDE and set its Anti-aliasing to Readability then it will anti-alise correctly. If i dynamically change the .text property via AS3, then it still remains crisp, however If i change its .htmlText property Anti-aliasing is disabled and the text looks jagged.

e.g.

var tlfTxt:TLFTextField = new TLFTextField();

tlfTxt.htmlText = "<p><font color='#000000' face='Century Gothic'>Testing <b>quick</b></font></p>";

tlfTxt.antiAliasType = AntiAliasType.ADVANCED;

addChild(tlfTxt);

What is the best way to achieve Anti-aliasing this way?

The same happens if I set a tlfMarkup and specify a TextFlow with styling.

Also how am I able to change weight when using TextFlow? If I have Century Gothic Regular and Bold each embedded within my library, and exported for Actionscript using DF4, which works using the above htmlText example, how do I get Bold to work using the below example?

var tFlow:String = "<TextFlow xmlns='http://ns.adobe.com/textLayout/2008' fontFamily='Century Gothic' fontSize='24'><p>Testing <span fontStyle='bold'>quick</span></p></TextFlow>";
tlfTxt.tlfMarkup = tFlow;

2) I'm unable to get embedded fonts to work when using TextConverter.TEXT_FIELD_HTML_FORMAT

I can successfully use embedded fonts when using TextConverter.importToFlow(markup, TextConverter.PLAIN_TEXT_FORMAT); however as soon as I switch to using TextConverter.TEXT_FIELD_HTML_FORMAT the embedded fonts no longer work. Does anyone know how to overcome this?

Cheers,

Tim

This topic has been closed for replies.

1 reply

November 20, 2010

Tim,

I think both issues you're seeing are the same problem, as I believe the htmlText property uses the TextFieldHTML filter. But I haven't been able to reproduce either issue yet.

When I set htmlText using the same font as I specified on the stage (or I omit the font tag entirely) I'm seeing antialiased text. If I use a font in the markup that's different than what I specified on the stage I'm getting a fallback font that's antialiased. The fact that I get a fallback font (even when I specify a font I have installed) suggests to me that it's still trying to use an embedded font after the htmlText property is set.

What happens for you if you do not have a font tag in your HTML? If that looks better there may be a mismatch between font names between the markup and embedding.

Alan