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

VIEWS_API CODFontProperties(int nId = OD_PROP_FONT)

Constructor.

VIEWS_API CODFontProperties(const CODFontProperties& propFont)

Copy constructor.

VIEWS_API 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.

VIEWS_API CString GetFaceName() const

Gets the face name of the font.

VIEWS_API void SetFaceName(LPCTSTR lpszFaceName)

Sets the face name of the font.

VIEWS_API int GetPointSize() const

Gets the point size of the font.

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

Sets the point size of the font.

VIEWS_API int GetHeight() const

Gets the height of the font in logical units.

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

Sets the height of the font in logical units.

VIEWS_API COLORREF GetColor() const

Gets the color of the font.

VIEWS_API void SetColor(const COLORREF crColor)

Sets the color of the font.

VIEWS_API int GetWeight() const

Gets the weight of the font.

VIEWS_API void SetWeight(const int nWeight)

Sets the weight of the font.

VIEWS_API BOOL GetItalic() const

Gets the italic setting of the font.

VIEWS_API void SetItalic(const BOOL bItalic)

Sets the italic setting of the font.

VIEWS_API BOOL GetUnderline() const

Gets the underline setting for the font.

VIEWS_API void SetUnderline(const BOOL bUnderline)

Sets the underline setting for the font.

VIEWS_API BOOL GetStrikeout() const

Gets the strike out setting for the font.

VIEWS_API void SetStrikeout(const BOOL bStrikeout)

Sets the strike out setting for the font.

VIEWS_API virtual BOOL CompareId(const int nId) const

Compare the property identifier with another identifier.

VIEWS_API CODFontProperties& operator=(const CODFontProperties& propFont)

Sets this set of properties equal to another.

VIEWS_API BOOL operator==(const CODFontProperties propFont) const

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

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

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

VIEWS_API CFont* GetFont(CDC* pDC = NULL)

Returns a pointer to the cached GDI font object.

VIEWS_API void ReleaseFont()

Releases the cached font object.

VIEWS_API virtual CODProperty* Dup()

Makes a copy of this properties object.

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

Merges another set of properties with this one.

VIEWS_API virtual BOOL IsEqual(CODProperty* pProp)

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

VIEWS_API ULONG STDMETHODCALLTYPE AddRef()

Add a reference to this object.

VIEWS_API ULONG STDMETHODCALLTYPE Release()

Release a reference to this object.

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

Gets the value of the given string property.

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

Gets the value of the given integer property.

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

Gets the value of the given unsigned integer property.

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

Gets the value of the given DWORD property.

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

Gets the value of the given float property.

VIEWS_API virtual BOOL SetValue(const int nPropId, LPCTSTR lpszValue)

Sets the value of the given string property.

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

Sets the value of the given integer property.

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

Sets the value of the given unsigned integer property.

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

Sets the value of the given unsigned DWORD property.

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

Sets the value of the given float property.

VIEWS_API virtual void Serialize(CArchive& ar)

Serializes the line properties.