#include <libsswf.h>
Public Member Functions | |
void | AddColor (Color &color) |
Defines the color in the current setup. | |
void | AddFont (const TagFont *font, long height) |
Set the specified font to the current setup. | |
void | AddOffsets (long x, long y) |
Set the specified offset in the current setup. | |
ErrorManager::error_code_t | AddText (const char *string, long advance=LONG_MIN) |
Add a new text string. | |
virtual ErrorManager::error_code_t | Save (Data &data) |
Save the TagText in a Data buffer. | |
void | SetBounds (const SRectangle &bounds) |
Set the graphical bounds of this text. | |
void | SetMatrix (const Matrix &matrix) |
Set the text matrix. | |
TagText (TagBase *parent) | |
Initializes a text tag. | |
virtual swf_type_t | TypeFlags (void) const |
Defines the type of a text tag. | |
Private Types | |
enum | text_type_t { TEXT_ENTRY_TEXT = 0, TEXT_ENTRY_SETUP } |
Private Member Functions | |
int | DefineText (int start, text_setup_t *s, const TagFont *font, int font_height) |
Internal function to work on text entries. | |
void | NewSetup (void) |
virtual ErrorManager::error_code_t | ParseTag (swf_tag_t tag, const Data &data) |
Parse data from a file into a CSMTextSettings tag. | |
virtual ErrorManager::error_code_t | PreSave (void) |
Makes the TagText ready for saving. | |
ErrorManager::error_code_t | RecordSetup (void) |
Record one setup in the text array. | |
Private Attributes | |
SRectangle | f_bounds |
Matrix | f_matrix |
bool | f_new_text |
Vectors | f_records |
text_setup_t | f_setup |
int | f_version |
Classes | |
struct | text_define_t |
Structure used to memories the type of definition. More... | |
struct | text_entry_t |
Structure representing a text entry (an actual string). More... | |
struct | text_setup_t |
Structure representing a text setup. More... |
This is very flexible since each glyph can be rendered pretty much where you want it to be. However, it can be much more tedious to use that an sswf::TagEditText.
enum sswf::TagText::text_type_t [private] |
TagText::TagText | ( | TagBase * | parent | ) |
The constructor initializes the text tag so it looks empty.
[in] | parent | The sswf::TagHeader this text tag is included in |
References f_new_text.
void TagText::AddColor | ( | Color & | color | ) |
This function defines the color of the current setup.
If the color transparency is not solid (255) then the movie version is forced to version 3.
[in] | color | The RGBA color for the text. |
References sswf::TagText::text_setup_t::f_color, sswf::TagText::text_setup_t::f_has_color, and f_setup.
void TagText::AddFont | ( | const TagFont * | font, | |
long | height | |||
) |
This function is used to declare the font and its height.
[in] | font | The font to use to render this text. |
[in] | height | The height used to render this font. |
References sswf::TagText::text_setup_t::f_font, sswf::TagText::text_setup_t::f_font_height, sswf::TagText::text_setup_t::f_has_font, and f_setup.
void TagText::AddOffsets | ( | long | x, | |
long | y | |||
) |
This function saves the x and y offsets to skip from the current position.
[in] | x | The horizontal movement |
[in] | y | The vertical movement |
References sswf::TagText::text_setup_t::f_has_xoffset, sswf::TagText::text_setup_t::f_has_yoffset, f_setup, sswf::TagText::text_setup_t::f_x, and sswf::TagText::text_setup_t::f_y.
ErrorManager::error_code_t TagText::AddText | ( | const char * | string, | |
long | advance = LONG_MIN | |||
) |
This function is used to add a new string to the text tag.
It is possible to specify the exact space to skip between characters. Set the advance parameter to LONG_MIN to avoid that effect and let the system determine the advance size automatically from the font information.
[in] | string | The string of text to add to this tag |
[in] | advance | The space to skip between characters or LONG_MIN |
References sswf::Vectors::Count(), sswf::ErrorManager::ERROR_CODE_INVALID_TEXT_SETUP, sswf::ErrorManager::ERROR_CODE_NONE, f_new_text, f_records, f_setup, sswf::TagText::text_setup_t::IsUsed(), sswf::mbtowc(), sswf::MemoryManager::MemAlloc(), sswf::MemoryManager::MemAttach(), sswf::TagBase::OnError(), RecordSetup(), and sswf::Vectors::Set().
int TagText::DefineText | ( | int | start, | |
text_setup_t * | s, | |||
const TagFont * | font, | |||
int | font_height | |||
) | [private] |
This function is used by the PreSave() function to make sure that the text is valid and to initialize the different structures so they are ready to be saved in the output file.
[in] | start | The start index |
[in] | s | The setup text to manage |
[in] | font | The font used to define this text metrics |
[in] | font_height | The height used to render this font |
References sswf::assert(), sswf::Vectors::Count(), sswf::ErrorManager::ERROR_CODE_INVALID_GLYPH, sswf::ErrorManager::ERROR_CODE_NO_SUCH_GLYPH, sswf::TagText::text_entry_t::f_advance, sswf::TagFont::font_info_t::f_advance, sswf::TagText::text_entry_t::f_entries, sswf::TagText::text_entry_t::f_exact_length, sswf::TagFont::font_info_t::f_glyph, sswf::TagText::text_setup_t::f_has_xadjust, sswf::TagFont::font_info_t::f_index, sswf::TagFont::font_info_t::f_is_empty, f_records, sswf::TagFont::font_info_t::f_saved_index, sswf::TagText::text_entry_t::f_text, sswf::TagText::text_define_t::f_type, sswf::TagText::text_setup_t::f_xadjust, sswf::TagFont::FindGlyph(), sswf::TagFont::FontName(), sswf::Vectors::Get(), sswf::MemoryManager::MemAlloc(), sswf::TagBase::OnError(), sswf::MemoryManager::Size(), TEXT_ENTRY_TEXT, and sswf::wcname().
Referenced by PreSave().
void sswf::TagText::NewSetup | ( | void | ) | [private] |
virtual ErrorManager::error_code_t sswf::TagText::ParseTag | ( | swf_tag_t | tag, | |
const Data & | data | |||
) | [private, virtual] |
This function does nothing since the CSMTextSettings tag has no data.
[in] | tag | The tag that generated this call |
[in] | data | The Data buffer from the Flash file being loaded |
Reimplemented from sswf::TagCSMTextSettings.
ErrorManager::error_code_t TagText::PreSave | ( | void | ) | [private, virtual] |
This function ensures that the TagText can be saved (is valid).
Reimplemented from sswf::TagBase.
References sswf::Vectors::Count(), DefineText(), sswf::ErrorManager::ERROR_CODE_NONE, sswf::TagText::text_setup_t::f_color, sswf::TagText::text_entry_t::f_entries, sswf::TagText::text_entry_t::f_exact_length, sswf::TagText::text_setup_t::f_font, sswf::TagText::text_setup_t::f_font_height, sswf::TagText::text_setup_t::f_has_color, sswf::TagText::text_setup_t::f_has_font, f_new_text, f_records, sswf::TagText::text_define_t::f_type, f_version, sswf::Vectors::Get(), sswf::Color::IsSolid(), sswf::MemoryManager::MemClean(), sswf::TagBase::MinimumVersion(), sswf::TagCSMTextSettings::PreSaveCSMTextSettings(), TEXT_ENTRY_SETUP, and TEXT_ENTRY_TEXT.
ErrorManager::error_code_t TagText::RecordSetup | ( | void | ) | [private] |
This function records one setup in the array of text setup and text entries.
References sswf::Vectors::Count(), sswf::ErrorManager::ERROR_CODE_INVALID_TEXT_SETUP, sswf::ErrorManager::ERROR_CODE_NONE, sswf::TagText::text_setup_t::f_has_color, sswf::TagText::text_setup_t::f_has_font, f_records, f_setup, sswf::TagText::text_setup_t::IsUsed(), sswf::MemoryManager::MemAttach(), sswf::TagBase::OnError(), sswf::Vectors::Set(), and sswf::TagText::text_setup_t::Unused().
Referenced by AddText().
ErrorManager::error_code_t TagText::Save | ( | Data & | data | ) | [virtual] |
This function saves the TagText in the specified Data buffer.
Implements sswf::TagBase.
References sswf::Data::Align(), sswf::Data::Append(), sswf::assert(), sswf::Data::ByteSize(), sswf::Vectors::Count(), sswf::TagFont::font_info_t::f_advance, f_bounds, sswf::TagText::text_setup_t::f_color, sswf::TagText::text_entry_t::f_entries, sswf::TagText::text_entry_t::f_exact_length, sswf::TagText::text_setup_t::f_font, sswf::TagText::text_setup_t::f_font_height, sswf::TagText::text_setup_t::f_has_color, sswf::TagText::text_setup_t::f_has_font, sswf::TagText::text_setup_t::f_has_xadjust, sswf::TagText::text_setup_t::f_has_xoffset, sswf::TagText::text_setup_t::f_has_yoffset, sswf::TagFont::font_info_t::f_index, f_matrix, f_new_text, f_records, sswf::TagFont::font_info_t::f_saved_index, sswf::TagText::text_define_t::f_type, f_version, sswf::TagText::text_setup_t::f_x, sswf::TagText::text_setup_t::f_xadjust, sswf::TagText::text_setup_t::f_y, sswf::Vectors::Get(), sswf::TagFont::GlyphInfo(), sswf::Color::IsInvisible(), sswf::Data::PutByte(), sswf::Data::PutShort(), sswf::Matrix::Save(), sswf::SRectangle::Save(), sswf::Color::Save(), sswf::TagCSMTextSettings::SaveCSMTextSettings(), sswf::TagBaseID::SaveID(), sswf::TagBase::SaveTag(), sswf::Color::Set(), sswf::TagBase::SIBitSize(), sswf::TagBase::SWF_TAG_DEFINE_TEXT, sswf::TagBase::SWF_TAG_DEFINE_TEXT2, TEXT_ENTRY_SETUP, TEXT_ENTRY_TEXT, sswf::TagBase::UIBitSize(), and sswf::Data::WriteBits().
void TagText::SetBounds | ( | const SRectangle & | bounds | ) |
This function is used to define the largest box where the text appears. This is used to know whenever the text object needs to be rerendered on the screen.
The bounds can be larger. If smaller, some parts of the text may not get drawn properly.
[in] | bounds | The rectangle representing the bounds of this text. |
References f_bounds.
void TagText::SetMatrix | ( | const Matrix & | matrix | ) |
This function saves a copy of the specified matrix in the text tag. It is used to position the text, rotate it and scale it.
[in] | matrix | The text matrix |
References f_matrix.
TagBase::swf_type_t TagText::TypeFlags | ( | void | ) | const [virtual] |
This function returns a set of flags defining an text tag.
Implements sswf::TagBase.
References SWF_TYPE_DEFINE, SWF_TYPE_HAS_ID, and SWF_TYPE_REFERENCE.
SRectangle sswf::TagText::f_bounds [private] |
Referenced by Save(), and SetBounds().
Matrix sswf::TagText::f_matrix [private] |
Referenced by Save(), and SetMatrix().
bool sswf::TagText::f_new_text [private] |
Vectors sswf::TagText::f_records [private] |
Referenced by AddText(), DefineText(), PreSave(), RecordSetup(), and Save().
text_setup_t sswf::TagText::f_setup [private] |
Referenced by AddColor(), AddFont(), AddOffsets(), AddText(), and RecordSetup().
int sswf::TagText::f_version [private] |