views:

409

answers:

2

Wow, this one is really weird.

I have the following setup:

Two textfields on the stage with Arial normal and Arial bold, both embedded. I then have another textfield which I am setting like so:

tb.htmlText = "Test <b>Test</b>";

For some reason, the bold text is not displaying as bold, but as regular weight. I have tried embedding the fonts in the library, using the [Embed] meta tag and even resorted to using CSS to force the fontFamily. Weirdly, I can use Font.enumurateFonts and see both fonts are embedded, but the textfield refused to use the bold version inside the < b > tags.

I've been told this is a problem with Flash CS4 on a mac and that it will work on PC. I refuse to believe this is the case, however. Surely Adobe would have fixed this by now?

Any help would be appreciated.

A: 

From Adobe:

The bold b tag renders text as bold. If you use embedded fonts, a boldface font must be available for the font or no text appears. If you use fonts that you expect to reside on the local system of your users, their system may approximate a boldface font if none exists, or it may substitute the normal font face instead of boldface.

Try it with an embedded font that has a boldface. The b tag is supported.

Todd Moses
+1  A: 

You've gotta have the 'bold' font in the Font list ( embbed in the same or in other textfield ) :

var fonts:Array =  ( Font.enumerateFonts() );
for each( var fo in fonts ){
   trace ( fo.fontName ,":", fo.fontStyle )
}

I think that if you had the fontstyle returning as bold it probably should work with no prob. Here's a solution:

var css:StyleSheet = new StyleSheet()
css.setStyle( "bold" , { fontFamily:"Myriad Pro Bold" } ) // you can catch the fontname in the list that was printed by the code above...
txtfield.styleSheet = css;
txtfield.htmlText = "regular or<bold>bold font</bold>."
qwerty