View on
MetaCPAN
Yasuhiro Sasama > SWF-Builder > SWF::Builder::Character::Font

Download:
SWF-Builder-0.16.tar.gz

Dependencies

Annotate this POD

CPAN RT

Open  1
View/Report Bugs
Module Version: 0.091   Source  

NAME ^

SWF::Builder::Character::Font - SWF font object

SYNOPSIS ^

  my $font = $mc->new_font('c:/windows/font/arial.ttf');
  $font->add_glyph('0123456789');

DESCRIPTION ^

This module creates SWF fonts from TrueType fonts.

$font = $mc->new_font( $fontfile [, $fontname] )

returns a new font. $fontfile is a outline font file name or an indirect font name. The font file name should be specified a full path name. Supported indirect font names are '_sans', '_serif', '_typewriter', "_\x{30b4}\x{30b7}\x{30c3}\x{30af}" ('gosikku' in Japanese katakana), "_\x{660e}\x{671d}" ('mincho' in Japanese kanji), and "_\x{7b49}\x{5e45}" ('tofuku' in Japanese kanji). When you use outline fonts, either Font::TTF or Font::FreeType is necessary. Font::TTF supports TrueType fonts (*.ttf/*.ttc). Font::FreeType supports TrueType, OpenType, and PostScript fonts (*.ttf/*.ttc/*.otf/*.pfb). Optional $fontname is a font name referred by HTMLs in dynamic texts. The font name is taken from the TrueType file if not defined.

$font->embed( [$embed] )

sets/gets a flag to embed the font or not.

$font->is_readonly

gets a permission flag to use the font only 'preview & print'. If the flag is set, the font cannot be used for text field. This works properly only when Font::TTF are used and 'OS/2' table are defined in the font.

$font->get_average_width

gets the average character width. This works properly only when Font::TTF are used and 'OS/2' table are defined in the font.

$font->add_glyph( $char_string [, $e_char] )

adds glyph data of the characters of the string to the font. Usually, SWF::Builder::character::Text adds required glyph data automatically. It is necessary to do add_glyph if the font is used for a dynamic text or a text field which will be changed at playing time. if $e_char is present, add_glyph adds glyphs of characters from first character of $char_string to first character of $e_char. For example, $font->add_glyph('a', 'z') adds glyphs of all lower case alphabet.

$font->LanguageCode( $code )

sets the spoken language of texts to which the font is applied. $code can take 'none', 'Latin', 'Japanese', 'Korean', 'Simplified Chinese', and 'Traditional Chinese'. It can also take a number, 0, 1, 2, 3, 4, and 5, or an initial, 'n', 'L', 'J', 'K', 'S'(or 'C'), and 'T', respectively.

COPYRIGHT ^

Copyright 2003 Yasuhiro Sasama (ySas), <ysas@nmt.ne.jp>

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

syntax highlighting: