Flex 未嵌入特殊字符
我正在使用以下代码将 Arial 嵌入到我的应用程序中:
[Embed(source='../assets/fonts/Arial.ttf',fontFamily='CustomFont',fontWeight='regular',
unicodeRange='U+0020-U+0040,U+0041-U+005A,U+005B-U+0060,U+0061-U+007A,U+007B-U+007E,U+0080-U+00FF,U+0100-U+017F,U+0400-U+04FF,U+0370-U+03FF,U+1E00-U+1EFF,U+2022,U+2219,U+20AC-U+21AC',
mimeType='application/x-font-truetype'
)]
public static var MY_FONT:Class;
[Embed(source='../assets/fonts/Arial Bold.ttf',fontFamily='CustomFont',fontWeight='bold',
unicodeRange='U+0020-U+0040,U+0041-U+005A,U+005B-U+0060,U+0061-U+007A,U+007B-U+007E,U+0080-U+00FF,U+0100-U+017F,U+0400-U+04FF,U+0370-U+03FF,U+1E00-U+1EFF,U+2022,U+2219,U+20AC-U+21AC',
mimeType='application/x-font-truetype'
)]
public static var MY_FONT_BOLD:Class;
[Embed(source='../assets/fonts/Arial Italic.ttf',fontFamily='CustomFont',fontWeight='regular',fontStyle="italic",
unicodeRange='U+0020-U+0040,U+0041-U+005A,U+005B-U+0060,U+0061-U+007A,U+007B-U+007E,U+0080-U+00FF,U+0100-U+017F,U+0400-U+04FF,U+0370-U+03FF,U+1E00-U+1EFF,U+2022,U+2219,U+20AC-U+21AC',
mimeType='application/x-font-truetype'
)]
public static var MY_FONT_ITALIC:Class;
[Embed(source='../assets/fonts/Arial Bold Italic.ttf',fontFamily='CustomFont',fontWeight='bold',fontStyle="italic",
unicodeRange='U+0020-U+0040,U+0041-U+005A,U+005B-U+0060,U+0061-U+007A,U+007B-U+007E,U+0080-U+00FF,U+0100-U+017F,U+0400-U+04FF,U+0370-U+03FF,U+1E00-U+1EFF,U+2022,U+2219,U+20AC-U+21AC',
mimeType='application/x-font-truetype'
)]
public static var MY_FONT_ITALIC_BOLD:Class;
[Embed(source='../assets/fonts/Arial Unicode.ttf',fontFamily='CustomFont',fontWeight='regular',
unicodeRange='U+0020-U+0040,U+0041-U+005A,U+005B-U+0060,U+0061-U+007A,U+007B-U+007E,U+0080-U+00FF,U+0100-U+017F,U+0400-U+04FF,U+0370-U+03FF,U+1E00-U+1EFF,U+2022,U+2219,U+20AC-U+21AC',
mimeType='application/x-font-truetype'
)]
public static var MY_FONT_UNICODE:Class;
它对于外来字符工作正常,但没有特殊字符(版权、商标、欧元符号等)工作。有人可以帮忙吗?我已经检查了我的 unicode 范围,它们应该可以正常工作!
I am using the following code to embed Arial into my application:
[Embed(source='../assets/fonts/Arial.ttf',fontFamily='CustomFont',fontWeight='regular',
unicodeRange='U+0020-U+0040,U+0041-U+005A,U+005B-U+0060,U+0061-U+007A,U+007B-U+007E,U+0080-U+00FF,U+0100-U+017F,U+0400-U+04FF,U+0370-U+03FF,U+1E00-U+1EFF,U+2022,U+2219,U+20AC-U+21AC',
mimeType='application/x-font-truetype'
)]
public static var MY_FONT:Class;
[Embed(source='../assets/fonts/Arial Bold.ttf',fontFamily='CustomFont',fontWeight='bold',
unicodeRange='U+0020-U+0040,U+0041-U+005A,U+005B-U+0060,U+0061-U+007A,U+007B-U+007E,U+0080-U+00FF,U+0100-U+017F,U+0400-U+04FF,U+0370-U+03FF,U+1E00-U+1EFF,U+2022,U+2219,U+20AC-U+21AC',
mimeType='application/x-font-truetype'
)]
public static var MY_FONT_BOLD:Class;
[Embed(source='../assets/fonts/Arial Italic.ttf',fontFamily='CustomFont',fontWeight='regular',fontStyle="italic",
unicodeRange='U+0020-U+0040,U+0041-U+005A,U+005B-U+0060,U+0061-U+007A,U+007B-U+007E,U+0080-U+00FF,U+0100-U+017F,U+0400-U+04FF,U+0370-U+03FF,U+1E00-U+1EFF,U+2022,U+2219,U+20AC-U+21AC',
mimeType='application/x-font-truetype'
)]
public static var MY_FONT_ITALIC:Class;
[Embed(source='../assets/fonts/Arial Bold Italic.ttf',fontFamily='CustomFont',fontWeight='bold',fontStyle="italic",
unicodeRange='U+0020-U+0040,U+0041-U+005A,U+005B-U+0060,U+0061-U+007A,U+007B-U+007E,U+0080-U+00FF,U+0100-U+017F,U+0400-U+04FF,U+0370-U+03FF,U+1E00-U+1EFF,U+2022,U+2219,U+20AC-U+21AC',
mimeType='application/x-font-truetype'
)]
public static var MY_FONT_ITALIC_BOLD:Class;
[Embed(source='../assets/fonts/Arial Unicode.ttf',fontFamily='CustomFont',fontWeight='regular',
unicodeRange='U+0020-U+0040,U+0041-U+005A,U+005B-U+0060,U+0061-U+007A,U+007B-U+007E,U+0080-U+00FF,U+0100-U+017F,U+0400-U+04FF,U+0370-U+03FF,U+1E00-U+1EFF,U+2022,U+2219,U+20AC-U+21AC',
mimeType='application/x-font-truetype'
)]
public static var MY_FONT_UNICODE:Class;
It's working fine for foreign characters, but no special characters (copyright, trademark, euro sign etc) are working. Can anyone help? I've checked my unicode ranges, they should work fine!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
如果您没有指定 unicode 范围,那么字符是否会出现(我不建议以这种方式启动,只是为了测试)。如果它们没有嵌入完整的字体,则可能您的字体版本不包含这些字符。 Arial Unicode 至少应该包含版权,它的代码是 U+00A9,我认为它包含在您的范围中,但您可以尝试显式包含该数字,即添加:U+00A9-U+00A9。
您可能会发现此 AIR 应用程序可以方便地确定 unicode 范围: http://undefined-type.com/tag /unicode/
If you don't specify a unicode range, do the characters appear (I'm not suggesting to launch this way, merely for testing). If they don't appear with the full font embedded, maybe your version of the font doesn't contain the characters. Arial Unicode should contain the copyright at least though, it's code is U+00A9, which I think is included in your ranges but you could try explicitly including that number, ie adding: U+00A9-U+00A9.
You might find this AIR app handy for determining unicode ranges: http://undefined-type.com/tag/unicode/
我建议使用外部库来获取字体,特别是。如果嵌入了 unicode 字符,请考虑它们的权重。有一个相当简单的 AS3 脚本来嵌入系统字体,例如 Impact:
您可以从 http://tekkie.flashbit.net/flash/as/embed-system-fonts-with-flex-sdk
I'd suggest using external libraries for fonts esp. considering their weight if unicode chars are embedded. There's a rather trivial AS3 script to embed a system font, e.g. Impact:
You can get the above *.as from http://tekkie.flashbit.net/flash/as/embed-system-fonts-with-flex-sdk