Main Page | Modules | Namespace List | Class Hierarchy | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

CP_Font Class Reference

A class to manage an OSs native font.

Inheritance diagram for CP_Font:

CP_M_RefCounted List of all members.

Windows font structures

HFONT GetWinFontObject ()
void WrapFont (HFONT inFont)
void WrapLogFont (LOGFONTA *inLogFont)
LOGFONTA GetLogFont ()
void SetUpdateWindow (HWND inHwnd)
static void SetIgnoreSystemSizing (bool b=true)
static SInt16 APIENTRY FindFontProc (LPLOGFONT lpLogFont, LPTEXTMETRIC lpTEXTMETRICs, DWORD fFontType, LPINT lpData)

Public Member Functions

Constructor / Destructor
 CP_Font (CP_Canvas &inOwnerCanvas)
 Constructor.
virtual ~CP_Font () throw ()
 Destructor.
OwnerCanvas
CP_Canvas GetOwnerCanvas ()
Save / Restore
void Save ()
void Restore ()
Getters
SInt16 Height ()
SInt16 AscentHeight ()
CP_String GetName ()
SInt16 GetPointSize ()
SInt16 GetFace ()
Setters
void SetName (const CP_String &inFontName)
void SetSize (const SInt16 inFontSize)
void SetFace (const SInt16 inFontFace)
void SetNameAndSize (const CP_String &inFontName, SInt16 inFontSize)
void SetFromFontSpec (CP_FontSpec &inFontSpec)
void SetCanvas (CP_Canvas &inCanvas)
void UseInCanvas (CP_Canvas &inCanvas)
void ResetCanvas ()
void SetDefault ()
Getters
GdkFont * GetGdkFont ()

Protected Member Functions

Update
void UpdateFont ()

Protected Attributes

CP_Canvas fOwnerCanvas
CP_String fFontName
SInt16 fFontSize
SInt16 fFontFace
SInt16 fSavedFont
SInt16 fSavedSize
SInt16 fSavedMode
SInt16 fSavedFace
SInt16 fFontNumber
SInt16 fSavedFontNumber
SInt16 fSavedFontFace
HFONT fWinFont
HFONT fSavedFont
HWND fUpdateWindow
CP_FontRecordfFontRecord
LOGFONTA fLogFontA
GdkFont * fGDKFont

Static Protected Attributes

static bool gIgnoreSystemSizing = false

Constructor & Destructor Documentation

CP_Font::CP_Font CP_Canvas inOwnerCanvas  ) 
 

Constructor.

Parameters:
inOwnerCanvas The canvas that this font is being used in.
Exceptions:
none 

CP_Font::~CP_Font  )  throw () [virtual]
 

Destructor.

Exceptions:
none 


Member Function Documentation

CP_Canvas CP_Font::GetOwnerCanvas  ) 
 

Returns the CP_Canvas object that this font is being used in.

Exceptions:
none 
Returns:
CP_Canvas The canvas using this font.

void CP_Font::Save  ) 
 

Saves the current font state, and if supported by the OS, the OSs font state.

Exceptions:
none 
Returns:
void

void CP_Font::Restore  ) 
 

Restores the previously saved font state, and if supported by the OS, the OSs font state.

Exceptions:
none 
Returns:
void

CP_UseDepreciated_10_4_APIs

SInt16 CP_Font::Height  ) 
 

Return the height of the font. This will be the distance from the top of the ascent to the bottom of the leaading fields.

Exceptions:
none 
Returns:
SInt16 The height of the font.

SInt16 CP_Font::AscentHeight  ) 
 

Return the ascent height of the font.

Exceptions:
none 
Returns:
SInt16 The height of the font.

CP_String CP_Font::GetName  ) 
 

Return the name of the font as a CP_String.

Exceptions:
none 
Returns:
CP_String The name of the font.

SInt16 CP_Font::GetPointSize  ) 
 

Return the point size of the given font, measured in points.

Exceptions:
none 
Returns:
SInt16 The size of the font.

SInt16 CP_Font::GetFace  ) 
 

Return the face of the font, ie normal, bold, italic, etc..

Exceptions:
none 
Returns:
SInt16 The face of the font.

void CP_Font::SetName const CP_String inFontName  ) 
 

Set the name of the font from the passed in CP_String.

Parameters:
inFontName The name of the font.
Exceptions:
none 
Returns:
void

void CP_Font::SetSize const SInt16  inFontSize  ) 
 

Set the size of the font in points.

Parameters:
inFontSize The size of the font.
Exceptions:
none 
Returns:
void

void CP_Font::SetFace const SInt16  inFontFace  ) 
 

Set the face of this font.

Parameters:
inFontFace The face of the font.
Exceptions:
none 
Returns:
void

void CP_Font::SetNameAndSize const CP_String inFontName,
SInt16  inFontSize
 

Sets the name and point size of this font.

Parameters:
inFontName The name of the font.
inFontSize The size of the font.
Exceptions:
none 
Returns:
void

void CP_Font::SetFromFontSpec CP_FontSpec inFontSpec  ) 
 

Setup the font based on information contained in a CP_FontSpec.

Parameters:
inFontSpec The CP_FontSpec that describes this font.
Exceptions:
none 
Returns:
void

void CP_Font::SetCanvas CP_Canvas inCanvas  ) 
 

Set the CP_Canvas object that this font is being used in.

Parameters:
inCanvas The CP_Canvas to use this font in.
Exceptions:
none 
Returns:
void

void CP_Font::UseInCanvas CP_Canvas inCanvas  ) 
 

Update the associated CP_Canvas object with the font information from this object.

Parameters:
inCanvas The CP_Canvas object to associate this font with.
Exceptions:
none 
Returns:
void

void CP_Font::ResetCanvas  ) 
 

Reset the canvas object associated with this font, currently this is used only on Windows to release the GDI HFONT.

Exceptions:
none 
Returns:
void

void CP_Font::SetDefault  ) 
 

Set the default values for this font. This will be a normal system font.

Exceptions:
none 
Returns:
void

void CP_Font::UpdateFont  )  [protected]
 

Rebuild the font for the canvas, currently used in Windows only to update the GDI HFONT for the canvas.

Exceptions:
NULL exceptions
Returns:
void

HFONT CP_Font::GetWinFontObject  ) 
 

Returns the Windows HFONT for this font.

Exceptions:
none 
Returns:
HFONT The Windows HFONT for this font.

void CP_Font::WrapFont HFONT  inFont  ) 
 

void CP_Font::WrapLogFont LOGFONTA *  inLogFont  ) 
 

LOGFONTA CP_Font::GetLogFont  ) 
 

Returns the Windows LOGFONT structure for this font.

Exceptions:
none 
Returns:
LOGFONT The Windows LOGFONT for this font.

void CP_Font::SetUpdateWindow HWND  inHwnd  ) 
 

Sets a flag indicating that the Windows HWND using this font needs to be updated.

Parameters:
inHwnd The window needing to be updated.
Exceptions:
none 
Returns:
void

static void CP_Font::SetIgnoreSystemSizing bool  b = true  )  [static]
 

Sets a flag to indicate that system sizing is to be ignored.

Parameters:
b State of the ignore system sizing flag.
Exceptions:
none 
Returns:
void

SInt16 APIENTRY CP_Font::FindFontProc LPLOGFONT  lpLogFont,
LPTEXTMETRIC  lpTEXTMETRICs,
DWORD  fFontType,
LPINT  lpData
[static, private]
 

Return a LOGFONT structure for the font.

Parameters:
lpLogFont Windows LPLOGFONT structure with info about the font.
lpTEXTMETRICs Not used.
fontType Not used.
lpData Points to a LOGFONT.
Exceptions:
none 
Returns:
void

GdkFont * CP_Font::GetGdkFont  ) 
 

Return a GdkFont object used by this object under Linux Gdk.

Exceptions:
none 
Returns:
GdkFont * The Linux Gdk font object.

UInt32 CP_M_RefCounted::AddReference  )  const [inherited]
 

Add a reference to our object, returning the new reference count.

Exceptions:
none 
Returns:
UInt32 const Returns the new reference count.

UInt32 CP_M_RefCounted::RemoveReference  )  const [inherited]
 

Remove a reference to our object, returning the new reference count. If the count is 0, then this object is also deleted, and 0 is returned.

Exceptions:
none 
Returns:
UInt32 const Returns the new reference count.

void CP_M_RefCounted::Autorelease  )  const [inherited]
 

Add the object to the topmost auto-release pool. This will ensure that the object is eventually released.

See also:
CP_AutoReleasePool
Exceptions:
none 
Returns:
void

UInt32 CP_M_RefCounted::GetRefCount  )  const [inherited]
 

Returns the current ref count.

Exceptions:
none 
Returns:
UInt32 The current referencce count.


Member Data Documentation

CP_Canvas CP_Font::fOwnerCanvas [protected]
 

CP_String CP_Font::fFontName [protected]
 

CP_Canvas font is used in.

SInt16 CP_Font::fFontSize [protected]
 

Name of the font.

SInt16 CP_Font::fFontFace [protected]
 

Size of the font, measured in points.

SInt16 CP_Font::fSavedFont [protected]
 

Face for the font, normal, bold, italic, underline, etc.

SInt16 CP_Font::fSavedSize [protected]
 

Saved font from the canvas. Used in Save/Restore to temporarily hold font info.

SInt16 CP_Font::fSavedMode [protected]
 

Saved font size from the canvas. Used in Save/Restore to temporarily hold font info.

SInt16 CP_Font::fSavedFace [protected]
 

Saved font drawing mode from the canvas. Used in Save/Restore to temporarily hold font info.

SInt16 CP_Font::fFontNumber [protected]
 

Saved font face from the canvas. Used in Save/Restore to temporarily hold font info.

SInt16 CP_Font::fSavedFontNumber [protected]
 

MacOS font number for this font.

SInt16 CP_Font::fSavedFontFace [protected]
 

MacOS font number for this font saved version.

HFONT CP_Font::fWinFont [protected]
 

MacOS face for this font saved version.

HFONT CP_Font::fSavedFont [protected]
 

Windows HFONT info about the font.

HWND CP_Font::fUpdateWindow [protected]
 

Windows HFONT info used to hold a saved font.

CP_FontRecord* CP_Font::fFontRecord [protected]
 

Window for the font.

CPLAT_Begin_Namespace_CPLAT bool CP_Font::gIgnoreSystemSizing = false [static, protected]
 

Structure to main a link between HFONTS and CP_Fonts.

LOGFONTA CP_Font::fLogFontA [protected]
 

Flag to indicate how system font sizing is handled.

GdkFont* CP_Font::fGDKFont [protected]
 

Windows LOGFONT structure.


The documentation for this class was generated from the following files:
Generated on Sat Sep 17 20:01:42 2005 for CPLAT by  doxygen 1.4.0