动作脚本3& amp;字体嵌入 [英] ActionScript 3 & font embedding

查看:89
本文介绍了动作脚本3& amp;字体嵌入的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在ActionScript 3项目(Flash CS4,不是flex)中正确嵌入字体时遇到问题.

I have a problem with doing proper font embedding in a actionscript 3 project (flash CS4, not flex).

我遵循此Adobe指南进行字体嵌入: http://www.adobe.com/devnet/flash/quickstart/embedding_fonts/

I followed this Adobe guide to do font embedding: http://www.adobe.com/devnet/flash/quickstart/embedding_fonts/

该指南告诉您将Textfield.embedFonts属性设置为true.如果这样做并尝试在此文本字段中显示具有其他字体的文本,则不会显示任何内容-很好,我希望这样.

the guide tells to set the Textfield.embedFonts property to true. if I do so and try to display a text with another font in this textfield, then nothing is displayed - that's fine, i expect it like this.

但是现在我有这个特殊的问题:

But now I have this particular problem:

我以常规样式嵌入了"Arial"字体,并在舞台上创建了两个输入Textfields.其中一个我将embedFonts属性设置为true(如指南中所述),另一个我保持原样.现在,我将其发布为swf,然后尝试在文本字段中输入以下(土耳其语)字符串

i embed the font "Arial" in Regular style and create two input Textfields on the stage. one of them i set the embedFonts property to true (as described in the guide) the other i leave as is. Now I publish the thing as swf and try to enter the following (Turkish) string into the textfield

YeniYılınBarışve Mutluluk Getirmesini Dileriz.

Yeni Yılın Barış ve Mutluluk Getirmesini Dileriz.

现在的问题是,未触摸的文本字段正确显示了字符串-但是embedFonts设置为true的字符串缺少某些字母(例如,未显示ş).但是Arial字体确实具有该字母,因为它在静态状态下可以正确显示-为什么当我设置此属性时(如指南中所述)它不能正确呈现?

now the problem is, that the untouched textfield displays the string correctly - but the one with embedFonts set to true is missing some of the letters (for example ş is not displayed). But the Arial font does have this letter since it is displayed correctly in static - so why does it not render correctly when i set this property (as told in the guide)?

在我的最终应用中,应该只有一个textField,但是要使用多种嵌入字体以及在它们之间进行切换的方式(例如,用户必须能够选择另一种字体来输入中文文本).

in my final app there shall be a single textField, but multiple embedded fonts and a way to switch between them (for example the user must be able to choose another font for entering chinese text).

有人可以告诉我如何正确执行吗?

can someone tell me how to do it properly?

谢谢!

推荐答案

我使用系统字体,并避免使用Arial等嵌入式字体.

I use the system fonts, and avoid the embedded ones like Arial.

  public function get availableFonts(): Array
  {
     var font: Font = null;
     var allFonts: Array = Font.enumerateFonts(true).sortOn("fontName", Array.CASEINSENSITIVE);
     var embeddedFonts: Array = Font.enumerateFonts(false);

     var excludeList: Object = {}
     for each(font in embeddedFonts)
     {
        excludeList[font.fontName] = '';
     }

     var ourFonts: Array = [];
     for each(font in allFonts)
     {
        if (!excludeList.hasOwnProperty(font.fontName))
        {
           ourFonts.push(font);
        }
     }

     return ourFonts;
  }

此返回的字体列表将包含所有字母.

The list of fonts that this returns are going to have all their letters.

(如果ActionScript内置一些更简单的设置差异方法,那会很好吗?)

(wouldn't it be nice if ActionScript had some easier way of doing set difference built in?)

这篇关于动作脚本3& amp;字体嵌入的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆