在 Flash 中嵌入字体并正确显示时出现问题
我正在寻找正确的文本字段参数或解决方法来解决我在这里处理 Flash 字体和字体的最新问题。文本字段。
我有一个 textFormat 和 textField 生成一些使用字体的文本:Franklin Gothic Book point size 8。目前,这是我运行电影时字体的外观:
(来源: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)
图形示例:
正常
高级
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:
(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
ADVANCED
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
在 Flash 中控制文本渲染有时很痛苦...
您需要考虑几个属性:
antiAliasType
、gridFitType
、sharpness
、thickness
。尝试 Adobe 的示例。或者更详细的教程。TextField
的Controlling text rendering in Flash is painful sometime...
You need to play around several properties:
antiAliasType
,gridFitType
,sharpness
,thickness
of theTextField
. Try Adobe's example. Or a even more detailed tutorial.尝试添加以下代码:
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;
是的,请确保您检查别名,但如果这不起作用,我会尝试调用:
在设置文本后立即调用。该函数会将字体应用于字段中的文本。
Yes make sure you check the Aliasing, but if that doesn't do it I would try calling:
Right after you set the text. That function will apply the font to the text in the field.