Skip navigation
Currently Being Moderated

BUG - in flash pro CC, 'bold' and 'italic' properties of TextFormat have no effect on rendered text

Jul 29, 2013 4:04 PM

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?

 
Replies
  • kglad
    72,212 posts
    Jul 21, 2002
    Currently Being Moderated
    Jul 29, 2013 4:39 PM   in reply to eigenface

    the only way to get consistant and predictable fonts with flash is to embed fonts.

     
    |
    Mark as:
  • kglad
    72,212 posts
    Jul 21, 2002
    Currently Being Moderated
    Jul 29, 2013 5:19 PM   in reply to eigenface

    if you're relying on system font names, you're not embedding your fonts correctly.  your fonts should be in your library.  they should be exported for use with actionscript and have class names that are used to embed them dynamically.

     
    |
    Mark as:
  • kglad
    72,212 posts
    Jul 21, 2002
    Currently Being Moderated
    Jul 29, 2013 10:17 PM   in reply to eigenface

    font names are irrelevant if you're embedding fonts correctly.  the only thing that matters are the font class names.

     
    |
    Mark as:
  • Currently Being Moderated
    Aug 20, 2013 4:47 PM   in reply to kglad

    I am having the same issue.  I am defining the font face in html via xml.  Before to get Arial Bold you would define the font face as "Arial" and then use <b></b>.  This no longer works.  It seems that the font face is going to need to be changed to "Arial Bold" in all of the localized xml files if CC is going to be used.

     
    |
    Mark as:
  • kglad
    72,212 posts
    Jul 21, 2002
    Currently Being Moderated
    Aug 20, 2013 9:00 PM   in reply to paulsakebomb

    there's problem with fonts and mac computers.

     

    on windows the problem is incorrect embedding of fonts.

     
    |
    Mark as:
  • kglad
    72,212 posts
    Jul 21, 2002
    Currently Being Moderated
    Aug 21, 2013 7:38 PM   in reply to eigenface
     
    |
    Mark as:
  • Currently Being Moderated
    Aug 21, 2013 7:59 PM   in reply to kglad

    This isn't an example of using font face, <b>, <i> with htmlText though.

     
    |
    Mark as:
  • kglad
    72,212 posts
    Jul 21, 2002
    Currently Being Moderated
    Aug 30, 2013 8:19 AM   in reply to eigenface

    yes, the example fla i posted works differently in cs6 and cc.

     
    |
    Mark as:
  • Currently Being Moderated
    Nov 22, 2013 4:18 AM   in reply to eigenface

    I spent half a day on this. I then decided to test the code in CS6 (luckily hadn't removed it). CC most definately ignores <b>text</b> when CS6 renders them bold. And yes I've embedded the fonts correctly.

     

    here's my code, which renders differently between flash versions:

     

     

     

    var e:TextField = new TextField();

    addChild(e);

    e.width = 300;

               

    var a:Font = new Arial();

               

    var tmpStyle:StyleSheet = new StyleSheet();

     

    tmpStyle.setStyle("p" ,{fontFamily:a.fontName, fontSize:"33px"});

    e.styleSheet = tmpStyle;

               

    e.embedFonts = true;

    e.htmlText = "<p><b>bold</b>normal</p>";

     

     
    |
    Mark as:
  • Currently Being Moderated
    Nov 26, 2013 5:17 AM   in reply to hencca2012

    I'm having this problem too here, I have old projects of mine that stopped working because I have changed to Flash CC and now the italic and bold don't work anymore.

     

    I have done this code and got 2 different results on Flash CS5.5 and CC. It's basically what the other guys have told before, maybe now it's more clear to understand.

     

    When I do this code to show my embeded fonts I get these results:

     

    var fontList:Array = Font.enumerateFonts();

    for( var i:int = 0; i < fontList.length; i++ ) {

        trace("Font Name: " + fontList[i].fontName + ", " + fontList[i].fontStyle )

    }

     

    CC

    Font Name: Arial, regular

    Font Name: Arial Bold, bold

    Font Name: Arial Italic, italic

     

    CS5.5

    Font Name: Arial, italic

    Font Name: Arial, regular

    Font Name: Arial, bold

     

    On Flash CS5.5 I used to have one font and several styles embeded for it, so I could use Arial as font name in my TextFormat and could add any <b> <i> tags in my text that would work.

    Now on Flash CC it seems that every style is a different font, so we have font Arial, Arial Bold and Arial Italic, what makes the html tags useless, because for the font with name Arial it's only embedded the regular font.

     

    Is there a way to workaround it? Because I have several words in my site that I need to show some in italic and the others as regular, so this way I can't work with it.

    I also tryed to return to flash CS5.5 but when I try to open my fla on it the 5.5 crashes when I try to compile it and I get several messages saying it's not compatible, so return to CS5.5 it's not an option too.

     
    |
    Mark as:
  • Currently Being Moderated
    Dec 6, 2013 8:46 AM   in reply to eigenface

    I have the same problem, and I'm thankful for this discussion which at least allowed me to understand a possible workaround.

     

    That said, it's not a usable workaround in our case. Previously we could embed Arial in both regular and bold styles, and then have HTML text which looked like this:

    some text <b>this part in bold</b>

     

    Now however it needs to look like this:

    some text <font face="Arial Bold">this part in bold</font>

     

    All of this is drawn from XML. The problem is we already have a lot of deployed XML files, which use the former method. So I can't publish our font library from Flash CC, because it will break all our existing deployments (the font won't render at all). Good thing we kept a copy of CS5 lying around, although having to use that in this case is not only unnaceptable given that we paid to upgrade, but is also a massive pain in terms of our workflow.

     

    Not only that, but the bug noted here has also cost us a lot of time:

    http://forums.adobe.com/message/5425262

     

    Is Adobe ever going to apologise and fix these things? We've paid for upgraded software but have suffered significant regression.

     
    |
    Mark as:
  • Currently Being Moderated
    Dec 6, 2013 9:31 AM   in reply to Elliot Harris

    Have you applied the latest update - version 13.1.0.217? Do you still see this.

     

    -Sujai

     
    |
    Mark as:
  • Currently Being Moderated
    Dec 6, 2013 9:41 AM   in reply to SujaiS

    I checked it again here with the last version, but it seems this still happens.

     

    I had to do what Elliot Harris said, was the only solution I could think to fix the problem here on my project.

     
    |
    Mark as:
  • Currently Being Moderated
    Dec 9, 2013 1:57 AM   in reply to SujaiS

    I actually hadn't been notified of an update so thanks for pointing that out. However I've updated now and the problem remains.

     
    |
    Mark as:
  • Currently Being Moderated
    Dec 9, 2013 7:12 AM   in reply to eigenface

    Thanks for reporting this issue. Following your steps it's reproducible and has been logged internally.

    Will update here once the fix is available.

     

    -Nipun

     
    |
    Mark as:
  • Currently Being Moderated
    Jan 1, 2014 3:13 PM   in reply to SujaiS

    Although this works:

     

    <font face='Arial Bold'>some text I want bold</font>

     

    Additional font features do not work in Flash CC that worked in CS6.  For example, this does not work:

     

    <font face='Arial' size=34 color='#005500'>big dark green text</font>

     

    I hope this is fixed quickly too!

     
    |
    Mark as:
  • Currently Being Moderated
    Jan 2, 2014 2:39 AM   in reply to Ace Hoffman

    Hello Ace Hoffman,

     

    I checked this that you wrote here and it's working for me, the only difference is that the size=34 I used with quotes like this size='34' maybe this was your problem.

     

    Anyway it's not a good solution for me as we need to remove all the layout info (font, size, color) from the TextFormat to include together with the text.

     
    |
    Mark as:
  • Currently Being Moderated
    Apr 17, 2014 3:10 PM   in reply to Nipun Asthana

    Has this ever been fixed?   That's a pretty big deal that html tags "b" and "i" are ignored in Flash CC.  That effectively renders the entire application useless with absolutely zero chance that I'll ever upgrade to it.  In my trial, I'm finding that files which compile and run fine in CS6 suddenly have fonts missing in CC.  Fonts such as "Myriad Pro" and "Eras Bd BT" are properly embedded, but don't show up at runtime.  I've added text fields with the embedded fonts to the first frame.  I even tried uninstalling a windows update (kb2753842) which could have been causing problems for some fonts, but that had no effect.  Bottom line... files that compile and run fine in CS6, do not work when opened in CC on the same machine.

     
    |
    Mark as:
  • Currently Being Moderated
    Apr 17, 2014 3:15 PM   in reply to James22s22

    The answer by dprestescc resolved it.  I needed quote marks.

     
    |
    Mark as:
  • Currently Being Moderated
    Apr 17, 2014 3:35 PM   in reply to Ace Hoffman

    @ Ace Hoffman  Uh, no.  That was an entirely unrelated problem that had nothing to do with Flash not reading bold and italic tags in the HTML.  The missing quotes was just a dumb mistake that would always fail to work in any version of flash, because it's not valid html.  That's not the same as it not respecting bold and italic tags and using the wrong font names.

     

    As of the most recent December 2013 update to Flash, the font name problem still exists.

     

    Specifically, I have a font named "Eras Bd BT".  That's it's family name.  That's how it shows up in Flash CS6 and even in Flash CC as well in the font library.  However, at runtime, Flash CC will display nothing if the font name "Eras Bd BT" is supplied.  If you print out all the "fontName" property values when enumerating fonts with Font.enumerateFonts, you'll find that it lists a font named "Eras Bold BT", and says it's embedded.   So why this discrepancy?  Why does the font family name show up in the font library of Flash CC and Flash CS6 as "Eras Bd BT", but at runtime in Flash CC only (I'm opening the exact same file, btw), it suddenly fails to work at runtime and it's obviously why... it's using a different name for the font.  What is going on?

     
    |
    Mark as:
  • Currently Being Moderated
    Apr 17, 2014 3:46 PM   in reply to eigenface

    @ eigenface Unfortunately, such a workaround will not work for me.

     

    My "export classes in frame" option is set to frame 2 under ActionScript settings, because I'm using a preloader and want all the classes pushed to frame 2 unless they are used on frame 1 explicitly.   If I try to export the font for actionscript with a name like "ErasBdBT" and check the "export in frame 1" option (btw, it should say frame 2 like it does for non-font classes, so wtf), it ends up throwing a runtime error "ReferenceError: Error #1065: Variable ErasBdBT is not defined.", despite having a text field on frame 1 with the embedded font, which should force it onto that frame.  If I don't check "export in frame 1", it still doesn't show up.  I've tried every possible combination of font family name variation in code and on the on-stage text field, including selecting the embedded class name ending in a "*" in the properties window for the text field, and it just will not work in Flash CC.   In any case, it works fine in CS6, and any kind of workaround in CC will not work.  I absolutely cannot use Flash CC until these horrific bugs and inconsistences are fixed.

     
    |
    Mark as:
  • Currently Being Moderated
    Apr 17, 2014 4:07 PM   in reply to eigenface

    Ok, I actually just got it to work after I realized what was going on.

     

    The problem is actually strictly the difference in font names between CS6 and CC (at runtime only, since it actually displays the same name as CS6 in the designer).

     

    There is definitly a bug with the "export in frame 1" option for fonts, because it should reflect the frame number I select in the actionscript settings, just as it's reflected in the export options for all other library symbol types.  They must have just skipped over or forgot to ensure the font property's export for actionscript settings reflects the proper frame.  If I check the option "export in frame 1", my size report shows that the font is in fact exported on frame 2 as expected (hence the reference error when trying to use it on frame 1), so that's just a bug in the interface.

     

    Once I realized that much was just a bug in the interface, I unchecked the "export in frame 1" option, so that instead of being exported in frame 2, it would actually be exported in frame 1 thanks to the dummy text field using the font on the frame 1 for the preloader.

     

    As you suggested, the only way to get the REAL font name at runtime is to either instantiate the class or use the value returned by Font.enumerateFonts.   Using Font.enumerateFonts, I'd have to do a fuzzy match on the name to deal with differences in the expected name, so instantiating Font and checking the fontName is the only way to get embedded font names reliably in Flash CC.  This sucks, btw.

     

    I still don't know if I can even use Flash CC in this condition, because all of my content references font names that won't work in files compiled with Flash CC.

     

    The only place I can find "Eras Bold BT" in the system windows font directory is under the Details tab of the true type font file's properties, where it's "Title" attribute is "Eras Bold BT".  If instead I preview the font file with windows font preview, it shows the Font name is "Eras Bd BT".  So the question is, why is Flash CC using the font title instead of the actual font family name as it should be and does under all other circumstances except at runtime?
    fontnamediffers.png

     
    |
    Mark as:
  • Currently Being Moderated
    Apr 17, 2014 4:17 PM   in reply to eigenface

    I will, but it's not just the interface bug.   The core issue is that it's using the wrong font names.

     

    It's using the font title instead of the font family name.  That's perhaps why people were needing to add "Bold" and "Italic" to the ends of the font names, and it wasn't respecting the bold and italic properties of the TextFormat object.

     

    For example, a font like "Eras ITC" has a family name of "Eras ITC".  You should be able to use that same name for bold and italic versions via the text format object, but you can't in Flash CC, because it's opting to use the individual font titles like "Eras Bold ITC".  It's all very inconsistant.

     
    |
    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points