Concise problem statement:
If you compile with flash pro CC, and use the 'setTextFormat' method of a TextField, the 'bold' and 'italic' properties of the TextFormat argument have no effect on the rendered text. If you compile with flash pro CS6, the 'bold' and 'italic' properties work as expected.
Apparently, with flash pro CC, the only way to make the text render correctly is to change the font name (add the suffix ' Bold', ' Italic', or ' Bold Italic'.) This means code which dynamically changes font styles only works in CS6 or CC, but not both. For example, if you use the 'bold' property the text renders bold in CS6 and regular in CC, whereas if you change the font name to add the suffix ' Bold', the text renders bold in CC and DOES NOT RENDER at all in CS6. This makes it difficult to transition a team from CS6 to CC.
Steps to reproduce bug:
1. Create an xfl with 2 TextFields on the stage, both with font "Trebuchet MS" and style "regular", one named boldTrueText containing the String "bold = true", one named fontNameText containing the String "fontName = Trebuchet MS Bold". Create 2 more TextFields on the stage for visual reference, both with font "Trebuchet MS", one with style "regular", one with style "bold".
2. Add the following code to the Actions panel on frame 1:
import flash.text.TextFormat;
import flash.text.Font;
var format:TextFormat = boldTrueText.getTextFormat();
format.bold = true;
boldTrueText.setTextFormat(format);
format = fontNameText.getTextFormat();
format.font = "Trebuchet MS Bold";
fontNameText.setTextFormat(format);
var fonts:Array = Font.enumerateFonts(), count:int = fonts.length;
for (var i:int = 0; i < count; i++) {
var font:Font = fonts[i];
trace("fontName: " + font.fontName + ", fontStyle: " + font.fontStyle);
}
3. Save, and compile with flash pro CS6 and flash pro CC.
Results:
With flash pro CS6, "bold = true" renders bold, and "fontName = Trebuchet MS Bold" DOES NOT RENDER.
With flash pro CS6, the following is traced:
fontName: Trebuchet MS, fontStyle: bold
fontName: Trebuchet MS, fontStyle: regular
With flash pro CC, "bold = true" renders regular, and "fontName = Trebuchet MS Bold" renders bold.
With flash pro CC, the following is traced:
fontName: Trebuchet MS, fontStyle: regular
fontName: Trebuchet MS Bold, fontStyle: bold
Expected results:
The same text is rendered in both flash pro CS6 and CC. I don't know why this behavior was changed in flash pro CC - it causes silent failures in code which dynamically changes font styles. I expected the flash pro CS6 behavior to remain the same in CC, like so:
With flash pro CC, "bold = true" renders bold, and "fontName = Trebuchet MS Bold" DOES NOT RENDER.
With flash pro CC, the following is traced:
fontName: Trebuchet MS, fontStyle: bold
fontName: Trebuchet MS, fontStyle: regular
If you don't want to break backward compatibility (any further), you could make both the behaviors work in flash pro CC, like so:
With flash pro CC, "bold = true" renders bold (font is still "Trebuchet MS"), and "fontName = Trebuchet MS Bold" renders bold also.
With flash pro CC, the following is traced:
fontName: Trebuchet MS, fontStyle: bold
fontName: Trebuchet MS, fontStyle: regular
fontName: Trebuchet MS Bold, fontStyle: bold
I submitted this bug with the bug form, and also with adobe bugbase (in case it isn't obsolete) - I'm just trying to maximize my chances of getting a fix. Has anyone else encountered this bug?