在 Actionscript 中作为资源嵌入时 Verdana 出现问题
我通常为每种字体创建 1 个 .as 文件,并将这些 .as 文件导出为 swf,然后加载到 Flash 项目中。这样我就可以选择要嵌入的字符。
现在,我测试从 Windows 字体文件夹复制 verdana ttf 字体文件并将其嵌入以创建 Verdana swf 字体文件。
当我测试运行它时,我尝试使用一些带点的瑞典字符(åäö ÅäÖ)。其中一些字符的字符上方的点位置略有偏移(例如向右或向左几个像素)。有人遇到同样的问题吗?
示例代码:
[Embed(source = 'fontfiles/verdana.ttf', fontName = 'Verdana', mimeType="application/x-font-truetype", unicodeRange = 'U+00-U+FF')]
public static var font:Class;
public function Verdana()
{
Font.registerFont(font);
var tf:TextField = new TextField();
tf.embedFonts = true;
tf.autoSize = TextFieldAutoSize.LEFT;
tf.defaultTextFormat = new TextFormat("Verdana", 30);
tf.text = "abc åäö ÅÄÖ";
addChild(tf);
}
I'm usually creating 1 .as file per font and exports these .as files to swf's that I load in to my flash projects. This way I can choose what characters to embed.
Now I tested copying my verdana ttf fontfiles from my Windows font folder and embedded this to create a Verdana swf fontfile.
When I tested running this I tried with some swedish characters with dots (åäö ÅÄÖ). The dots above the characters from some of these charcters was positioned slightly offset (like a few pixels to the right or left). Anyone had the same problem?
Example code:
[Embed(source = 'fontfiles/verdana.ttf', fontName = 'Verdana', mimeType="application/x-font-truetype", unicodeRange = 'U+00-U+FF')]
public static var font:Class;
public function Verdana()
{
Font.registerFont(font);
var tf:TextField = new TextField();
tf.embedFonts = true;
tf.autoSize = TextFieldAutoSize.LEFT;
tf.defaultTextFormat = new TextFormat("Verdana", 30);
tf.text = "abc åäö ÅÄÖ";
addChild(tf);
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
更改
为:
看来这确实使它起作用了。
Changed:
To:
Seems like this did make it work.