Main Page | Namespace List | Class Hierarchy | Class List | File List | Namespace Members | Class Members | File Members

CascadeFont Class Reference

represents a font More...

#include <cascade/graphics/CascadeFont.h>

Inheritance diagram for CascadeFont:

CascadeObject List of all members.

Public Types

typedef bool() EnumProc (const Attributes &attributes, void *pClientData)
enum  WeightFlags { kNormal = 0, kBold = (1 << 0), kItalic = (1 << 1) }
enum  { kMaxFaceName = 48, kMaxFaceNameLen = kMaxFaceName - 1 }
enum  TruncationType { kTruncateRight = 0, kTruncateLeft = 1, kTruncateCenter = 2 }

Public Member Functions

 CascadeFont ()
 CascadeFont (const CascadeFont &font)
virtual ~CascadeFont ()
bool operator== (const CascadeFont &that) const
bool operator!= (const CascadeFont &that) const
void GetAttributes (Attributes &attributesToSet)
bool SetAttributes (const Attributes &attributes)
bool EnumFonts (EnumProc *pEnumProc, void *pClientData)
CascadeDims GetTextExtent (const CascadeString &string)
void GetFontMetrics (Metrics &metricsToSet)
bool TruncateText (const CascadeString &text, const CascadeString &ellipsis, const CascadeDims &dims, CascadeString &truncatedTextToSet, TruncationType truncationType=kTruncateRight)

Friends

class CascadeBitmap
 true if it successfully truncated the string, false otherwise
class CascadeScreen

Classes

class  Attributes
 Attributes describes a font's attributes. More...
class  Metrics
 Metrics describes a font's metrics. More...

Detailed Description

represents a font

Skip the description

CascadeFont houses a lightweight representation of a font. CascadeFonts are arguments to the text drawing functions in CascadeBitmap.

CascadeFonts are specified using CascadeFont::Attributes. Metric information about a font is specified using CascadeFont::Metrics.

See also:
CascadeFont::Attributes, CascadeFont::Metrics

class CascadeFont


Member Typedef Documentation

typedef bool() CascadeFont::EnumProc(const Attributes &attributes, void *pClientData)
 

Callback function for enumerating available fonts in the system

Clients provide their own EnumProc to the EnumFonts() function. Your custom EnumProc will get called back by the EnumFonts() function, one for each font available in the system.

Parameters:
attributes the attributes of the font
pClientData the void * pClientData passed thru from EnumFonts()
Returns:
You should return true to continue enumeration, false to abort it
See also:
EnumFonts()


Member Enumeration Documentation

anonymous enum
 

Enumeration values:
kMaxFaceName  size of a buffer that holds a font face name
kMaxFaceNameLen  maximum number of characters in a font face name

enum CascadeFont::TruncationType
 

Enumeration values:
kTruncateRight 
kTruncateLeft 
kTruncateCenter 

enum CascadeFont::WeightFlags
 

represents a combination of font weights

WeightFlags is used to specify the font weight in a set of font Attributes.

See also:
CascadeFont::Attributes
Enumeration values:
kNormal  normal font weight
kBold  bold font weight
kItalic  italic font weight


Constructor & Destructor Documentation

CascadeFont::CascadeFont  ) 
 

default constructor

The default constructor initializes the CascadeFont to refer to the default system font.

CascadeFont::CascadeFont const CascadeFont font  ) 
 

copy constructor

This copy constructor copies the font from the font passed in.

Parameters:
font the font to copy

virtual CascadeFont::~CascadeFont  )  [virtual]
 

destructor

The CascadeFont destructor is lightweight.


Member Function Documentation

bool CascadeFont::EnumFonts EnumProc pEnumProc,
void *  pClientData
 

enumerates the fonts in the system

EnumFonts() calls (*pEnumProc) once for each font in the system that can be described by the value of the attributes passed into (*pEnumProc). EnumFonts() returns true if enumeration completed successfully, false if enumeration was aborted due to a (*pEnumProc) invocation returning false.

Parameters:
pEnumProc the callback proc for enumeration
pClientData data passed straight through to the enum proc
Returns:
true if enumeration finished; false if it was aborted by an enum proc
See also:
EnumProc

void CascadeFont::GetAttributes Attributes attributesToSet  ) 
 

gets the attributes for the font

GetAttributes() fills attributesToSet with the attributes of the font.

Parameters:
attributesToSet the attribute structure to fill in with the font attributes

void CascadeFont::GetFontMetrics Metrics metricsToSet  ) 
 

gets the font metrics

GetFontMetrics() sets metricsToSet with the font metrics.

Parameters:
metricsToSet the metrics structure to fill in with the font metrics

CascadeDims CascadeFont::GetTextExtent const CascadeString string  ) 
 

measures the pixel dimensions of a string in this font

call GetTextExtent() to get the dimensions of a string (in pixels).

Parameters:
string the string to measure
Returns:
the dimensions of the string in pixels

bool CascadeFont::operator!= const CascadeFont that  )  const
 

comparison operator

This comparison operator tests for inequality.

bool CascadeFont::operator== const CascadeFont that  )  const
 

comparison operator

This comparison operator tests for equality.

bool CascadeFont::SetAttributes const Attributes attributes  ) 
 

sets the attributes for the font

call SetAttributes() to set the attributes of the font to those specified by attributes. SetAttributes() returns true if successful, false if no font exists for the specified attributes (Use EnumFonts to discover valid values for attributes). The CascadeFont will only be valid if the most recent call to SetAttributes has returned true, otherwise the font will represent the default system font (on failure).

Parameters:
attributes the attributes to set
Returns:
true if the font was set with the attributes

bool CascadeFont::TruncateText const CascadeString text,
const CascadeString ellipsis,
const CascadeDims dims,
CascadeString truncatedTextToSet,
TruncationType  truncationType = kTruncateRight
 

truncates a string to fit in specified dimensions

TruncateText() truncates a string if it is longer than the width of the specified dimensions. TruncationType can be specified at the left, center


Friends And Related Function Documentation

friend class CascadeBitmap [friend]
 

true if it successfully truncated the string, false otherwise

Parameters:
truncationType truncate the string at the left, right or center

friend class CascadeScreen [friend]
 


The documentation for this class was generated from the following file:
Generated on Sun Jul 24 14:27:19 2005 for Cascade Library by  doxygen 1.4.1