Now, if you would like to use a custom font with your text field, we only have a couple of extra steps to deal with. Flash can embed a Custom font and all the shapes needed to display that font right in the SWF file. It will take up a little extra space so that is something you need to take into consideration, but building in it to the file is pretty easy.
Let's setup a custom font for our Quote field. The first thing you need to do is make sure that the font is embedded in the SWF file itself so that it's available and ready for ActionScript to use. We can do that over in the library. One of the options in the Library panel is New Font, and this is the only place you will find it in the program. When you choose this, you can pick any font that's on your system that you would like to use. Now, I am sure we don't all have the same fonts so you can pick any font that you have installed on your system to try this out. On my system, I was going to pick out a font called Papyrus. I have got quite a few on here but there it is in my list. Now, you can setup what kind of style you would like to include with the font but remember if the font doesn't include those styles even though you choose it in the box here won't show. My Papyrus font has no Bold and no Italic versions, so I might as well not even bother clicking on either of the style options since I won't get them.
As you can see, you will have to know your fonts a little bit. We also need to give our font a name that we will use to identify it. For me, I would rather just keep the same name the font itself. In that way, I don't get confused. So, I am going to call mine Papyrus but we could just as easily call it Quote font or something like that. Now, that's the first step. We now have a font embedded in our Library file but as you know, when Flash compiles SWF files, if you have got elements in your library that aren't being used in your movie, it just skips over them and leaves them behind. So, to make sure that this is included in the SWF file, we need to click on the font that we just made, go back up to our Options window and choose Linkage. The Linkage panel gives us an option for exporting that item for ActionScript and that's exactly what we want. We want to be able to use this Papyrus font inside of our code even though it is not being used anywhere else in the movie file.
You will notice up here also we are giving it a class name. Now, since we are not going to be writing a class for this, when we click OK, Flash will warn us that it is going to go ahead and create a blank class definition file for our fonts. We will just click OK on that. So, we have got a font embedded in our library and we have got it linked up for use with ActionScript. The last thing we will need to do before we can use the font is setup the text field to Use Embedded Fonts. By default, these text fields are set to look for system Fonts Only. So, we just need to go some place in the area where we are setting up our tQuote text field. I will do it right before autoSize. I am going to add a line here and start it out with tQuote and we are going to use the embedFonts property. When we set this to true, we are instructing this text field to use th embedded fonts.
Now, all that's left is to go up to our text format definition we are using on the Quote field and instead of specifying Verdana, Arial and Helvetica, I am going to specify the font using the name that I typed into the Linkage dialog box which was Papyrus, and of course, you would type whatever font you have chosen. Let's give this a try.
I will test my movie and there we can see my special Papyrus font showing. Now, you will notice even though my text format style has indicated Bold and Italic, because those aren't included with the fonts, I am not going to see those styles here either. Let's close out of that Test window.
Transcription by:
Scribe4you Transcription Services