繁体   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