0

I'm embedding a font in AS3 with the following command:

[Embed(source="../font/font1.swf", fontName = "FontName1", fontWeight = "bold" )]
private var myEmbeddedFont:Class;

var _tf: TextFormat;

_tf = new TextFormat();
_tf.color = 0x000000;
_tf.size = 18;
_tf.font = "FontName1";

Now I would like to embedd a second font which is the same font but not bold. My problem now is: Both vonts (the bold one and the non-bold) have the same name.

What can I do to use both fonts? In the embedding-command fontName="" must be the "real" name of the font. Is there some Kind of an alias I can set for the font-name?

vigri
  • 475
  • 1
  • 5
  • 16
  • where did you read that it must be the "real" name of the font, in my experience this isn't the case: http://divillysausages.com/blog/as3_font_embedding_masterclass – shaunhusain Feb 09 '13 at 00:42
  • You can always get dirty and make 2 different font files. Or follow this: http://www.kirupa.com/forum/showthread.php?257913-AS3-Embedding-multiple-members-of-a-font-family – David Feb 09 '13 at 03:56

2 Answers2

0

There is nothing like you have to set the "Real" name of the font to set, you can use alias for your fonts.

Like : for ARIEL(normal) : font Name : Ariel

for ARIEL(bold) : font Name : Ariel_Bold

Vipul
  • 431
  • 1
  • 5
  • 16
0

you want to use fontFamily and not fontName. Also, why is your font an .swf? here's what I use :

    [Embed(source="../font/font1.ttf", embedAsCFF="false", fontFamily="FontName1")]
    private static const Font:Class;
    [Embed(source="../font/font1_Bd.ttf", embedAsCFF="false", fontFamily="FontName1", fontWeight="bold")]
    private static const FontBold:Class;

With that, AS3 should be able to display both normal anf bold text with your font.

Boris
  • 1,161
  • 9
  • 20