Skip to main content
amitKumarKanda
Inspiring
July 13, 2012
Answered

Embed fonts with html text

  • July 13, 2012
  • 1 reply
  • 1029 views

Hi,

Is it possible to embed font with in html text of a text field.

TextField.htmlText = "This is a sample of code that  <font face='xyz'>I am using</font>";

here xyz is not a comon font. Please help.

Thanx

This topic has been closed for replies.
Correct answer kglad

yes, use the textformat class and setTextFormat or css styling.  or, you could add xyz to your library (new font), embed the needed characters, tick export for actionscript and assign a class (eg, XYZ) and use:

var xyzFont:Font=new XYZ();

tf.htmlText="This is a sample of code that  <font face='"+xyzFont.fontName+"'>I am using</font>";

1 reply

kglad
Community Expert
kgladCommunity ExpertCorrect answer
Community Expert
July 13, 2012

yes, use the textformat class and setTextFormat or css styling.  or, you could add xyz to your library (new font), embed the needed characters, tick export for actionscript and assign a class (eg, XYZ) and use:

var xyzFont:Font=new XYZ();

tf.htmlText="This is a sample of code that  <font face='"+xyzFont.fontName+"'>I am using</font>";

amitKumarKanda
Inspiring
July 14, 2012

Hi,

Thanks for your response.

Code is working but only on my system as the font is installed on my computer.

I am using GG superscript and GG Subscript.

Amit

kglad
Community Expert
Community Expert
July 14, 2012

then you have not embedded that font correctly or your code is incorrect.

copy and paste your embedding code and attach a screen shot of your library panel showing those two fonts and their linkages.