[英]Spark embedding of fonts for Label
我一直都在Flash和Flex中嵌入字體。 我以為我了解它如何與Spark一起使用,但是...我在AIR 13.0中使用Apache Flex 4.12
我的CSS:
@font-face {
src: url("../../../lib/formata-light-1361538983.ttf");
fontFamily: "Formata-Light";
embedAsCFF:true;
}
@font-face {
src: url("../../../lib/formata-light-1361538983.ttf");
fontFamily: "Formata-Light-NoCFF";
embedAsCFF:false;
}
@font-face {
src: url("../../../lib/Formata-Regular.ttf");
fontFamily: "Formata";
embedAsCFF:true;
fontWeight: normal;
}
@font-face {
src: url("../../../lib/Formata-Regular.ttf");
fontFamily: "Formata-NoCFF";
embedAsCFF:false;
fontWeight: normal;
}
@font-face {
src: url("../../../lib/Formata-Bold.ttf");
fontFamily: "Formata";
embedAsCFF:true;
fontWeight: bold;
}
@font-face {
src: url("../../../lib/Formata-Bold.ttf");
fontFamily: "Formata-NoCFF";
embedAsCFF:false;
fontWeight: bold;
}
我的代碼:
<s:VGroup id="grp_debug">
<s:Label fontFamily="Formata-Light" text="Label Formata-Light" fontWeight="normal" />
<s:Label fontFamily="Formata-Light-NoCFF" text="Label Formata-Light-NoCFF" fontWeight="normal" />
<s:Label fontFamily="Formata" text="Label Formata" fontWeight="normal" />
<s:Label fontFamily="Formata-NoCFF" text="Label Formata-NoCFF" fontWeight="normal" />
<s:Label fontFamily="Formata" text="Label Formata bold" fontWeight="bold" />
<s:Label fontFamily="Formata-NoCFF" text="Label Formata-NoCFF bold" fontWeight="bold" />
<s:RichText fontFamily="Formata-Light" text="RichText Formata-Light" fontWeight="normal" />
<s:RichText fontFamily="Formata-Light-NoCFF" text="RichText Formata-Light-NoCFF" fontWeight="normal" />
<s:RichText fontFamily="Formata" text="RichText Formata" fontWeight="normal" />
<s:RichText fontFamily="Formata-NoCFF" text="RichText Formata-NoCFF" fontWeight="normal" />
<s:RichText fontFamily="Formata" text="RichText Formata bold" fontWeight="bold" />
<s:RichText fontFamily="Formata-NoCFF" text="RichText Formata-NoCFF bold" fontWeight="bold" />
<s:Button fontFamily="Formata-Light" label="Button Formata-Light" fontWeight="normal" />
<s:Button fontFamily="Formata-Light-NoCFF" label="Button Formata-Light-NoCFF" fontWeight="normal" />
<s:Button fontFamily="Formata" label="Button Formata" fontWeight="normal" />
<s:Button fontFamily="Formata-NoCFF" label="Button Formata-NoCFF" fontWeight="normal" />
<s:Button fontFamily="Formata" label="Button Formata bold" fontWeight="bold" />
<s:Button fontFamily="Formata-NoCFF" label="Button Formata-NoCFF bold" fontWeight="bold" />
</s:VGroup>
我得到的是:
我以為Label
可以使用CFF字體,因為它使用TLF引擎。 無論如何,每種配置都經過嘗試,並且不能與Label
或RichText
...順便說一下,我不明白為什么Buttons可以同時使用CFF和非CFF字體。
我找到了解決方案,但對此並不完全滿意。
首先,必須確保在安裝Flex和AIR SDK時選中了Flex字體管理器。
Apache Flex的最新版本似乎在嵌入CFF字體方面存在問題。 由於嵌入在較舊的版本(Flex 4.10 AIR 3.8)上運行良好,因此我將jar復制到/ lib / external / optional中。
afe.jar是僅有的一個大小變化很大的版本(1.37Mo-> 626Ko)。 它必須是使用過的一種(CFFFontManager是優先使用的,但是不起作用...),因為現在顯示了我的字體。 雖然有一個丑陋的填充。
如果有人找到允許使用預期的CFFFontManager的解決方案,那就太好了。
您是否知道在移動項目中必須兩次嵌入字體 ? 我復制了以下文本:
您只需要了解有關移動字體的幾件事:
所有移動設備外觀,LabelItemRenderer和IconItemRenderer都使用
StyleableTextField(基於TextField)而不是Flash Text Engine(FTE)
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.