Made to Order Software Corporation Logo

libsswf: sswf::TagCSMTextSettings Class Reference

Defines extraneous settings for text tags. More...

#include <libsswf.h>

Inheritance diagram for sswf::TagCSMTextSettings:

:TagEditText :TagText

List of all members.


Public Types

enum  csm_text_gridfit_t { CSM_TEXT_GRIDFIT_NO_GRID = 0, CSM_TEXT_GRIDFIT_PIXEL = 1, CSM_TEXT_GRIDFIT_SUBPIXEL = 2 }
 Defines how to draw points in regard to screen pixels. More...
enum  csm_text_renderer_t { CSM_TEXT_RENDERER_NORMAL = 0, CSM_TEXT_RENDERER_FLASH = 1 }
 The list of renderer available in the Flash player. More...

Public Member Functions

bool IsCSMTextSettingsDefined (void) const
 Check whether an option is not the default.
void SetGridFit (csm_text_gridfit_t csm_text_gridfit)
 Defines the grid to use.
void SetRenderer (csm_text_renderer_t csm_text_renderer)
 Defines the renderer to use.
void SetSharpness (float sharpness)
 Defines the sharpness to use.
void SetThickness (float thickness)
 Defines the thickness to use.
 TagCSMTextSettings (void)
 Initializes the CSM Text Settings tag.
virtual ~TagCSMTextSettings (void)
 Clean up the TagCSMTextSettings.

Protected Member Functions

ErrorManager::error_code_t ParseTag (TagBase::swf_tag_t tag, const Data &data)
 Parse data from a file into a CSMTextSettings tag.
ErrorManager::error_code_t PreSaveCSMTextSettings (void)
 Ensure that the minimum version is 8.
ErrorManager::error_code_t SaveCSMTextSettings (Data &data)
 Save the TagCSMTextSettings in the specified Data buffer.

Private Attributes

csm_text_gridfit_t f_csm_text_gridfit
csm_text_renderer_t f_csm_text_renderer
float f_sharpness
float f_thickness

Detailed Description

This object defines extraneous settings to be used with text tags such as DefineText, DefineText2 and DefineEditText.

See also:
sswf::TagEditText

sswf::TagFont

sswf::TagText

SWF Alexis' Reference—CSM Text Settings

SWF Alexis' Reference—swf_tag


Member Enumeration Documentation

This enumeration is used to define how to render fonts in regard to pixels.

Enumerator:
CSM_TEXT_GRIDFIT_NO_GRID  The default value meaning draw text anywhere.

This value is the default and lets the renderer draw the font at any position. Very useful if you are scrolling your text horizontally or rotating it.

CSM_TEXT_GRIDFIT_PIXEL  The simple pixel grid snap feature.

This value indicates that fonts should be drawn on a per pixel basis.

There are two problems with this method:

  • Some glyphs will be rendered a little further than they should otherwise be. This can make some words look broken.
  • Moving such fonts in any direction will make it jump if the move is too slow.

CSM_TEXT_GRIDFIT_SUBPIXEL  Use 1/3rd of a pixel to snap the font.

This feature allows for 1/3rd of a pixel snapping system that mostly solves the two problems of the PIXEL Grid Fit.

This enumeration is used to list all the text renderers available in a Flash Player.

Enumerator:
CSM_TEXT_RENDERER_NORMAL  Use the normal renderer.

This value is used as the default. It will use the older Flash renderer instead of the FontType specialized renderer.

CSM_TEXT_RENDERER_FLASH  Use the special FontType renderer.

This value is used to ask the player to use the new Font Type renderer. This option appeared in SFW version 8.

It is supposed to do a much better job at drawing small fonts.


Constructor & Destructor Documentation

TagCSMTextSettings::TagCSMTextSettings ( void   ) 

This function initializes the CSM Text Settings tag to its defaults. And by default it will not be used.

References CSM_TEXT_GRIDFIT_NO_GRID, CSM_TEXT_RENDERER_NORMAL, f_csm_text_gridfit, f_csm_text_renderer, f_sharpness, and f_thickness.

TagCSMTextSettings::~TagCSMTextSettings ( void   )  [virtual]

This function cleans up the CSM Text Settings tag.

Also, the existance of a virtual function makes the TagCSMTextSettings class polymorphic.


Member Function Documentation

bool TagCSMTextSettings::IsCSMTextSettingsDefined ( void   )  const

This function checks all the parameters of the TagCSMTextSettings and returns true if any one of them was modified and thus the tag needs to be saved.

Returns:
True if the tag needs to be saved.

References CSM_TEXT_GRIDFIT_NO_GRID, CSM_TEXT_RENDERER_NORMAL, f_csm_text_gridfit, f_csm_text_renderer, f_sharpness, and f_thickness.

Referenced by PreSaveCSMTextSettings(), and SaveCSMTextSettings().

ErrorManager::error_code_t TagCSMTextSettings::ParseTag ( TagBase::swf_tag_t  tag,
const Data data 
) [protected]

This function does nothing since the CSMTextSettings tag has no data.

Parameters:
[in] tag The tag that generated this call
[in] data The Data buffer from the Flash file being loaded
Returns:
An error if one occurs, or ErrorManager::ERROR_CODE_NONE

Reimplemented in sswf::TagEditText, and sswf::TagText.

References sswf::ErrorManager::ERROR_CODE_NONE, f_csm_text_gridfit, f_csm_text_renderer, f_sharpness, f_thickness, sswf::Data::GetBits(), sswf::Data::GetLongFloat(), and sswf::TagBaseID::ParseID().

ErrorManager::error_code_t TagCSMTextSettings::PreSaveCSMTextSettings ( void   )  [protected]

This function ensures that the minimum version is 8 if the tag needs to be saved. Otherwise it does nothing.

Returns:
An error code or ErrorManager::ERROR_CODE_NONE.

References sswf::ErrorManager::ERROR_CODE_NONE, IsCSMTextSettingsDefined(), and sswf::TagBase::MinimumVersion().

Referenced by sswf::TagText::PreSave(), and sswf::TagEditText::PreSave().

ErrorManager::error_code_t TagCSMTextSettings::SaveCSMTextSettings ( Data data  )  [protected]

This function checks whether the tag needs to be saved. If not, nothing happens and the function returns immediately. Otherwise, it saves the TagCSMTextSettings.

Parameters:
[in] data The Data buffer where the tag is saved
Returns:
An error code or ErrorManager::ERROR_CODE_NONE.

References sswf::ErrorManager::ERROR_CODE_NONE, f_csm_text_gridfit, f_csm_text_renderer, f_sharpness, f_thickness, IsCSMTextSettingsDefined(), sswf::Data::PutByte(), sswf::Data::PutLongFloat(), sswf::TagBaseID::SaveID(), sswf::TagBase::SaveTag(), sswf::TagBase::SWF_TAG_CSM_TEXT_SETTINGS, and sswf::Data::WriteBits().

Referenced by sswf::TagText::Save(), and sswf::TagEditText::Save().

void TagCSMTextSettings::SetGridFit ( csm_text_gridfit_t  csm_text_gridfit  ) 

This function is used to define the grid to use with this TagCSMTextSetting.

Parameters:
[in] csm_text_gridfit The new grid mode.

References f_csm_text_gridfit.

void TagCSMTextSettings::SetRenderer ( csm_text_renderer_t  csm_text_renderer  ) 

This function is used to define the renderer to use with this TagCSMTextSetting.

Parameters:
[in] csm_text_renderer The new renderer.

References f_csm_text_renderer.

void TagCSMTextSettings::SetSharpness ( float  sharpness  ) 

This function is used to define the sharpness to use with this TagCSMTextSetting.

Parameters:
[in] sharpness The new sharpness.

References f_sharpness.

void TagCSMTextSettings::SetThickness ( float  thickness  ) 

This function is used to define the thickness to use with this TagCSMTextSetting.

Parameters:
[in] thickness The new thickness.

References f_thickness.


Member Data Documentation


The documentation for this class was generated from the following files:


Generated on Wed Mar 18 15:13:59 2009 for libsswf by  doxygen 1.5.5