Skip to main content
Inspiring
December 19, 2009
Answered

how to embed?!

  • December 19, 2009
  • 1 reply
  • 614 views

I don't seem to be able to use the embeded fonts! this is how I'm doing it:

in my document class I'm embeding the font like this:

[Embed(source="assets/tahoma.ttf", fontFamily="Tahoma", mimeType="application/x-font-truetype")]

private var tahoma:Class;

and then I registered the font in the constructor:

Font.registerFont(tahoma);

it seems to be embeded because the SWF file increases... now I create my textFlow:

_textFlow = new TextFlow();

_textFlow.fontFamily = "Tahoma";

_textFlow.fontSize = 13;

_textFlow.color = 0x000000;

_textFlow.fontLookup = FontLookup.EMBEDDED_CFF;

_textFlow.renderingMode = RenderingMode.CFF;

_paragraph = new ParagraphElement();

_textFlow.addChild(_paragraph);

_span = new SpanElement();
_span.text = _label.value;
_paragraph.addChild(_span);

_txtContainerController = new ContainerController(_myLabel, NaN, NaN);

_textFlow.flowComposer.addController(_txtContainerController);

_textFlow.flowComposer.updateAllControllers();

-----------------

I beleive those two highlighted lines are actually responsible for embeding the font? yes? but this is not working for me. any idea why? thanks.

This topic has been closed for replies.
Correct answer rdermer

The fontLookup property you've higlighted tells TLF to use the embedded font.

This sample code embeds a font:

[Embed(mimeType="application/x-font", exportSymbol="myArial_bold_normal", embedAsCFF="true", fontWeight="bold", source="arialbd.ttf", fontName="myArial")]

public class myArial_bold_normal extends mx.core.FontAsset
{ }

I believe the main thing you are missing is the embedAsCFF="true" on the Embed tag.

Hope that helps,

Richard

1 reply

rdermerCorrect answer
Adobe Employee
December 21, 2009

The fontLookup property you've higlighted tells TLF to use the embedded font.

This sample code embeds a font:

[Embed(mimeType="application/x-font", exportSymbol="myArial_bold_normal", embedAsCFF="true", fontWeight="bold", source="arialbd.ttf", fontName="myArial")]

public class myArial_bold_normal extends mx.core.FontAsset
{ }

I believe the main thing you are missing is the embedAsCFF="true" on the Embed tag.

Hope that helps,

Richard