문제

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?

도움이 되었습니까?

해결책

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.

다른 팁

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

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top