2010-05-24 56 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具有相同類型的行爲。火花組件不會呈現嵌入的字體。