说明问题的例子不多。 建立通常的灵活机动项目,其档案如下:。
Main.mxml
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
applicationDPI="160">
<s:layout><s:VerticalLayout/></s:layout>
<fx:Style source="style.css"/>
<s:Label text="Static Label"/>
<s:Button label="Static Button" skinClass="MyButtonSkin"/>
</s:Application>
style.css
@namespace s "library://ns.adobe.com/flex/spark";
@font-face {
src: url("fonts/opensans/OpenSans-Bold.ttf");
fontFamily: OpenSansBoldEmbedded;
embedAsCFF: true;
}
s|Label,
s|Button
{
fontFamily: OpenSansBoldEmbedded;
font-lookup: embeddedCFF;
}
MyButtonSkin.mxml
<s:Skin xmlns:fx="http://ns.adobe.com/mxml/2009" xmlns:s="library://ns.adobe.com/flex/spark">
<!-- host component -->
<fx:Metadata>
[HostComponent("spark.components.Button")]
</fx:Metadata>
<s:Label id="labelDisplay" />
</s:Skin>
结果是,简单的标签用嵌入式字体,但纽伦的标签。 http://img813.imageshack.us/img813/44/skinningtest.png” rel=“nofollow” http://img813.imageshack.us/img813/44/skinning.png
我曾尝试过像彩色和真心壮志这样的其他社会功能,并且为这两种特性服务。 只有根embedded在皮肤体中赢得t工作。
我怎样把 but子的标签带上embedded子?
<>Solution
在进口(@font-face)和使用(Open SansEmbeddedBold)时使用属性。 只字不提并使用黑体是不够的。
/* Import the different font weights and styles */
@font-face {
src: url("fonts/opensans/OpenSans-Regular.ttf");
fontFamily: OpenSansEmbedded;
}
@font-face {
src: url("fonts/opensans/OpenSans-Bold.ttf");
fontFamily: OpenSansEmbedded;
fontWeight: bold;
}
@font-face {
src: url("fonts/opensans/OpenSans-Italic.ttf");
fontFamily: OpenSansEmbedded;
fontStyle: italic;
}
@font-face {
src: url("fonts/opensans/OpenSans-BoldItalic.ttf");
fontFamily: OpenSansEmbedded;
fontWeight: bold;
fontStyle: italic;
}
/* Register fonts as styleNames for further use */
.OpenSansEmbedded
{
fontFamily: OpenSansEmbedded;
}
.OpenSansEmbeddedBold
{
fontFamily: OpenSansEmbedded;
fontWeight: bold;
}
.OpenSansEmbeddedItalic
{
fontFamily: OpenSansEmbedded;
fontStyle: italic;
}
.OpenSansEmbeddedBoldItalic
{
fontFamily: OpenSansEmbedded;
fontWeight: bold;
fontStyle: italic;
}
采用经定义的类别作为 MXML的风格
<s:Label text="Static Label" styleName="OpenSansEmbeddedBold"/>