os::Font Class Reference
[The Syllable Graphical User Interface API]

Text Font class. More...

Inheritance diagram for os::Font:

os::Flattenable List of all members.

Public Types

typedef std::vector< float > size_list_t

Public Member Functions

 Font ()
 Default Constructor.
 Font (const Font &font)
 Constructor.
 Font (const font_properties &sProps)
 Constructor.
 Font (const String &cConfigName)
 Constructor.
void AddRef ()
 Adds a reference counter.
void Release ()
 Releases all instances of a Font.
status_t SetProperties (const font_properties &sProps)
 Sets the properties of the Font.
status_t SetProperties (const String &cConfigName)
 Sets the properties of the Font.
status_t SetProperties (float vSize, float vShear=0.0f, float vRotation=0.0f)
 Sets the properties of the Font.
status_t SetFamilyAndStyle (const char *pzFamily, const char *pzStyle)
 Sets the family and style of the Font.
void SetSize (float vSize)
 Sets the size.
void SetShear (float vShear)
 Sets the shear.
void SetRotation (float vRotation)
 Sets the rotation.
void SetSpacing (int nSpacing)
 Sets the spacing of a font.
void SetEncoding (int nEncoding)
 Sets the encoding of the Font.
void SetFace (uint16 nFace)
 Sets the face of the Font.
void SetFlags (uint32 nFlags)
 Sets the flags for the Font.
String GetStyle () const
 Gets the Style of the Font.
String GetFamily () const
 Gets the family of the Font.
float GetSize () const
 Gets the size of the Font.
float GetShear () const
 Gets the shear of the Font.
float GetRotation () const
 Gets the rotation of the Font.
int GetSpacing () const
 Gets the spacing of the Font.
int GetEncoding () const
 Gets the encoding of the Font.
uint32 GetFlags () const
 Gets the flags passed to the font.
font_direction GetDirection () const
 Gets the direction of the Font.
void GetTruncatedStrings (const char *stringArray[], int32 numStrings, uint32 mode, float width, char *resultArray[]) const
 Get truncated strings.
float GetStringWidth (const char *pzString, int nLength=-1) const
 Gets the strings width.
float GetStringWidth (const String &cString) const
 Gets the strings width.
void GetStringWidths (const char **apzStringArray, const int *anLengthArray, int nStringCount, float *avWidthArray) const
 Gets multiple string widths.
Point GetTextExtent (const char *pzString, int nLength=-1, uint32 nFlags=0, int nTargetWidth=-1) const
 
Description:

Point GetTextExtent (const String &cString, uint32 nFlags=0, int nTargetWidth=-1) const
 
Description:

void GetTextExtents (const char **apzStringArray, const int *anLengthArray, int nStringCount, Point *acExtentArray, uint32 nFlags, int nTargetWidth=-1) const
 
Description:

int GetStringLength (const char *pzString, float vWidth, bool bIncludeLast=false) const
 Gets the length of a string.
int GetStringLength (const char *pzString, int nLength, float vWidth, bool bIncludeLast=false) const
 Gets the length of a string.
int GetStringLength (const String &cString, float vWidth, bool bIncludeLast=false) const
 Gets the length of a string.
void GetStringLengths (const char **apzStringArray, const int *anLengthArray, int nStringCount, float vWidth, int anMaxLengthArray[], bool bIncludeLast=false) const
 Gets the lengths of multiple strings.
void GetHeight (font_height *psHeight) const
 Gets the height of the Font.
std::vector< uint32 > GetSupportedCharacters () const
 Gets the supported characters of the Font.
int GetFontID (void) const
 Gets the Font handle ID.
bool operator== (const Font &cOther)
bool operator!= (const Font &cOther)
Fontoperator= (const Font &cOther)
virtual size_t GetFlattenedSize (void) const
virtual status_t Flatten (uint8 *pBuffer, size_t nSize) const
virtual status_t Unflatten (const uint8 *pBuffer)
virtual int GetType (void) const

Static Public Member Functions

static status_t GetConfigNames (std::vector< String > *pcTable)
 Get a list of default font names.
static status_t GetDefaultFont (const String &cName, font_properties *psProps)
 Get the properties of a default font.
static status_t SetDefaultFont (const String &cName, const font_properties &sProps)
 Set the properties of a default font.
static status_t AddDefaultFont (const String &cName, const font_properties &sProps)
 Add a default font, or modify one if it already exists.
static int GetFamilyCount ()
 Get number of installed Font families.
static status_t GetFamilyInfo (int nIndex, char *pzFamily)
 Get the name of a given font family.
static int GetStyleCount (const char *pzFamily)
 Get number of styles in a given family.
static status_t GetStyleInfo (const char *pzFamily, int nIndex, char *pzStyle, uint32 *pnFlags=NULL)
 Get info about a given font style.
static status_t GetBitmapSizes (const String &cFamily, const String &cStyle, size_list_t *pcList)
static bool Rescan ()
 Scans for new fonts.

Friends

class View

Detailed Description

Description:
The os::View class needs a text font to be able to render text. The Font class represents all the properties of the text like width and height of each glyph, rotation/shearing of the glyps and most importantly the actual graphical "image" of each glyph.
Font objects are reference counted to ease sharing between views. If the same font is set on two views they will both be affected by subsequent changes to the font.

A Font keeps track of all view's it has been added to so it can notify them whenever one of the properties of the Font changes.

Syllable primarily uses scalable TrueType Fonts but can also use various bitmap Fonts. When using TrueType Font's the glyphs will be scaled to the requested point-size, but when using bitmap Fonts the size will be "snapped" to the closest size supported by the Font.

When rendering TrueType Fonts, the glyphs have the ability to be antialiazed to improve the quality of the fonts. The view can either antialiaze against a fixed background color to maximize speed or against the background it is actually rendered at.

See also:
os::Flattenable
Author:
Kurt Skauen ([email protected]) with modifications by the Syllable team.


Member Typedef Documentation

typedef std::vector<float> os::Font::size_list_t


Constructor & Destructor Documentation

Font::Font (  ) 

..

Description:
The Default Constructor will get all of its properties as it gets used,
Author:
Kurt Skauen ([email protected]) and Rick Caudill([email protected])

Font::Font ( const Font font  ) 

..

Description:
This constructor will get all of its properties from the font that you passed to it.
Author:
Kurt Skauen ([email protected]) and Rick Caudill([email protected])

Font::Font ( const font_properties sProps  ) 

..

Description:
This constructor will get all of its major properties from the font_properties that you passed to it.
Author:
Kurt Skauen ([email protected]) and Rick Caudill([email protected])

Font::Font ( const String cConfigName  ) 

..

Description:
This constructor will pull all of its major properties from the os::String you passed to it. The os::String should be a valid Font Config Name.
Author:
Kurt Skauen ([email protected]) and Rick Caudill([email protected])


Member Function Documentation

void Font::AddRef (  ) 

Description:
Adds a reference counter. Please call this method after calling a constructor.
See also:
Release()
Author:

void Font::Release (  ) 

Description:
This is the function you want to call when you want to delete a Font. Don't just delete the Font as that could cause problems, instead call this method.
See also:
AddRef()
Author:

status_t Font::SetProperties ( const font_properties sProps  ) 

Description:
Sets the properties of the Font to the font_properties passed to it.
Author:
Kurt Skauen ([email protected]) and Rick Caudill([email protected])

status_t Font::SetProperties ( const String cConfigName  ) 

Description:
Sets the properties of the Font to the Font name specified.
Author:
Kurt Skauen ([email protected]) and Rick Caudill([email protected])

status_t Font::SetProperties ( float  vSize,
float  vShear = 0.0f,
float  vRotation = 0.0f 
)

Description:
Sets the properties of the Font to the properties passed to it.
Author:
Kurt Skauen ([email protected]) and Rick Caudill([email protected])

status_t Font::SetFamilyAndStyle ( const char *  pzFamily,
const char *  pzStyle 
)

Description:
Sets the family(the name of the font) and the style(the type of the Font) of the Font.
See also:
SetProperties(),GetConfigNames()
Author:
Kurt Skauen ([email protected]) and Rick Caudill([email protected])

void Font::SetSize ( float  vSize  ) 

..

Description:
Sets the size of the Font in Points... Remember that with non-TrueType Fonts, the Font will be resized to an approximation. This normally is all right, but sometimes you will have a Font that is 8.5pt instead of a Font that is 9pt.
Author:
Kurt Skauen ([email protected]) and Rick Caudill([email protected])

void Font::SetShear ( float  vShear  ) 

Description:
Sets the shear of the Font...
Author:
Kurt Skauen ([email protected]) and Rick Caudill([email protected])

void Font::SetRotation ( float  vRotation  ) 

..

Description:
Sets the rotation of the Font. The higher the float passed, the higher the rotation. If you pass 90.0 to this method then the font will be rotated 90 degrees and etc...
Author:
Kurt Skauen ([email protected]) and Rick Caudill([email protected])

void os::Font::SetSpacing ( int  nSpacing  ) 

Description:
Sets the spacing of the Font. This function is not implemented yet!
Author:
Kurt Skauen ([email protected]) and Rick Caudill([email protected])

void os::Font::SetEncoding ( int  nEncoding  ) 

Description:
Sets the encoding of the Font. This function is not implemented yet!
Author:
Kurt Skauen ([email protected]) and Rick Caudill([email protected])

void os::Font::SetFace ( uint16  nFace  ) 

Description:
Sets the face of the Font. This function is not implemented yet!
Author:
Kurt Skauen ([email protected]) and Rick Caudill([email protected])

void Font::SetFlags ( uint32  nFlags  ) 

Description:
Sets the flags for the Font.
The flags that can be set are: FPF_MONOSPACED FPF_SMOOTHED //Antialiased FPF_BOLD FPF_ITALIC FPF_SYSTEM

See also:
GetFlags()
Author:
Kurt Skauen ([email protected]) and Rick Caudill([email protected])

String Font::GetStyle (  )  const

..

Description:
This returns the name of the style(ie: Regular, Bold,...)
See also:
SetFamilyAndStyle()
Author:
Kurt Skauen ([email protected]) and Rick Caudill([email protected])

String Font::GetFamily (  )  const

..

Description:
This returns the family of the Font(IE: Arial, Sans Serif...)
See also:
SetFamilyAndStyle()
Author:
Kurt Skauen ([email protected]) and Rick Caudill([email protected])

float Font::GetSize (  )  const

..

Description:
This method returns the size of the Font.
See also:
SetSize()
Author:
Kurt Skauen ([email protected]) and Rick Caudill([email protected])

float Font::GetShear (  )  const

Description:
This method returns the shear of the Font.
See also:
SetShear()
Author:
Kurt Skauen ([email protected]) and Rick Caudill([email protected])

float Font::GetRotation (  )  const

Description:
This method returns the rotation of the Font.
See also:
SetRotation()
Author:
Kurt Skauen ([email protected]) and Rick Caudill([email protected])

int Font::GetSpacing (  )  const

Description:
This method returns the spacing of the Font. This always returns 0 right now.
See also:
SetSpacing()
Author:
Kurt Skauen ([email protected]) and Rick Caudill([email protected])

int Font::GetEncoding (  )  const

Description:
This method returns the encoding of the Font.
See also:
SetEncoding()
Author:
Kurt Skauen ([email protected]) and Rick Caudill([email protected])

uint32 Font::GetFlags (  )  const

Description:
This method will get all the flags that have been passed to the Font
See also:
SetFlags()
Author:
Kurt Skauen ([email protected]) and Rick Caudill([email protected])

font_direction Font::GetDirection (  )  const

Description:
Right now this function will always return FONT_LEFT_TO_RIGHT.
See also:
SetDirection()
Author:
Kurt Skauen ([email protected]) and Rick Caudill([email protected])

void os::Font::GetTruncatedStrings ( const char *  stringArray[],
int32  numStrings,
uint32  mode,
float  width,
char *  resultArray[] 
) const

Description:
See also:
Author:
Kurt Skauen ([email protected])

float Font::GetStringWidth ( const char *  pzString,
int  nLength = -1 
) const

...

Description:
Gets the strings width.
See also:
Author:
Kurt Skauen ([email protected])

float Font::GetStringWidth ( const String cString  )  const

..

Description:
Gets the strings width.
See also:
Author:
Kurt Skauen

void Font::GetStringWidths ( const char **  apzStringArray,
const int *  anLengthArray,
int  nStringCount,
float *  avWidthArray 
) const

Description:
Gets mulitple string widths.
See also:
Author:
Kurt Skauen ([email protected])

Point Font::GetTextExtent ( const char *  pzString,
int  nLength = -1,
uint32  nFlags = 0,
int  nTargetWidth = -1 
) const

See also:
Author:

Point Font::GetTextExtent ( const String cString,
uint32  nFlags = 0,
int  nTargetWidth = -1 
) const

See also:
Author:

void Font::GetTextExtents ( const char **  apzStringArray,
const int *  anLengthArray,
int  nStringCount,
Point acExtentArray,
uint32  nFlags,
int  nTargetWidth = -1 
) const

See also:
Author:

int Font::GetStringLength ( const char *  pzString,
float  vWidth,
bool  bIncludeLast = false 
) const

Description:
Gets the length of a string.
See also:
Author:
Kurt Skauen ([email protected])

int Font::GetStringLength ( const char *  pzString,
int  nLength,
float  vWidth,
bool  bIncludeLast = false 
) const

Description:
Gets the length of a string.
See also:
Author:
Kurt Skauen ([email protected])

int Font::GetStringLength ( const String cString,
float  vWidth,
bool  bIncludeLast = false 
) const

Description:
Gets the length of a string.
See also:
Author:
Kurt Skauen ([email protected])

void os::Font::GetStringLengths ( const char **  apzStringArray,
const int *  anLengthArray,
int  nStringCount,
float  vWidth,
int  anMaxLengthArray[],
bool  bIncludeLast = false 
) const

Description:
Gets the lengths of multiple strings.
See also:
Author:
Kurt Skauen ([email protected])

void os::Font::GetHeight ( font_height psHeight  )  const [inline]

Description:
Gets the height of the Font.
Parameters:
psHeight - a font_height pointer which will contain the height of the Font.
See also:
Author:
Kurt Skauen ([email protected])

std::vector< uint32 > Font::GetSupportedCharacters (  )  const

Description:
Returns a vector of the supported characters that the Font can use.
See also:
Author:
Henrik Isaksason

int os::Font::GetFontID ( void   )  const [inline]

Description:
Gets the Font handle ID.
See also:
Author:
Kurt Skauen ([email protected])

bool Font::operator== ( const Font cOther  ) 

bool Font::operator!= ( const Font cOther  ) 

Font & Font::operator= ( const Font cOther  ) 

status_t Font::GetConfigNames ( std::vector< String > *  pcTable  )  [static]

Description:
This method will give you a list of all the default font names.
Parameters:
pcTable - A vector pointer of os::String's to return all the config names in.
Returns:
See also:
Author:
Kurt Skauen ([email protected])

status_t Font::GetDefaultFont ( const String cName,
font_properties psProps 
) [static]

Description:
Gets the properties of the default font.
Parameters:
cName - Name of the default fFont.
psProps - font_propties pointer which will contain the properties of the default Font.
Returns:
See also:
Author:
Kurt Skauen ([email protected])

status_t Font::SetDefaultFont ( const String cName,
const font_properties sProps 
) [static]

Description:
Note:
Warning:
Parameters:
\return 
See also:
Author:
Kurt Skauen ([email protected])

status_t Font::AddDefaultFont ( const String cName,
const font_properties sProps 
) [static]

Description:
Note:
Warning:
Parameters:
\return 
See also:
Author:
Kurt Skauen ([email protected])

int Font::GetFamilyCount (  )  [static]

Description:
Returns the number of Font families
Parameters:
\return 
See also:
Author:
Kurt Skauen ([email protected])

status_t Font::GetFamilyInfo ( int  nIndex,
char *  pzFamily 
) [static]

Description:
Note:
Warning:
Parameters:
\return 
See also:
Author:
Kurt Skauen ([email protected])

int Font::GetStyleCount ( const char *  pzFamily  )  [static]

Description:
Returns the number of styles in the family
Parameters:
pzFamily - The family.
Returns:
The number of styles.
Author:
Kurt Skauen ([email protected])

status_t Font::GetStyleInfo ( const char *  pzFamily,
int  nIndex,
char *  pzStyle,
uint32 *  pnFlags = NULL 
) [static]

Description:
Get all the information about the Font.
Parameters:
pzFamily - The family of the Font.
nIndex - The index of the family.
pzStyle - The style of the Font.
pnFlags - The flags of the Font.
Returns:
See also:
Author:
Kurt Skauen ([email protected])

status_t Font::GetBitmapSizes ( const String cFamily,
const String cStyle,
size_list_t pcList 
) [static]

bool Font::Rescan (  )  [static]

..

Description:
This method calls the appserver to rescan for new Fonts.
See also:
Author:
Rick Caudill([email protected])

size_t Font::GetFlattenedSize ( void   )  const [virtual]

Implements os::Flattenable.

status_t Font::Flatten ( uint8 *  pBuffer,
size_t  nSize 
) const [virtual]

Implements os::Flattenable.

status_t Font::Unflatten ( const uint8 *  pBuffer  )  [virtual]

Implements os::Flattenable.

virtual int os::Font::GetType ( void   )  const [inline, virtual]

Implements os::Flattenable.


Friends And Related Function Documentation

friend class View [friend]


Generated on Sat May 9 22:51:27 2009 for Syllable higlevel API by  doxygen 1.5.1