سؤال

Please see the simplest of examples below, this is running as AIR Desktop on windows.

<?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>

The font is not being used: Spark Button

What am I doing wrong?

هل كانت مفيدة؟

المحلول

As stated in the docs:

If you set the value of embedAsCFF to false, then the embedded font does not support FTE, and works only with the MX text components.

Furthermore, you're trying to apply a bold font (fontWeight: bold;) to a non-bold label. I'm not exactly sure what effect that might have. You may have to do:

<s:Button label="My Button" fontWeight="bold"/>

نصائح أخرى

one more option, use dot notation in your style declaration.

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

then set your button's

 <s:Button label="My Button"  styleName = "mySparkButton" />
مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top