Linux下ActionScript3字体编译转码错误
因此,在 Windows 上的 Flash Builder 中,我的应用程序和所有嵌入字体都可以正常编译。
但是,当我尝试在我的生产 Linux 服务器上构建它时(通过使用 make
的命令行上的 Makefile),编译在对字体进行转码时失败:
/home/me/MyFlexProject/SomeModule/src/Fonts.as(29): Error: exception during
transcoding: Font for alias 'HelveticaRounded LT Std Blk' with plain weight
and style was not found at:
file:/home/me/MyFlexProject/SomeModule/src/assets/fonts/HelveticaRoundedLTStd-Black.otf
[Embed(source='/assets/fonts/HelveticaRoundedLTStd-Black.otf',
fontName='HelveticaRounded LT Std Blk',
mimeType='application/x-font',embedAsCFF='false')]
我尝试过的事情:
使用不同的字体管理器,通过“-managers=flash.fonts.AFEFontManage”。
使用不同的字体,但它会给出与常见错误略有不同的版本,请参阅:
错误:转码期间出现异常:在以下位置找不到具有普通粗细和样式的别名“xxx”的字体:文件:...
使用 < code>fontforge,我想我已经将问题缩小到这样一个事实:显然在字体文件中定义了“Windows”和“Mac”名称。这似乎是可能的罪魁祸首,因为在 Windows 上字体编译得很好,但在 Linux 上它再也找不到同名的字体。然而,即使当我在 Linux 上改用“Mac”名称时,我仍然遇到相同的错误,即无法找到具有所请求名称的字体。
我想找出到底发生了什么导致转码无法发生。
以下是相关字体的链接: http://jetlib.com/HelveticaRoundedLTStd-Black.otf< /a>
为了更好地衡量,这里是 Fonts.as:
package ...
{
import flash.text.Font;
public class Fonts
{
[Embed(source='/assets/fonts/HelveticaRoundedLTStd-Black.otf',
fontNam e='HelveticaRounded LT Std Blk', fontWeight='normal',
mimeType='application/x-font',embedAsCFF='false')]
private static var _font1:Class;
/**
* register fonts with the font manager to be
* used in modules and sub applications
*/
public static function registerFonts():void
{
Font.registerFont(_font1);
}
}
}
任何帮助、想法或见解将不胜感激!
使用 fontWeight='bold' 输出:
/home/me/MyFlexProject/SomeModulesrc/Fonts.as(23): Error: exception during transcoding: Font for alias 'HelveticaRounded LT Std Blk' with bold weight was not found at: file:/home/me/MyFlexProject/SomeModulesrc/assets/fonts/HelveticaRoundedLTStd-Black.otf
[Embed(source='/assets/fonts/HelveticaRoundedLTStd-Black.otf',fontName='HelveticaRounded LT Std Blk',fontWeight='bold',mimeType='application/x-font',embedAsCFF='false')]
/home/me/MyFlexProject/SomeModulesrc/Fonts.as(23): col: 3: Error: unable to build font 'HelveticaRounded LT Std Blk'
[Embed(source='/assets/fonts/HelveticaRoundedLTStd-Black.otf',fontName='HelveticaRounded LT Std Blk',fontWeight='bold',mimeType='application/x-font',embedAsCFF='false')]
^
/home/me/MyFlexProject/SomeModulesrc/Fonts.as(23): col: 3: Error: Unable to transcode /assets/fonts/HelveticaRoundedLTStd-Black.otf.
使用 fontWeight='normal' 输出:
/home/me/MyFlexProject/SomeModulesrc/Fonts.as(23): Error: exception during transcoding: Font for alias 'HelveticaRounded LT Std Blk' with plain weight and style was not found at: file:/home/me/MyFlexProject/SomeModulesrc/assets/fonts/HelveticaRoundedLTStd-Black.otf
[Embed(source='/assets/fonts/HelveticaRoundedLTStd-Black.otf',fontName='HelveticaRounded LT Std Blk',fontWeight='normal',mimeType='application/x-font',embedAsCFF='false')]
/home/me/MyFlexProject/SomeModulesrc/Fonts.as(23): col: 3: Error: unable to build font 'HelveticaRounded LT Std Blk'
[Embed(source='/assets/fonts/HelveticaRoundedLTStd-Black.otf',fontName='HelveticaRounded LT Std Blk',fontWeight='normal',mimeType='application/x-font',embedAsCFF='false')]
^
/home/me/MyFlexProject/SomeModulesrc/Fonts.as(23): col: 3: Error: Unable to transcode /assets/fonts/HelveticaRoundedLTStd-Black.otf.
So, in Flash Builder on Windows, my app and all embedded fonts compile just fine.
But when I try to build it on my production Linux server (via a Makefile on the command line using make
), compilation fails while transcoding the fonts:
/home/me/MyFlexProject/SomeModule/src/Fonts.as(29): Error: exception during
transcoding: Font for alias 'HelveticaRounded LT Std Blk' with plain weight
and style was not found at:
file:/home/me/MyFlexProject/SomeModule/src/assets/fonts/HelveticaRoundedLTStd-Black.otf
[Embed(source='/assets/fonts/HelveticaRoundedLTStd-Black.otf',
fontName='HelveticaRounded LT Std Blk',
mimeType='application/x-font',embedAsCFF='false')]
Things I have tried:
Using a different font manager, via "-managers=flash.fonts.AFEFontManage".
Using different fonts, but it either gives a slightly different version of the usual error, see:
Error: exception during transcoding: Font for alias 'xxx' with plain weight and style was not found at: file:...
Looking at the font using fontforge
, I think I've narrowed the problem down to the fact that apparently within the font file there are both "Windows" and "Mac" names defined. This seems like the possible culprit since on Windows the font compiles fine, but then on Linux it can no longer find a font with the same name. However, even when I switched to using the "Mac" name on Linux, I still get the same error about not being able to find a font with the requested name.
I want to find out what is going on that is preventing the transcoding from being able to happen.
Here is a link to the font in question: http://jetlib.com/HelveticaRoundedLTStd-Black.otf
For good measure, here is Fonts.as:
package ...
{
import flash.text.Font;
public class Fonts
{
[Embed(source='/assets/fonts/HelveticaRoundedLTStd-Black.otf',
fontNam e='HelveticaRounded LT Std Blk', fontWeight='normal',
mimeType='application/x-font',embedAsCFF='false')]
private static var _font1:Class;
/**
* register fonts with the font manager to be
* used in modules and sub applications
*/
public static function registerFonts():void
{
Font.registerFont(_font1);
}
}
}
Any help, thoughts, or insights would be GREATLY appreciated!
Output using fontWeight='bold':
/home/me/MyFlexProject/SomeModulesrc/Fonts.as(23): Error: exception during transcoding: Font for alias 'HelveticaRounded LT Std Blk' with bold weight was not found at: file:/home/me/MyFlexProject/SomeModulesrc/assets/fonts/HelveticaRoundedLTStd-Black.otf
[Embed(source='/assets/fonts/HelveticaRoundedLTStd-Black.otf',fontName='HelveticaRounded LT Std Blk',fontWeight='bold',mimeType='application/x-font',embedAsCFF='false')]
/home/me/MyFlexProject/SomeModulesrc/Fonts.as(23): col: 3: Error: unable to build font 'HelveticaRounded LT Std Blk'
[Embed(source='/assets/fonts/HelveticaRoundedLTStd-Black.otf',fontName='HelveticaRounded LT Std Blk',fontWeight='bold',mimeType='application/x-font',embedAsCFF='false')]
^
/home/me/MyFlexProject/SomeModulesrc/Fonts.as(23): col: 3: Error: Unable to transcode /assets/fonts/HelveticaRoundedLTStd-Black.otf.
Output with fontWeight='normal':
/home/me/MyFlexProject/SomeModulesrc/Fonts.as(23): Error: exception during transcoding: Font for alias 'HelveticaRounded LT Std Blk' with plain weight and style was not found at: file:/home/me/MyFlexProject/SomeModulesrc/assets/fonts/HelveticaRoundedLTStd-Black.otf
[Embed(source='/assets/fonts/HelveticaRoundedLTStd-Black.otf',fontName='HelveticaRounded LT Std Blk',fontWeight='normal',mimeType='application/x-font',embedAsCFF='false')]
/home/me/MyFlexProject/SomeModulesrc/Fonts.as(23): col: 3: Error: unable to build font 'HelveticaRounded LT Std Blk'
[Embed(source='/assets/fonts/HelveticaRoundedLTStd-Black.otf',fontName='HelveticaRounded LT Std Blk',fontWeight='normal',mimeType='application/x-font',embedAsCFF='false')]
^
/home/me/MyFlexProject/SomeModulesrc/Fonts.as(23): col: 3: Error: Unable to transcode /assets/fonts/HelveticaRoundedLTStd-Black.otf.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
使用和不使用
fontWeight='bold'
都会失败吗?您的两个片段不同地包含和省略该行。两者之一是正确的。编辑:显然这两种情况都失败了。我什么都没有了
Is it failing both with and without
fontWeight='bold'
? Your two snippets variably include and omit that line. One of the two is correct.Edit: apparently it fails in both cases. I've got nothin'.
我只能猜测,因为我还没有尝试在 Linux 上嵌入字体。但据我所知,字体管理器的行为取决于操作系统,因为每个操作系统都有不同的字体 API,这些 API 会呈现给 Flex 的底层 Java 框架。
fontWeight 参数可能因平台而异。
您是否尝试过“Black”作为 fontWeight 的值?
如果我的猜测是正确的,字体管理器无法向系统询问该字体的粗细,并尝试查找 otf 内的粗细。但 otf 将“Black”定义为其权重。
我希望这有帮助,亲切的问候......
I can only guess as I haven't yet tried to embed fonts on Linux. But from what I know, the behaviour of the font-manager is dependant on the OS as every Operating System has a different font API that is presented to the underlying Java framework of Flex.
The fontWeight parameters can differ from platform to platform.
Have you tried "Black" as the value for fontWeight?
If my guess is right, the font-manager could not ask the system for the weight of this font and tried to find the weight inside the otf. But the otf has "Black" defined as its weight.
I hope this helps, kind regards...
我在 RedHat 5.5 版本上遇到了同样的问题。
我转移到 Ubuntu 11,编译没有任何问题。
I've had the same issue on RedHat release 5.5 .
I moved to Ubuntu 11 and it compiled with no problems.
确保您没有覆盖默认的 Flex 配置文件。
如果您需要一些配置属性,请附加它们
在附加编译器参数中:
-load-config+=configFile.xml
而不是
-加载配置configFile.xml
解决了我们的烦恼
Be sure you are not overwriting the default flex config file.
If you need some config property append them
in Additionnal compiler arguments :
-load-config+=configFile.xml
rather than
-load-config configFile.xml
It solve our trouble