FlashFontRecord Class Reference

Maintains a record of all text styles used, and the characters they contain. This is then used when exporting path records to create the DefineFont entries within a Flash format file when exporting the image. Elements are stored in a double-linked list. More...

#include <swffont.h>

Inheritance diagram for FlashFontRecord:

CCObject SimpleCCObject List of all members.

Public Member Functions

 FlashFontRecord (void)
 Creates a FlashFontRecord list node, and initialises any values.
 ~FlashFontRecord (void)
 Destroys this instance of FlashFontRecord.
FlashFontRecordAddElement (void)
 Adds an element to the tail of the list.
void DeleteLastElement (void)
 Deletes the previous item in the list.
void DeleteNextElement (void)
 Deletes the next item in the list.
WORD GetTypeface (void)
 Gets the value of mFontID.
WORD GetFontID (void)
 Gets the value of mFontID.
BOOL GetIsBold (void)
 Gets the value of mIsBold.
BOOL GetIsItalic (void)
 Gets the value of mIsItalic.
WCHARGetGlyphs (void)
 Gets a pointer to mGlyphs.
Path ** GetPaths (void)
 Gets a pointer to mpPaths.
FlashFontRecordGetLast (void)
 Gets mpLast.
FlashFontRecordGetNext (void)
 Gets mpNext.
void SetTypeface (WORD Typeface)
 Sets the value of mTypeface. This is a handle to a font name that is stored within the Camelot font manager.
void SetFontID (WORD FontID)
 Sets the value of mFontID, which is the number used to relate a DefineFont entry to a DefineText entry.
void SetIsBold (BOOL IsBold)
 Sets the value of mIsBold.
void SetIsItalic (BOOL IsItalic)
 Sets the value of mIsItalic.
BOOL AddGlyph (WCHAR Glyph, INT32 &Code)
 Adds a glyph to mGlyphs.
void AddPath (Path *ToAdd, INT32 Index)
 Adds a path reference to mpPaths.
void SetLast (FlashFontRecord *pLast)
 Sets the value of mpLast.
void SetNext (FlashFontRecord *pNext)
 Sets the value of mpNext.

Private Attributes

WORD mTypeface
WORD mFontID
BOOL mIsBold
BOOL mIsItalic
WCHAR mGlyphs [256]
PathmPaths [256]
FlashFontRecordmpLast
FlashFontRecordmpNext

Detailed Description

Maintains a record of all text styles used, and the characters they contain. This is then used when exporting path records to create the DefineFont entries within a Flash format file when exporting the image. Elements are stored in a double-linked list.

Author:
Graeme_Sutherland (Xara Group Ltd) <camelotdev@xara.com>
Date:
4/10/99

Definition at line 117 of file swffont.h.


Constructor & Destructor Documentation

FlashFontRecord::FlashFontRecord void   ) 
 

Creates a FlashFontRecord list node, and initialises any values.

Author:
Graeme_Sutherland (Xara Group Ltd) <camelotdev@xara.com>
Date:
4/10/99
Parameters:
- [INPUTS]
Returns:
-

Definition at line 118 of file swffont.cpp.

00119 {
00120     // Initialise the member variables, so as to avoid any unpleasentness later.
00121     mFontID     = 0;        // Set as 0.
00122     mTypeface   = 0;        // Default to 0.
00123     mIsBold     = FALSE;    // Initially the font isn't bold.
00124     mIsItalic   = FALSE;    // Initially the font isn't italic.
00125 
00126     // Pointers should always be initialised to NULL when created.
00127     mpLast      = NULL;     // No previous nodes.
00128     mpNext      = NULL;     // No subsequent nodes.
00129 
00130     // Ensure that the arrays are full of 0s.
00131     for ( UINT32 i = 0; i < FLASH_TEXT_ARRAY_SIZE; i++ )
00132     {
00133         mGlyphs [i] = 0;
00134         mPaths [i] = NULL;
00135     }
00136 }

FlashFontRecord::~FlashFontRecord void   ) 
 

Destroys this instance of FlashFontRecord.

Author:
Graeme_Sutherland (Xara Group Ltd) <camelotdev@xara.com>
Date:
4/10/99
Parameters:
- [INPUTS]
Returns:
-

Definition at line 150 of file swffont.cpp.

00151 {
00152     // Clean up any stray values.
00153     for ( UINT32 i = 0; i < FLASH_TEXT_ARRAY_SIZE; i++ )
00154     {
00155         Path* pPath = mPaths[i];
00156 
00157         if(pPath)
00158             delete pPath;
00159     }
00160 }


Member Function Documentation

FlashFontRecord * FlashFontRecord::AddElement void   ) 
 

Adds an element to the tail of the list.

Author:
Graeme_Sutherland (Xara Group Ltd) <camelotdev@xara.com>
Date:
4/10/99
Parameters:
- [INPUTS]
Returns:
pTail - The pointer to the new node.

Definition at line 174 of file swffont.cpp.

00175 {
00176     FlashFontRecord *pTail = new FlashFontRecord;
00177     
00178     // Set the appropriate pointers.
00179     pTail->SetLast ( this );        // Ensure that a reference exists to this object...
00180     pTail->SetNext ( mpNext );      // Avoids any problems if mpLast isn't NULL.
00181     mpNext = pTail;                 // ... and a reference exists to the new one.
00182 
00183     return pTail;
00184 }

BOOL FlashFontRecord::AddGlyph WCHAR  Glyph,
INT32 &  Code
 

Adds a glyph to mGlyphs.

Author:
Graeme_Sutherland (Xara Group Ltd) <camelotdev@xara.com>
Date:
4/10/99
Parameters:
Glyph - A single unicode character. [INPUTS] &Code - A reference which contains the position of the glyph in the array.
Returns:
TRUE if a character is added, otherwise false.

Definition at line 451 of file swffont.cpp.

00453 {
00454     // Set up the return values.
00455     BOOL bResult = TRUE;
00456     Code = 0;
00457 
00458     // Compare the value of the new character to the entries in the array.
00459     while ( mGlyphs [Code] != 0 )
00460     {
00461         if ( mGlyphs [Code] == Glyph )
00462         {
00463             // The character is already present within the listing, so quit out.
00464             bResult = FALSE;
00465             break;
00466         }
00467 
00468         // Increment the value of Code so that it points to the next element in the array.
00469         Code++;
00470     }
00471 
00472     mGlyphs[Code] = Glyph;          // Write the new value into the array.
00473 
00474     return bResult;
00475 }

void FlashFontRecord::AddPath Path ToAdd,
INT32  Index
 

Adds a path reference to mpPaths.

Author:
Graeme_Sutherland (Xara Group Ltd) <camelotdev@xara.com>
Date:
4/10/99
Parameters:
ToAdd - A pointer to a path. [INPUTS] Index - The matrix element to which you want to add it to.
Returns:
-

Definition at line 490 of file swffont.cpp.

00491 {
00492     mPaths [ Index ] = ToAdd;
00493 }

void FlashFontRecord::DeleteLastElement void   ) 
 

Deletes the previous item in the list.

Author:
Graeme_Sutherland (Xara Group Ltd) <camelotdev@xara.com>
Date:
4/10/99
Parameters:
- [INPUTS]
Returns:
-

Definition at line 198 of file swffont.cpp.

00199 {
00200     FlashFontRecord *pToDelete = mpLast;
00201     
00202     // Reset mpLast to be mpLast->GetLast (), so that the list isn't broken.
00203     mpLast = mpLast->GetLast ();
00204 
00205     delete pToDelete;
00206 }

void FlashFontRecord::DeleteNextElement void   ) 
 

Deletes the next item in the list.

Author:
Graeme_Sutherland (Xara Group Ltd) <camelotdev@xara.com>
Date:
4/10/99
Parameters:
- [INPUTS]
Returns:
-

Definition at line 220 of file swffont.cpp.

00221 {
00222     FlashFontRecord *pToDelete = mpNext;
00223     
00224     // Reset mpNext to be mpNext->GetNext (), so that the list isn't broken.
00225     mpNext = mpNext->GetNext ();
00226 
00227     delete pToDelete;
00228 }

WORD FlashFontRecord::GetFontID void   ) 
 

Gets the value of mFontID.

Author:
Graeme_Sutherland (Xara Group Ltd) <camelotdev@xara.com>
Date:
4/10/99
Parameters:
- [INPUTS]
Returns:
mFontID - The font ID number.

Definition at line 259 of file swffont.cpp.

00260 {
00261     return mFontID;
00262 }

WCHAR * FlashFontRecord::GetGlyphs void   ) 
 

Gets a pointer to mGlyphs.

Author:
Graeme_Sutherland (Xara Group Ltd) <camelotdev@xara.com>
Date:
4/10/99
Parameters:
- [INPUTS]
Returns:
*mGlyphs - A pointer to the array of characters used.

Definition at line 311 of file swffont.cpp.

00312 {
00313     return mGlyphs;
00314 }

BOOL FlashFontRecord::GetIsBold void   ) 
 

Gets the value of mIsBold.

Author:
Graeme_Sutherland (Xara Group Ltd) <camelotdev@xara.com>
Date:
4/10/99
Parameters:
- [INPUTS]
Returns:
IsBold - mIs this font style bold?

Definition at line 277 of file swffont.cpp.

00278 {
00279     return mIsBold;
00280 }

BOOL FlashFontRecord::GetIsItalic void   ) 
 

Gets the value of mIsItalic.

Author:
Graeme_Sutherland (Xara Group Ltd) <camelotdev@xara.com>
Date:
4/10/99
Parameters:
- [INPUTS]
Returns:
IsItalic - mIs this font style Italic?

Definition at line 294 of file swffont.cpp.

00295 {
00296     return mIsItalic;
00297 }

FlashFontRecord * FlashFontRecord::GetLast void   ) 
 

Gets mpLast.

Author:
Graeme_Sutherland (Xara Group Ltd) <camelotdev@xara.com>
Date:
4/10/99
Parameters:
- [INPUTS]
Returns:
*mpLast - A pointer to the previous node in the linked list.

Definition at line 345 of file swffont.cpp.

00346 {
00347     return mpLast;
00348 }

FlashFontRecord * FlashFontRecord::GetNext void   ) 
 

Gets mpNext.

Author:
Graeme_Sutherland (Xara Group Ltd) <camelotdev@xara.com>
Date:
4/10/99
Parameters:
- [INPUTS]
Returns:
*mpNext - A pointer to the next node in the linked list.

Definition at line 362 of file swffont.cpp.

00363 {
00364     return mpNext;
00365 }

Path ** FlashFontRecord::GetPaths void   ) 
 

Gets a pointer to mpPaths.

Author:
Graeme_Sutherland (Xara Group Ltd) <camelotdev@xara.com>
Date:
7/10/99
Parameters:
- [INPUTS]
Returns:
*mpPaths - A pointer to the array of paths of the characters used.

Definition at line 328 of file swffont.cpp.

00329 {
00330     return mPaths;
00331 }

WORD FlashFontRecord::GetTypeface void   ) 
 

Gets the value of mFontID.

Author:
Graeme_Sutherland (Xara Group Ltd) <camelotdev@xara.com>
Date:
26/10/99
Parameters:
- [INPUTS]
Returns:
mTypeface - The typeface ID number.

Definition at line 242 of file swffont.cpp.

00243 {
00244     return mTypeface;
00245 }

void FlashFontRecord::SetFontID WORD  FontID  ) 
 

Sets the value of mFontID, which is the number used to relate a DefineFont entry to a DefineText entry.

Author:
Graeme_Sutherland (Xara Group Ltd) <camelotdev@xara.com>
Date:
4/10/99
Parameters:
FontID - The ID number of a font within a Flash file. [INPUTS]
Returns:
-

Definition at line 398 of file swffont.cpp.

00399 {
00400     mFontID = FontID;
00401 }

void FlashFontRecord::SetIsBold BOOL  IsBold  ) 
 

Sets the value of mIsBold.

Author:
Graeme_Sutherland (Xara Group Ltd) <camelotdev@xara.com>
Date:
4/10/99
Parameters:
IsBold - Is the current font in a bold typeface? [INPUTS]
Returns:
-

Definition at line 415 of file swffont.cpp.

00416 {
00417     mIsBold = IsBold;
00418 }

void FlashFontRecord::SetIsItalic BOOL  IsItalic  ) 
 

Sets the value of mIsItalic.

Author:
Graeme_Sutherland (Xara Group Ltd) <camelotdev@xara.com>
Date:
4/10/99
Parameters:
IsItalic - Is the current font in an Italic typeface? [INPUTS]
Returns:
-

Definition at line 432 of file swffont.cpp.

00433 {
00434     mIsItalic = IsItalic;
00435 }

void FlashFontRecord::SetLast FlashFontRecord pLast  ) 
 

Sets the value of mpLast.

Author:
Graeme_Sutherland (Xara Group Ltd) <camelotdev@xara.com>
Date:
4/10/99
Parameters:
pLast - A pointer to the previous FlashFontRecord in the linked list. [INPUTS]
Returns:
-

Definition at line 507 of file swffont.cpp.

00508 {
00509     mpLast = pLast;
00510 }

void FlashFontRecord::SetNext FlashFontRecord pNext  ) 
 

Sets the value of mpNext.

Author:
Graeme_Sutherland (Xara Group Ltd) <camelotdev@xara.com>
Date:
4/10/99
Parameters:
pNext - A pointer to the next FlashFontRecord in the linked list. [INPUTS]
Returns:
-

Definition at line 524 of file swffont.cpp.

00525 {
00526     mpNext = pNext;
00527 }

void FlashFontRecord::SetTypeface WORD  Typeface  ) 
 

Sets the value of mTypeface. This is a handle to a font name that is stored within the Camelot font manager.

Author:
Graeme_Sutherland (Xara Group Ltd) <camelotdev@xara.com>
Date:
26/10/99
Parameters:
Typeface - The ID number of a font in the Camelot image. [INPUTS]
Returns:
-

Definition at line 380 of file swffont.cpp.

00381 {
00382     mTypeface = Typeface;
00383 }


Member Data Documentation

WORD FlashFontRecord::mFontID [private]
 

Definition at line 155 of file swffont.h.

WCHAR FlashFontRecord::mGlyphs[256] [private]
 

Definition at line 158 of file swffont.h.

BOOL FlashFontRecord::mIsBold [private]
 

Definition at line 156 of file swffont.h.

BOOL FlashFontRecord::mIsItalic [private]
 

Definition at line 157 of file swffont.h.

Path* FlashFontRecord::mPaths[256] [private]
 

Definition at line 159 of file swffont.h.

FlashFontRecord* FlashFontRecord::mpLast [private]
 

Definition at line 160 of file swffont.h.

FlashFontRecord* FlashFontRecord::mpNext [private]
 

Definition at line 161 of file swffont.h.

WORD FlashFontRecord::mTypeface [private]
 

Definition at line 154 of file swffont.h.


The documentation for this class was generated from the following files:
Generated on Sat Nov 10 03:54:24 2007 for Camelot by  doxygen 1.4.4