Skip to main content
Known Participant
Apr 15, 2009 6:16 PM UTC
Answered

Bug with fontStyle?

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 is closed to new replies. Start a new post to keep the conversation going.
robin_briggsCorrect answer
Adobe Employee
Apr 16, 2009 3:57 AM UTC

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

2 replies

robin_briggsCorrect answer
Adobe Employee
Apr 16, 2009 3:57 AM UTC

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

Translate
Known Participant
Apr 16, 2009 11:02 PM UTC

Thank you very much.

Translate