Pergunta

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.

Foi útil?

Solução

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.

Outras dicas

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

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top