s:标签不加载字体

时间:2010-05-24 11:16:01

标签: flex flex4

我有一个带有“s:Label”和

的mxml组件
fontFamily="notes"

作为属性。

源代码:

<?xml version="1.0" encoding="utf-8"?>
<s:SkinnableContainer xmlns:fx="http://ns.adobe.com/mxml/2009" xmlns:s="library://ns.adobe.com/flex/spark" xmlns:mx="library://ns.adobe.com/flex/mx"
                  mouseUp="skinnablecontainer1_mouseUpHandler(event)" mouseDown="skinnablecontainer1_mouseDownHandler(event)"
                  skinClass="skin.SkinBackgroundImageUserStory" width="240" height="120">

<fx:Style source="/styles/styles.css"/>

<fx:Script>
    ...
</fx:Script>

<s:Label x="5" y="5" width="200" height="100" text="{myText}" fontFamily="notes" fontSize="30"/>
</s:SkinnableContainer>

我有styles.css:

@namespace s "library://ns.adobe.com/flex/spark";
@namespace mx "library://ns.adobe.com/flex/mx";

@font-face {
    src: url("/styles/fonts/rabiohead.ttf");
    fontFamily: "notes";
}

所以我想,那没关系,我的s:Label文本将用这种特殊字体格式化。但输出是正常字体。通过将“s:Label”更改为“mx:Label”,字体将“加载”。 那么,我该怎么做才能使用s:Label?

最诚挚的问候PHANTOMIAS

2 个答案:

答案 0 :(得分:2)

@font-face {
    src: url("/styles/fonts/rabiohead.ttf");
    fontFamily: notes;
}

有点晚了,但嘿,这是一个答案:)

答案 1 :(得分:1)

嵌入火花组件的字体时需要添加'embedAsCFF'属性(例如:s:Label)

@font-face {
    src: url("/styles/fonts/rabiohead.ttf");
    fontFamily: "notes";
    embedAsCFF: true;
}