sswf::TagFont Class Reference

#include <libsswf.h>

Inheritance diagram for sswf::TagFont:

sswf::TagBaseID sswf::TagBase sswf::MemoryManager List of all members.

Public Types

 FONT_LANGUAGE_JAPANESE = 2
 FONT_LANGUAGE_KOREAN = 3
 FONT_LANGUAGE_LATIN = 1
 FONT_LANGUAGE_LOCALE = 0
 FONT_LANGUAGE_max = 6
 FONT_LANGUAGE_SIMPLIFIED_CHINESE = 4
enum  font_language_t {
  FONT_LANGUAGE_UNKNOWN = -1, FONT_LANGUAGE_LOCALE = 0, FONT_LANGUAGE_LATIN = 1, FONT_LANGUAGE_JAPANESE = 2,
  FONT_LANGUAGE_KOREAN = 3, FONT_LANGUAGE_SIMPLIFIED_CHINESE = 4, FONT_LANGUAGE_TRADITIONAL_CHINESE = 5, FONT_LANGUAGE_max = 6
}
 FONT_LANGUAGE_TRADITIONAL_CHINESE = 5
 FONT_LANGUAGE_UNKNOWN = -1
 FONT_TYPE_ASCII
 FONT_TYPE_BEST = 0
 FONT_TYPE_SHIFTJIS
enum  font_type_t { FONT_TYPE_BEST = 0, FONT_TYPE_ASCII, FONT_TYPE_UNICODE, FONT_TYPE_SHIFTJIS }
 FONT_TYPE_UNICODE

Public Member Functions

void AddGlyph (sswf_ucs4_t name, const TagBase *ref, long advance=LONG_MIN)
void AddKern (sswf_ucs4_t code0, sswf_ucs4_t code1, long advance)
long DefaultAscent (void) const
long DefaultDescent (void) const
long DefaultLeadingHeight (void) const
bool FindGlyph (font_info_t &info, bool mark_empty_in_use=false) const
const char * FontName (void) const
void GlyphInfo (font_info_t &info) const
bool HasGlyph (void) const
virtual ErrorManager::error_code_t Save (Data &data)
 Pre-save all the children tags of this tag.
void SetBold (bool bold)
void SetDefaultAdvance (long advance)
void SetItalic (bool italic)
void SetLanguage (font_language_t language)
void SetLayout (long ascent, long descent, long leading_height)
void SetName (const char *font_name)
void SetSpaceAdvance (long advance)
void SetType (font_type_t type)
void SetUsedByEditText (bool used=true)
ErrorManager::error_code_t SetUsedGlyphs (const sswf_ucs4_t *used_glyphs, bool mark_empty_in_use=false)
void SetWide (bool wide)
 TagFont (TagBase *parent)
virtual swf_type_t TypeFlags (void) const
 Retrieve a set of flags desribing the type of the tag.

Static Public Member Functions

static const char * LanguageToString (font_language_t language)
static font_language_t StringToLanguage (const char *language)

Private Member Functions

virtual ErrorManager::error_code_t PreSave (void)
 Pre-save all the children tags of this tag.
virtual ErrorManager::error_code_t PreSave2ndPass (void)
 Pre-save all the children tags of this tag.

Private Attributes

long f_ascent
bool f_bold
unsigned long f_count
long f_default_advance
bool f_define_font2
long f_descent
char * f_font_name
Vectors f_glyphs
bool f_has_layout
bool f_has_wide_char
bool f_has_wide_offsets
bool f_italic
Vectors f_kerns
font_language_t f_language
long f_leading_height
unsigned long * f_offsets
long f_offsets_max
Data f_save_glyphs
long f_space_advance
font_type_t f_type
bool f_used_by_edit_text
bool f_wide

Static Private Attributes

static const char * g_font_language_name [FONT_LANGUAGE_max]

Classes

struct  font_glyph_t
struct  font_info_t
struct  font_kern_t

Member Enumeration Documentation

enum sswf::TagFont::font_language_t

Enumerator:
FONT_LANGUAGE_UNKNOWN 
FONT_LANGUAGE_LOCALE 
FONT_LANGUAGE_LATIN 
FONT_LANGUAGE_JAPANESE 
FONT_LANGUAGE_KOREAN 
FONT_LANGUAGE_SIMPLIFIED_CHINESE 
FONT_LANGUAGE_TRADITIONAL_CHINESE 
FONT_LANGUAGE_max 

enum sswf::TagFont::font_type_t

Enumerator:
FONT_TYPE_BEST 
FONT_TYPE_ASCII 
FONT_TYPE_UNICODE 
FONT_TYPE_SHIFTJIS 


Constructor & Destructor Documentation

TagFont::TagFont ( TagBase parent  ) 


Member Function Documentation

void TagFont::AddGlyph ( sswf_ucs4_t  name,
const TagBase ref,
long  advance = LONG_MIN 
)

void TagFont::AddKern ( sswf_ucs4_t  code0,
sswf_ucs4_t  code1,
long  advance 
)

long TagFont::DefaultAscent ( void   )  const

long TagFont::DefaultDescent ( void   )  const

long TagFont::DefaultLeadingHeight ( void   )  const

bool TagFont::FindGlyph ( font_info_t info,
bool  mark_empty_in_use = false 
) const

const char * TagFont::FontName ( void   )  const

void TagFont::GlyphInfo ( font_info_t info  )  const

bool TagFont::HasGlyph ( void   )  const

const char * TagFont::LanguageToString ( font_language_t  language  )  [static]

ErrorManager::error_code_t TagFont::PreSave ( void   )  [private, virtual]

This function calls the PreSave() function of all the children unless one returns a non-zero value in which case that value will be returned and the process stopped.

This function is aumatically called by the TagHeader and TagSprite in order to pre-save their children.

The PreSave() functions are expected to be used to test whether a tag can be saved. Especially, most tags will call the MinimumVersion() function with the version required to save these tags. This ensures that you can save the entire movie in a valid SWF. Please, see the reference of each tag for more information about what their PreSave() function does.

You should not have to call this function directly.

Returns:
Zero if the PreSave() succeeds; non-zero otherwise

Reimplemented from sswf::TagBase.

ErrorManager::error_code_t TagFont::PreSave2ndPass ( void   )  [private, virtual]

The PreSave2ndPass() is the same as the PreSave() function for the TagBase(). It calls the PreSave2ndPass() of all the children unless one returns a non-zero value in which case the process stops and that value is returned.

The second pass is used to check more information about the tag and prepare data such as tables. This is especially necessary for the TagFont which needs to create all the character tables to know the offsets to characters, etc. This is important because that tag may be accessed before its Save() function is called and it would still need to know where these characters are!

Returns:
Zero when the PreSave2ndPass() successed; non-zero otherwise

Reimplemented from sswf::TagBase.

ErrorManager::error_code_t TagFont::Save ( Data data  )  [virtual]

The Save() function is the one you want to call to save an SWF movie.

You may use the Save() on any tag, however, if you do so you need to properly initialize the system. For that purpose, you may want to look at the code in the TagHeader::Save(Data& data) function.

Otherwise, you simply have to call the Save() function of the TagHeader. That will save the entire movie with the smallest possible version (or fail if something cannot be saved with the present parameters.)

The TagHeader::Save() function first calls the PreSave() functions, the PreSave2ndPass() and then the Save() functions of all the children.

The other tag Save() function simply save the tag within the specified Data buffer. Note however that the TagSprite will also call the Save() function of all of its children. Yet it does not call the PreSave() functions.

The Save() function saves the movie in a Data buffer. Later you need to save that buffer on disk or some other medium.

Returns:
Zero when the Save() succeeds, non-zero if it fails
See also:
TagBase::PreSave()

TagBase::PreSave2ndPass()

Implements sswf::TagBase.

void TagFont::SetBold ( bool  bold  ) 

void TagFont::SetDefaultAdvance ( long  advance  ) 

void TagFont::SetItalic ( bool  italic  ) 

void TagFont::SetLanguage ( font_language_t  language  ) 

void TagFont::SetLayout ( long  ascent,
long  descent,
long  leading_height 
)

void TagFont::SetName ( const char *  font_name  ) 

void TagFont::SetSpaceAdvance ( long  advance  ) 

void TagFont::SetType ( font_type_t  type  ) 

void TagFont::SetUsedByEditText ( bool  used = true  ) 

ErrorManager::error_code_t TagFont::SetUsedGlyphs ( const sswf_ucs4_t used_glyphs,
bool  mark_empty_in_use = false 
)

void TagFont::SetWide ( bool  wide  ) 

TagFont::font_language_t TagFont::StringToLanguage ( const char *  language  )  [static]

TagBase::swf_type_t TagFont::TypeFlags ( void   )  const [virtual]

This function returns some flags that can be used to know where to place a tag in a movie, whether a tag is unique, etc.

If a tag has specifics which are not described here, it often can be checked using its name and special handling.

The existing flags are:

SWF_TYPE_DEFINE This is a definition tag (Sprite, Shape...)

SWF_TYPE_CONTROL This is a control tag (ShowFrame, PlaceObject...)

SWF_TYPE_UNIQUE This can be used once throughout the whole movie

SWF_TYPE_START This tag should be at the start of the movie

SWF_TYPE_ONE At most one per frame

SWF_TYPE_REFERENCE This tag references another

SWF_TYPE_HAS_ID This tag has an identifier

SWF_TYPE_SCRIPT This object can accept action scripts

SWF_TYPE_SPRITE This is a sprite (can include other tags)

SWF_TYPE_HEADER The header object

Note:
These flags are constant (actually hard coded!) and will not change between calls. They even rarely change between versions.
Returns:
The set of flags for the given tag
See also:
sswf::TagBase::Name(void) const

Implements sswf::TagBase.


Member Data Documentation

long sswf::TagFont::f_ascent [private]

bool sswf::TagFont::f_bold [private]

unsigned long sswf::TagFont::f_count [private]

long sswf::TagFont::f_default_advance [private]

bool sswf::TagFont::f_define_font2 [private]

long sswf::TagFont::f_descent [private]

char* sswf::TagFont::f_font_name [private]

Vectors sswf::TagFont::f_glyphs [private]

bool sswf::TagFont::f_has_layout [private]

bool sswf::TagFont::f_has_wide_char [private]

bool sswf::TagFont::f_has_wide_offsets [private]

bool sswf::TagFont::f_italic [private]

Vectors sswf::TagFont::f_kerns [private]

font_language_t sswf::TagFont::f_language [private]

long sswf::TagFont::f_leading_height [private]

unsigned long* sswf::TagFont::f_offsets [private]

long sswf::TagFont::f_offsets_max [private]

Data sswf::TagFont::f_save_glyphs [private]

long sswf::TagFont::f_space_advance [private]

font_type_t sswf::TagFont::f_type [private]

bool sswf::TagFont::f_used_by_edit_text [private]

bool sswf::TagFont::f_wide [private]

const char * TagFont::g_font_language_name [static, private]

Initial value:

 {
        "LOCALE",
        "LATIN",
        "JAPANESE",
        "KOREAN",
        "SIMPLIFIED_CHINESE",
        "TRADITIONAL_CHINESE"
}


The documentation for this class was generated from the following files:
Generated on Sun May 13 23:29:40 2007 for libsswf by  doxygen 1.4.7