Chunky Chunk
Chunky Chunk

Reputation: 17217

ActionScript Dynamic HTML Text With Embedded Fonts?

i'm trying to use htmlText on a dynamic text field with embedded fonts. i've searched for an hour for an answer and i still don't have one.

on stage, there is a dynamic text field with no text. i've embedded both regular and bold versions of Myraid Pro. the text field on stage is set to regular (have to choose something). "Render Text As HTML" is selected.

the following code in my document class doesn't work:

myText.autoSize = TextFieldAutoSize.CENTER;
myText.htmlText = "Not Bold <b>Bold</b>"; 

the html tags only work if the text field on stage is set to "use device fonts" in the anti-alias setting.

unreal.

Upvotes: 0

Views: 1253

Answers (2)

dchang
dchang

Reputation: 2027

It may be your embed parameters missing embedAsCFF='false', try something like:

[Embed(source='path/to/foo.otf', fontName='foo', embedAsCFF='false')]

In flex 4 the default is true to take advantage of the new text engine while flash.text.TextField relies on the old engine. There's more details here.

Upvotes: 1

Muhammad Irfan
Muhammad Irfan

Reputation: 1457

Well i have faced this problem. i forgot the solution but i have clue for you.. Try this way

var myFormat:TextFormat = new TextFormat(); myFormat.font = "Arial"; myFormat.size = 14;

myText.autoSize = TextFieldAutoSize.CENTER; myText.defaultTextFormat = myFormat; myText.embedFonts = true; myText.htmlText = "Not Bold\n"; myText.appendText("Bold");

Upvotes: 0

Related Questions