Because of the constant attack by the wiki spam bots, accounts that are created and not used will be deleted. If you are a legitimate user, and your IP was blocked, please contact any active administrator - look at Special:RecentChanges and see who is busy fighting spam.


From SWFTools
Jump to: navigation, search
This article is complementary to other articles

Font is the way swfc uses to represent texts. In contrast to other programming languages, where there are ways to display text without specifying a font, in swfc the only way a text can be displayed is by proving a font. So, the instructions text and edittext can't work unless the flash programmer declares a font.

Fortunately, it's not difficult to do it.

The first obvious way is to seek into your own computer where are the .ttf fonts. In a typical GNU/Linux installation, there are lots of ttf fonts; for example, they may be loated in /usr/share/fonts/gnu-free. A lot of installed packages also come with fonts, the instruction find . -name *.ttf -ls probably will list lots of them.

Another way is by extrating the fonts from another flash application. This is done with swfextract. First, identify if the .swf file has any fonts, using:

swfextract file.swf

Then, after getting the ID of the fonts, it's possible to extract them, for example:

swfextract -F 10 file.swf -o font.ttf

However, this method may not work due to a bug in swfextract.

Then, let's suppose that you have a .ttf file, and it's located, for example, in folder myfonts/nicefont.ttf. In order to include this into an sc script, you must declare it as:

.font myfont myfonts/nicefont.ttf

After this, myfont becomes an object that holds a font (just like after declaring jpeg you create an object that holds a jpeg file or after declaring box you create an object that holds a box). In order to use this font in text or edittext, you include font=myfont in the declaration of text or edittext:

.text mytext font=myfont text="the quick brown fox jumps over a lazy dog" color=black