AS3 textformat, embedfonts and multiple fonts?

1.5k Views Asked by At

Here is my issue : I have a dynamic html text field, to which i passed html text / textformat such as :

<P ALIGN="LEFT"><FONT FACE="Trebuchet MS" SIZE="14" COLOR="#000000" LETTERSPACING="0" KERNING="0">Some text<B>some bold text</B><I><U>and some italic underline</U></I></FONT></P>

My problem is, i can't use embedfonts because if i do, and use Trebuchet MS for instance, the bold tag will never render as in flash you have to select if the font your embed is bold or not. I'm trying to avoid to convert the whole htmltext/textformat thing to a CSS one..

Any ideas?

1

There are 1 best solutions below

2
On

You need to make sure all versions of the font (regular, bold, italic, whatever) have been compiled into the SWF.

An easy way to do this is to create some dynamic TextFields (one for each version of the font you want to embed) and place them on stage somewhere out of sight at the start of your movie (for example on the root timeline, frame 1, at x = -100). Make sure they appear in your movie before you display the rest of your text, and make sure you embed the relevant character ranges.

This forces Flash to compile all versions of the font, not just the version you happen to have in your actual TextField you want to display.