views:

25

answers:

2

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.

A: 

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");

Muhammad Irfan
that does't work. i've submitted a bug report to adobe.
TheDarkInI1978
+1  A: 

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.

Dave
thanks. embedding the fonts in code seems to have fixed the issue. i'm not sure if the problem was caused by embedAsCFF being set to true by TLF, as it still worked when i set it to true in the embed tags. regardless, embedding the fonts in Flash Authoring instead of the code causes the problem.
TheDarkInI1978