Skip to main content
Jan 20, 2012 1:57 PM UTC
Question

Apply embedded fonts to special characters in spark textArea using tlf

By setting fontfamily directly to textarea in mxml fonts get applied to special characters. But using tlf and setting fontfamily it does not apply.

style.css ::

@11220649-face

{

    src: URL("/Assets/Fonts/GandhariUnicode-Bold.otf");

    fontFamily: "GandhariUnicode-Bold";

    embedAsCFF: true;

}

snippet of source code ::

textArea.textFlow.interactionManager.selectRange(beginIndex, endIndex);

var textLayoutFormat:TextLayoutFormat = getTextLayoutFormat();

textLayoutFormat.fontLookup = FontLookup.EMBEDDED_CFF;

textLayoutFormat.fontFamily ="GandhariUnicode-Bold";   

textLayoutFormat.renderingMode = RenderingMode.CFF;

This topic is closed to new replies. Start a new post to keep the conversation going.

1 reply

Adobe Employee
Jan 29, 2012 5:41 AM UTC

Please try the code as follows.

(1)

[Embed(mimeType="application/x-font", exportSymbol="GandhariUnicode-Bold", embedAsCFF="true", fontWeight="bold", source="Assets/Fonts/GandhariUnicode-Bold.otf", fontName="gandhariUnicode-Bold")]

var GandhariUnicode-Bold:Class;

var textLayoutFormat:TextLayoutFormat = new TextLayoutFormat();

textLayoutFormat.fontLookup = FontLookup.EMBEDDED_CFF;

textLayoutFormat.fontFamily ="gandhariUnicode-Bold";   

textLayoutFormat.renderingMode = RenderingMode.CFF;

textArea.textFlow.hostFormat = textLayoutFormat;

textArea.textFlow.flowComposer.updateAllControllers();

Or (2)

[Embed(mimeType="application/x-font", exportSymbol="GandhariUnicode-Bold", embedAsCFF="true", fontWeight="bold", source="Assets/Fonts/GandhariUnicode-Bold.otf", fontName="gandhariUnicode-Bold")]

var GandhariUnicode-Bold:Class;


textArea.textFlow.fontLookup = FontLookup.EMBEDDED_CFF;

textArea.textFlow.fontFamily ="gandhariUnicode-Bold";   

textArea.textFlow.renderingMode = RenderingMode.CFF;

textArea.textFlow.flowComposer.updateAllControllers();

Translate