Flex:如何使用 CSS 嵌入字体
我有两个问题:
我正在尝试通过 嵌入字体实时文档中的此页面。
- 谁能告诉我需要做什么才能使用外部样式表? 应该是样式表还是 mxml 文件? 我看到了本教程,它提供了相当多的好信息(其中一些我还通过评论在 livedocs 中找到)。
编辑:这就是我正在尝试的...
我有一个实例化的类:
private var myTextDraw:TextSpriteDraw = new TextSpriteDraw();
如何让这个类使用我刚刚嵌入的字体?有关我正在尝试的详细信息,请参阅下文...
这是我尝试调用 mxml 文件的方式:
<mx:Style source="..assets/fontSpecifications.mxml" />
这是我的 xml:
<?xml version="1.0"?>
<!-- specification for how to embed fonts -->
<mx:Application xmlns: mx="http://www.adobe.com/2006/mxml">
<mx:Style>
@font-face: {
src: url("location") | local("name");
fontFamily: 'myTimesFont', "_serif";
color: black;
fontStyle: normal;
fontWeight: normal;
advancedAntiAliasing: false;
}
</mx:Style>
<mx:Script>
[ Embed(source='../assets/Times.dfont', fontName='myTimesFont', mimeType='application/x-font') ]
</mx:Script>
<mx:Application>
现在我不明白的是如何使用我嵌入的字体(或者如果我什至做得正确...请注意,我想做的就是让一个带有“Times”的 TextField() 在我更改其 alpha 时表现正常):
I have two questions:
I am trying to embed fonts via this page in the livedocs.
- Can anyone tell me what I need to do to use an external style sheet? Should it be a style sheet or an mxml file?
I saw this tutorial, which offers quite a bit of good information (some of which I also found in the livedocs) via the comments.
EDIT: here is what I am trying...
I have a class that I instantiate:
private var myTextDraw:TextSpriteDraw = new TextSpriteDraw();
How can I let this class use the font I have just embedded? See below for details on what I am trying...
Here is how I am attempting to call up the mxml file:
<mx:Style source="..assets/fontSpecifications.mxml" />
Here is my xml:
<?xml version="1.0"?>
<!-- specification for how to embed fonts -->
<mx:Application xmlns: mx="http://www.adobe.com/2006/mxml">
<mx:Style>
@font-face: {
src: url("location") | local("name");
fontFamily: 'myTimesFont', "_serif";
color: black;
fontStyle: normal;
fontWeight: normal;
advancedAntiAliasing: false;
}
</mx:Style>
<mx:Script>
[ Embed(source='../assets/Times.dfont', fontName='myTimesFont', mimeType='application/x-font') ]
</mx:Script>
<mx:Application>
Now what I don't understand is how to use the font that I have embedded (or if I am even doing this properly... note that all i want to do is get a TextField() w/ 'Times' to behave properly when I change its alpha):
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
可以通过执行
来使用外部样式表关于第二个问题,我不确定您在问什么。您是否想知道应该使用 Flex 框架还是纯 AS3 项目?或者 Flash IDE 中的工具与 Flex Builder 中用于处理字体的工具?
=瑞安
[电子邮件受保护]
The external style sheet can be used by doing
<mx:Style source="my/css/Style.css" />
On the second question I'm not sure what you're asking. Are you wondering if you should use the Flex Framework or a pure AS3 project? Or the tools in the Flash IDE versus Flex Builder for dealing with fonts?
=Ryan
[email protected]