View on
Yasuhiro Sasama > SWF-Builder > SWF::Builder::Character::Text



Annotate this POD


Open  1
View/Report Bugs
Module Version: 0.04   Source  


SWF::Builder::Character::Text - SWF static text object


  my $text = $mc->new_static_text( $font )
    ->text('This is a text.');

  my $text_i = $text->place;


This module creates static texts, which cannot be changed at playing time.

$text = $mc->new_static_text( [$font, $text] )

returns a new static text. $font is an SWF::Builder::Font object.

$text->font( $font )

applies the font to the following text. $font is an SWF::Builder::Font object.

$text->size( $size )

sets a font size to $size in pixel.

$text->color( $color )

sets color of the following text. The color can take a six or eight-figure hexadecimal string, an array reference of R, G, B, and optional alpha value, an array reference of named parameters such as [Red => 255], and SWF::Element::RGB/RGBA object.

$text->text( $string )

writes the $string. The glyph data of the applied font is embedded if needed. The string can also include a newline code, "\n".

$text->position( $x, $y )

sets the position of the following text. ($x, $y) are coordinates in pixel relative to the origin of the text object.

$text->leading( $leading )

sets the vertical distance between the lines in pixel.

$text->kerning( [$kerning] )

sets/gets a flag to adjust spacing between kern pair.


returns the bounding box of the text, a list of coordinates ( top-left X, top-left Y, bottom-right X, bottom-right Y ).

$text_i = $text->place( ... )

returns the display instance of the text. See SWF::Builder.


Copyright 2003 Yasuhiro Sasama (ySas), <>

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

syntax highlighting: