簡體   English   中英

在Flex4的TextArea中嵌入字體

[英]Embedd fonts in a TextArea in Flex4

我正在嘗試嵌入字體,以便與使用下面的代碼擴展的TextArea一起使用,但是它不起作用。 之前,我已經將這個代碼與TextFlow對象一起使用,然后通過flowComposer設置了容器,但是我無法使其與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>

我看到了與TextArea和TextInput相同類型的行為。 spark組件將不會呈現嵌入字體。

我猜你應該將embedAsCFF設置為true。 從spark組件中,與文本相關的組件將基於Flash Player 10的文本呈現引擎(FTE)重新建立。

http://blog.flexexamples.com/2008/10/15/embedding-fonts-in-flex-gumbo/

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM