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.

Text

From SWFTools
Jump to: navigation, search

Text, in the script language compiled by swfc, is the way to display a fixed text.

In order to display a text, the first step is to declare a Font. There's no default font, it's absolutely necessary to declare it. Fortunately, it's simple to do it - consult article Font.

Let's suppose, then, that "myfont.ttf" is a font file. A text would be created and displayed this way:

  .font myfont1 "myfont.ttf"
  .text mytext1 font=myfont1 text="The quick brown fox jumps over a lazy dog" color=black
  .put mytext1

The code fragment, above, has a few peculiarities. Create the .sc file, below, compile it with swfc and show it. What are we missing?

.flash bbox=600x400 fps=50 background=white
  .font myfont1 "myfont.ttf"
  .text mytext1 font=myfont1 text="The quick brown fox jumps over a lazy dog" color=black
  .put mytext1
.end

The problem is that, contrary to all other widgets, that, by default, are pinned by the left-upper corner, a text widget is pinned by the imaginary line that runs just below the letters "abcd..." and crosses letters "gjpqy". And this has some nasty effects, for example, there's no way to know, a priori, what is the size of the text widget so that we can place it where we want it to be.

The solution, as far as I know, is by trial and error. For example, with the FreeSans.ttf font that comes with GNU/Linux, the code would be:

.flash bbox=1230x65 fps=50 background=white
  .font myfont1 "/usr/share/fonts/gnu-free/FreeSans.ttf"
  .text mytext1 font=myfont1 text="The quick brown fox jumps over a lazy dog" color=black
  .put mytext1 y=50
.end

See also

  • Edittext, used to get input or to exhibit output
Personal tools
Namespaces

Variants
Actions
Navigation
Toolbox