我正在尝试将特定的Font系列添加到我的应用程序中,但我不确定如何正确嵌入我的字体?
我确实遵循了此tutorial
但我在这一行得到错误:
[Embed(source="C:\\WINDOWS\\Fonts\\Bebas_Neue_Regular.OTF", fontFamily="Bebas_Neue")]
错误是:
Scene 1, Layer 'Code', Frame 3, Line 2 An Embed variable must not have an existing value.
此应用程序适用于Air Ios。我做错了什么?
答案 0 :(得分:2)
以编程方式在代码中,当链接到字体文件或系统字体时,我遵循以下模式:
/**
* U+0020-U+002F, Space + Punctuation [ !"#$%&'()*+,-./ ]
* U+0030-U+0039, Numbers [0..9]
* U+003A-U+0040, Special Chars [ :;<=>?@ ]
* U+0041-U+005A, Upper-Case [A..Z]
* U+005B-U+0060, Special Chars [ [\]^_` ]
* U+0061-U+007A, Lower-Case a-z
* U+007B-U+007E, Special Chars [ {|}~ ]
* U+00A1-U+00A1, Latin Character: ¡
* U+00A3-U+00A3, British Pound Symbol
* U+00A9-U+00A9, Copyright Symbol
* U+00AE-U+00AE, Registered Symbol
* U+00B0-U+00B0, Degrees Symbol
* U+00BC-U+00BE, Fractions Symbols
* U+00BF-U+00BF, Latin Character: ¿
* U+00C0-U+00FF, Latin Characters
* U+2013-U+2014, EN Dash, EM Dash
* U+2018-U+2019, Directional Single Quotes
* U+201C-U+201D, Directional Double Quotes
* U+2022-U+2023, Bullets
* U+2120-U+2120, SM
* U+2122-U+2122 Trade mark (TM)
*/
[Embed(systemFont = "Arial", fontWeight = "Regular", fontName = "Arial", mimeType = "application/x-font", embedAsCFF = "false", unicodeRange = "U+0020-U+002F,U+0030-U+0039,U+003A-U+0040,U+0041-U+005A,U+005B-U+0060,U+0061-U+007A,U+007B-U+007E,U+00A1-U+00A1,U+00A3-U+00A3,U+00A9-U+00A9,U+00AE-U+00AE,U+00B0-U+00B0,U+00BC-U+00BE,U+00BF-U+00BF,U+00C0-U+00FF,U+2013-U+2014,U+2018-U+2019,U+201C-U+201D,U+2022-U+2023,U+2120-U+2120,U+2122-U+2122")]
private static const ArialClass:Class;
然后,可以将TextFormat创建为:
Font.registerFont(ArialClass);
var tf:TextFormat = new TextFormat();
tf.font = "Arial";
tf.bold = bold;
tf.size = size;
tf.color = color;
tf.align = TextFormatAlign.LEFT;
使用Flash Pro,可以在库中拖放字体,或者右键单击并选择新字体...
可以从字体嵌入窗口设置属性:
Flash Pro的GUI使字体嵌入变得容易,字体可以作为SWC发布,以便链接到Flash Pro创作环境之外的其他项目。