2010-05-24 53 views
0

我试图嵌入字体,以便与使用下面的代码扩展的TextArea一起使用,但它不起作用。我之前已经使用过这个代码和一个TextFlow对象,然后用flowComposer设置了这些容器,但是我无法使它与TextArea一起工作。将字体嵌入到Flex4的TextArea中

当使用下面的代码并使用setText设置文本时,我得到的只是Times New Roman字体。 (其他所有工作都很好)

<s:TextArea ... > 

... 

<fx:Style> 

    @font-face { 
    src: url("./fonts/arial.ttf"); 
    font-family: ArialEmbedded; 
    } 

</fx:Style> 

... 

public function setText(text:String):void 
{ 
    var format:TextLayoutFormat = new TextLayoutFormat(); 
    format.color = 0x000000; 
    format.renderingMode = RenderingMode.CFF; 
    format.fontLookup = FontLookup.EMBEDDED_CFF; 

    var config:Configuration = new Configuration(); 
    config.textFlowInitialFormat = format;  

    textFlow = TextConverter.importToFlow(text, TextConverter.TEXT_LAYOUT_FORMAT, config); 
    textFlow.interactionManager = new EditManager(); 
} 

</s:TextArea> 

回答

0

我看到与TextArea和TextInput具有相同类型的行为。火花组件不会呈现嵌入的字体。