开发者

Problem embedding font and displaying it correctly in Flash

I'm looking for the right textfield parameters or work-around for my latest problem here dealing with Flash fonts & text fields.

I have a textFormat and textField generation some text using the Font: Franklin Gothic Book point size 8. Currently this is how the font will look when I run the movie:

Problem embedding font and displaying it correctly in Flash

(source: flickr.com)

The bottom ®MYLOGO is a jpg from Photoshop, clean and how it should look. Next up is the font directly typed on the stage in Flash, and the very top ®MYLOGO is generated from my code.

What parameters am I missing to make the code generated copy look as close as possible to the Jpeg?

My Code below:

var tsFont = new TextFormat();
    tsFont.font = FranklinGothic;
    tsFont.size = 8;
    tsFont.color = 0xFFFFFF;
    tsFont.align = TextFormatAlign.LEFT;

var tsLogo:TextField = new TextField();
    tsLogo.defaultTextFormat = tsFont;
    tsLogo.selectable = false;
    tsLogo.mouseEnabled = false;
    tsLogo.x = 18;
    tsLogo.y = 98;
    tsLogo.width = 64;
    tsLogo.height = 16;
    tsLogo.text = "®MYLOGO";

    addChild(tsLogo);

You guys may remember this code from my last question X_x


FIXED WORKING CORE: thx to Andy Li

var tsFont = new TextFormat();
    tsFont.font = (new FranklinGothic() as Font).fontName;
    tsFont.size = 8;
    tsFont.color = 0xFFFFFF;
    tsFont.align = TextFormatAlign.LEFT;

var tsLogo:TextField = new TextField();
    tsLogo.selectable        = false;
    tsLogo.mouseEnabled      = false;
    tsLogo.embedFonts        = true;
    tsLogo.antiAliasType     = flash.text.AntiAliasType.NORMAL;
    tsLogo.gridFitType       = "pixel";
    tsLogo.sharpness         = 400
    tsLogo.x                 = 6;
    tsLogo.y                 = 5;
    tsLogo.width             = 600;
    tsLogo.height            = 40;
    tsLogo.text              = "®MYLOGO";
    tsLogo.setTextFormat(tsFont)

Graphic Examples:

开发者_StackOverflow

NORMAL

Problem embedding font and displaying it correctly in Flash

ADVANCED

Problem embedding font and displaying it correctly in Flash


Controlling text rendering in Flash is painful sometime...

You need to play around several properties: antiAliasType, gridFitType, sharpness, thickness of the TextField. Try Adobe's example. Or a even more detailed tutorial.


Try to add this code:

tsLogo.antiAliasType = flash.text.AntiAliasType.NORMAL;

or

tsLogo.antiAliasType = flash.text.AntiAliasType.ADVANCED;


Yes make sure you check the Aliasing, but if that doesn't do it I would try calling:

tsLogo.setTextFormat(tsFont)

Right after you set the text. That function will apply the font to the text in the field.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜