• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Apply an embedded font to TextField created via script?

Explorer ,
Mar 12, 2021 Mar 12, 2021

Copy link to clipboard

Copied

I have a movie that uses imported fonts:

font.png

 

 

 

In want to create TextFields via AS3 and use this improted font on it:

var tf:TextField = new TextField();

var format: TextFormat = new TextFormat();
format.font = "$ColdDefaultFont";
tf.text = "Some text";
tf.setTextFormat(format);
			
addChild(tf)

However the font is never displayed (just shows as squares). If i manually add a TextField to the stage and set it's character font to use this embedded font it works fine.

 

So what am I doing wrong here?

 

Thanks

Views

117

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Mar 12, 2021 Mar 12, 2021

Copy link to clipboard

Copied

I guess we can't edit previous posts on this forum (to correct typos, etc)???

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Mar 14, 2021 Mar 14, 2021

Copy link to clipboard

Copied

Hi.

 

In my experience I learned that it's easier to place a text field instance inside of a Movie Clip or Sprite container and then add this container to the display list and let Animate handle the font embedding.

 

If you are not going to add dozens or hundreds of texts, I think the impact on the performance will be irrelevant.

 

Please tell us what you think.

 

Regards,

JC

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Mar 14, 2021 Mar 14, 2021

Copy link to clipboard

Copied

LATEST

Thanks for the response. Yes, this is actually exactly what I'm currently doing. It just seemed like a bit of a hack to me, however it does appear to work fine.

 

Cheers

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines