CODFontProperties Class

class CODFontProperties: public CODProperty, public public CPropertyContainer< IODPropertyContainer, CODPropertyAccessor< CODFontProperties > >

Font properties determine how the text appears for a component (if it has any text). It contains members that describe the aspects of a given font and has a  CreateFont method for actually creating a font that can be selected into a device context.

This class is both a property and a container for properties. It implements the  IODPropertyContainer interface for getting and setting values that it contains. Each sub-property contained by font property objects has a unique identifier (see  Font Property Identifiers) for getting and setting each value. There are also methods to directly set each property.

Note that Objective Views can only use True Type fonts.

Defined in: OdFontProp.h

Class Members

 CODFontProperties(int nId = OD_PROP_FONT)

Constructor.

 CODFontProperties(const CODFontProperties& propFont)

Copy constructor.

virtual  ~CODFontProperties()

Destructor.

CString m_strFaceName

The name of the font.

int m_nPointSize

The point size of the font.

int m_nHeight

Height of the font in logical units.

COLORREF m_crColor

The font color.

int m_nWeight

The weight of the font (normal, bold, etc.)

BOOL m_bItalic

The italic setting of the font.

BOOL m_bUnderline

The underline setting of the font.

BOOL m_bStrikeout

The strike out setting of the font.

CFont* m_pFont

Cached GDI font.

CString  GetFaceName() const

Gets the face name of the font.

void  SetFaceName(LPCTSTR lpszFaceName)

Sets the face name of the font.

int  GetPointSize() const

Gets the point size of the font.

void  SetPointSize(const int nPointSize, CDC* pDC = NULL)

Sets the point size of the font.

int  GetHeight() const

Gets the height of the font in logical units.

void  SetHeight(const int nHeight, CDC* pDC = NULL)

Sets the height of the font in logical units.

COLORREF  GetColor() const

Gets the color of the font.

void  SetColor(const COLORREF crColor)

Sets the color of the font.

int  GetWeight() const

Gets the weight of the font.

void  SetWeight(const int nWeight)

Sets the weight of the font.

BOOL  GetItalic() const

Gets the italic setting of the font.

void  SetItalic(const BOOL bItalic)

Sets the italic setting of the font.

BOOL  GetUnderline() const

Gets the underline setting for the font.

void  SetUnderline(const BOOL bUnderline)

Sets the underline setting for the font.

BOOL  GetStrikeout() const

Gets the strike out setting for the font.

void  SetStrikeout(const BOOL bStrikeout)

Sets the strike out setting for the font.

virtual BOOL  CompareId(const int nId) const

Compare the property identifier with another identifier.

CODFontProperties&  operator=(const CODFontProperties& propFont)

Sets this set of properties equal to another.

BOOL  operator==(const CODFontProperties propFont) const

Determines if another set of properties is equal to this one.

virtual CFont*  CreateFont(CDC* pDC = NULL) const

Creates a GDI font object. The caller is responsible for freeing this memory!

CFont*  GetFont(CDC* pDC = NULL)

Returns a pointer to the cached GDI font object.

void  ReleaseFont()

Releases the cached font object.

virtual CODProperty*  Dup()

Makes a copy of this properties object.

virtual void  Merge(CODProperty* pProperty, DWORD dwChangeFlags = OD_CHANGE_ALL)

Merges another set of properties with this one.

virtual BOOL  IsEqual(CODProperty* pProp)

Determines if another set of properties is equal to this one.

ULONG STDMETHODCALLTYPE  AddRef()

Add a reference to this object.

ULONG STDMETHODCALLTYPE  Release()

Release a reference to this object.

virtual BOOL  GetValue(const int nPropId, CString& strValue) const

Gets the value of the given string property.

virtual BOOL  GetValue(const int nPropId, int& nValue) const

Gets the value of the given integer property.

virtual BOOL  GetValue(const int nPropId, UINT& nValue) const

Gets the value of the given unsigned integer property.

virtual BOOL  GetValue(const int nPropId, DWORD& dwValue) const

Gets the value of the given DWORD property.

virtual BOOL  GetValue(const int nPropId, float& fValue) const

Gets the value of the given float property.

virtual BOOL  SetValue(const int nPropId, LPCTSTR lpszValue)

Sets the value of the given string property.

virtual BOOL  SetValue(const int nPropId, const int nValue)

Sets the value of the given integer property.

virtual BOOL  SetValue(const int nPropId, const UINT nValue)

Sets the value of the given unsigned integer property.

virtual BOOL  SetValue(const int nPropId, const DWORD dwValue)

Sets the value of the given unsigned DWORD property.

virtual BOOL  SetValue(const int nPropId, const float fValue)

Sets the value of the given float property.

virtual void  Serialize(CArchive& ar)

Serializes the line properties.