0

请参阅下面最简单的示例,它在 Windows 上作为 AIR 桌面运行。

<?xml version="1.0" encoding="utf-8"?>
<s:WindowedApplication xmlns:fx="http://ns.adobe.com/mxml/2009" 
                       xmlns:s="library://ns.adobe.com/flex/spark" 
                       xmlns:mx="library://ns.adobe.com/flex/mx">

    <fx:Style>
        @namespace s "library://ns.adobe.com/flex/spark";
        @namespace mx "library://ns.adobe.com/flex/mx";

        @font-face{
            src: url("C:/Windows/Fonts/AdobeGothicStd-Bold.otf");
            fontFamily: "AdobeGothic";
            fontWeight: bold;
            embedAsCFF: false;
        }

        s|Button{
            fontFamily: "AdobeGothic";
            fontSize: 20;
            color: #000000;
        }
    </fx:Style>
    <s:Button label="My Button" />

</s:WindowedApplication>

未使用字体:火花按钮

我究竟做错了什么?

4

2 回答 2

1

文档中所述

如果将 embedAsCFF 的值设置为 false,则嵌入字体不支持 FTE,并且仅适用于 MX 文本组件。

此外,您正在尝试将粗体字体 ( fontWeight: bold;) 应用于非粗体标签。我不确定这可能会产生什么影响。您可能必须这样做:

<s:Button label="My Button" fontWeight="bold"/>
于 2013-04-11T12:56:03.230 回答
0

另一种选择,dot notation在您的样式声明中使用。

.mySparkButton
{
   fontFamily: "AdobeGothic";
   fontSize: 20;
   color: #000000;
}

然后设置你的按钮

 <s:Button label="My Button"  styleName = "mySparkButton" />
于 2013-04-12T23:24:37.647 回答