I'm trying to embedd fonts to use with a TextArea that I have extended using the code below, but it doesn't work. I have used this code before with a TextFlow object and then set the containers with the flowComposer, but I can't get it to work with the TextArea.
When using the code below and set the text with setText, all I get is Times New Roman font. (Everything else is working fine)
<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>
I am seeing this same type of behavior with a TextArea and TextInput. The spark components will not render embedded fonts.
i guess you should set embedAsCFF to true. From the spark component, text-related components are re-based on Flash Player 10's text rendering engine(FTE).
http://blog.flexexamples.com/2008/10/15/embedding-fonts-in-flex-gumbo/
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.