Answered
CharacterFormat fails to take values
I'm finding that CharacterFormat (soon ITextLayoutFormat)
fails to take a value of "regular" for fontStyle. This code
illustrates the case (attached)
On the first run the traces are as expected, setting the text to italic:
"existing fontWeight: normal"
"existing fontStyle: regular"
"new fontStyle: italic"
"should be: italic"
But when I click my italic button again it fails to reset the text to regular because the "italic" CharacterFormat will not take a value of FontStyle.REGULAR when using a conditional assignment (ternary or if-else), the final trace shows the outcome of this conditional assignment, it just never actually gets assigned (it remains null). So the traces for when the text is already italic are:
"existing fontWeight: normal"
"existing fontStyle: italic"
"new fontStyle: null"
"should be: regular"
I'm not using bold here so there's nothing running through the BOLD_ITALIC stuff.
On the first run the traces are as expected, setting the text to italic:
"existing fontWeight: normal"
"existing fontStyle: regular"
"new fontStyle: italic"
"should be: italic"
But when I click my italic button again it fails to reset the text to regular because the "italic" CharacterFormat will not take a value of FontStyle.REGULAR when using a conditional assignment (ternary or if-else), the final trace shows the outcome of this conditional assignment, it just never actually gets assigned (it remains null). So the traces for when the text is already italic are:
"existing fontWeight: normal"
"existing fontStyle: italic"
"new fontStyle: null"
"should be: regular"
I'm not using bold here so there's nothing running through the BOLD_ITALIC stuff.
