在 Flash 中嵌入字体并正确显示时出现问题

发布于 2024-08-07 21:03:06 字数 2256 浏览 8 评论 0原文

我正在寻找正确的文本字段参数或解决方法来解决我在这里处理 Flash 字体和字体的最新问题。文本字段。

我有一个 textFormat 和 textField 生成一些使用字体的文本:Franklin Gothic Book point size 8。目前,这是我运行电影时字体的外观:

alt text
(来源:flickr.com

底部®MYLOGO 是来自 Photoshop 的 jpg,干净且具有应有的外观。接下来是在Flash中直接在舞台上输入的字体,最上面的®MYLOGO是由我的代码生成的。

为了使代码生成的副本看起来尽可能接近 Jpeg,我缺少哪些参数?

我的代码如下:

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);

你们可能还记得我的上一个问题 X_x


固定工作核心:感谢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)

图形示例:

正常

alt text

高级

替代文字

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:

alt text
(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:

NORMAL

alt text

ADVANCED

alt text

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

在 Flash 中控制文本渲染有时很痛苦...

您需要考虑几个属性:antiAliasTypegridFitTypesharpnessthickness TextField。尝试 Adobe 的示例。或者更详细的教程

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.

抚你发端 2024-08-14 21:03:06

尝试添加以下代码:

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

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

Try to add this code:

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

or

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

乙白 2024-08-14 21:03:06

是的,请确保您检查别名,但如果这不起作用,我会尝试调用:

tsLogo.setTextFormat(tsFont)

在设置文本后立即调用。该函数会将字体应用于字段中的文本。

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文