Skip to main content
Participating Frequently
December 28, 2011
Answered

HTMLText FONT tag doesn't work

  • December 28, 2011
  • 1 reply
  • 2943 views

Hi guys,

I am shooting an issue that the FONT tag doesn't work in my project. Let me describe what I need:

1. I need to put different font style in one single dynamic textfield. For example,the text is :"Welcome, Fred" and I want Fred to  be bold and use "Vernada" as its font while others are left as "Arial"

2. I am using embeded fonts and htmltext here, the strings are loaded from external xml files

3. I found in the help doc that the font tag could do this. So I set the embeded fonts to "Arial" for the dynamic textfield and add <FONT FACE="Vernada">Fred</FONT>in the xml files, but it will not show "Fred" at all

4. Of course I added both "Arial" and "Vernada" into the library.

5. The problem is when I change the embeded fonts into "Vernada" for the dynamic textfield and modify the xml like <FONT FACE="Vernada" SIZE="25">Fred</FONT>, it works this time. I mean the character size changed to 25.

6. My conclusion is that the font tag only works when its font-family setting for its textfild is as the same that you want to set.

Is that correct? I don't think Adobe will design it like this? did I miss something?

This topic has been closed for replies.
Correct answer kglad

No. I just use <FONT FACE="****">******</FONT> to reference the fonts. And I confirmed that the face name are correct because it works if I embedded with the textfield.


i can't tell much from those screenshots except you're doing the right things.  but because you're using a chinese font in flash and not in this forum i can't see that your face attribute matches the font family name.

1 reply

kglad
Community Expert
December 28, 2011

you need to embed both Vernada (if you want to use Vernada regular) and you need to embed Vernada bold (if you want to use Vernada bold).

Fred_GuoAuthor
Participating Frequently
December 29, 2011

Thank you,kglad.

you are absolutely right that I need to embedde the font I want to set. Finally I found the approach to make it work:

1. create a dynamic text field out of the scene

2. set the embedded fonts you want to set for this text field with some characters range

Now you can use the font tag to make some inline strings show with the fonts that you set in the above textfield.

So there is another question here about how to embeded the fonts. I created a new font symbol in the library and add some characters range into it, So I thought the font was embedded into the swf. but it seems not. it seems only to be able to activate the embedded fonts with some real textfields. Am I correct? I don't think Adobe will design it like this, right? I look into the flash help and found that I need to check the "Export to Action Script" to make it compiled, but I keep getting an #1065 error that tell me the font variable is not defined when I am doing tha

The third problem is that the embede font name is not available. My original understanding is that if you create a new font symbol(with the new name like "MyFont") with "Arial" font family, it sill set up a mapping relationship with these two fonts, which means you can use any name to make the string show as "Arial". But it seems it only recognize "Arial" but will ignore "MyFont" when I using <FONT FACE="****"></FONT>. Why was that? Even I create a new text field with "MyFont" setting(Just want to make sure it is embedded into the swf), but it still doesn't work.

Could you help to anwser my quetions?

Again appreciate that for your help!

kglad
Community Expert
December 29, 2011

you can embed a font using a textfield or by adding the font directly to the library and exporting for actionscript.

if you assign a font face/style using html tags the name you use for your font's class is irrelevant.  if you assign the font using actionscript (ie, by using a textformat instance), the class name is relevant.