Skip to main content
Known Participant
April 15, 2009
Answered

Bug with fontStyle?

  • April 15, 2009
  • 1 reply
  • 831 views

I am trying to change the fontStyle to italic and if the whole selected text is italic and the user clicks on the italic button the formatting should be reset.

Here an example:

var cf:TextLayoutFormat = new TextLayoutFormat();
cf.fontStyle = FontStyle.REGULAR;
IEditManager(_textFlow.interactionManager).applyLeafFormat(cf);
_textFlow.interactionManager.setFocus();

The font style is reset if I change it to FormatValue.INHERIT. But that would result that if the paragraph is formatted in italic the text stays italic. But it is possible to reset the fontWeight property to FontWeight.NORMAL.

Is that problem with the fontStyle a bug?

Thanks in advance.

This topic has been closed for replies.
Correct answer robin_briggs

To set to italic (or back to normal), you need to use the new class, flash.text.engine.FontPosture. Try replacing this:

cf.fontStyle = FontStyle.REGULAR;

With this:

          cf.fontStyle = FontPosture.ITALIC;

Sorry. I think this is more confusing than it should be, but the "FontStyle" class is from the TextField API and can't be changed.

Thanks!

- robin

1 reply

robin_briggsCorrect answer
Adobe Employee
April 16, 2009

To set to italic (or back to normal), you need to use the new class, flash.text.engine.FontPosture. Try replacing this:

cf.fontStyle = FontStyle.REGULAR;

With this:

          cf.fontStyle = FontPosture.ITALIC;

Sorry. I think this is more confusing than it should be, but the "FontStyle" class is from the TextField API and can't be changed.

Thanks!

- robin

Known Participant
April 16, 2009

Thank you very much.