编译含有嵌入字体的手机应用程序时,默认情况下,Flex 将使用非 CFF 字体。CFF 字体使用 FTE。通常情况下,在手机应用程序中应避免使用 FTE。
由于 Label 控件使用 FTE(并因此使用 CFF 字体),因此在手机应用程序中嵌入字体时应使用 TextArea 或 TextInput 控件。
在 CSS 中,将
embedAsCFF 设置为
false,如下面的示例所示:
<?xml version="1.0" encoding="utf-8"?>
<!-- mobile_text/Main.mxml -->
<s:ViewNavigatorApplication xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
firstView="views.EmbeddingFontsView">
<fx:Style>
@namespace s "library://ns.adobe.com/flex/spark";
@font-face {
src: url("../assets/MyriadWebPro.ttf");
fontFamily: myFontFamily;
embedAsCFF: false;
}
.customStyle {
fontFamily: myFontFamily;
fontSize: 24;
}
</fx:Style>
</s:ViewNavigatorApplication>
EmbeddingFontView 视图的 TextArea 控件应用类型选择器:
<?xml version="1.0" encoding="utf-8"?>
<!-- mobile_text/EmbeddingFontsView.mxml -->
<s:View xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark" title="Embedded Fonts">
<s:TextArea id="ta1"
width="100%"
styleName="customStyle"
text="This is a TextArea control that uses an embedded font."/>
</s:View>
如果使用类选择器(例如 s|TextArea)应用样式(或嵌入字体),请在主应用程序文件中定义类选择器。不能在手机应用程序的视图中定义类选择器。
有关更多信息,请参阅 Using embedded fonts。
http://help.adobe.com/zh_CN/flex/mobileapps/WS19f279b149e7481c6a9f451212b87fe7e87-8000.html
本博客探讨了在手机应用程序中嵌入字体时如何避免使用FTE,并推荐使用TextArea或TextInput控件。通过CSS设置embedAsCFF为false,确保使用CFF字体而不会导致性能问题。
643

被折叠的 条评论
为什么被折叠?



