+// the mask used to extract the pitch from LOGFONT::lfPitchAndFamily field
+static const int PITCH_MASK = FIXED_PITCH | VARIABLE_PITCH;
+
+// ----------------------------------------------------------------------------
+// wxFontRefData - the internal description of the font
+// ----------------------------------------------------------------------------
+
+class WXDLLEXPORT wxFontRefData: public wxGDIRefData
+{
+public:
+ // constructors
+ wxFontRefData()
+ {
+ Init(-1, wxFONTFAMILY_DEFAULT, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL,
+ FALSE, _T(""), wxFONTENCODING_DEFAULT);
+ }
+
+ wxFontRefData(int size,
+ int family,
+ int style,
+ int weight,
+ bool underlined,
+ const wxString& faceName,
+ wxFontEncoding encoding)
+ {
+ Init(size, family, style, weight, underlined, faceName, encoding);
+ }
+
+ wxFontRefData(const wxNativeFontInfo& info, WXHFONT hFont = 0)
+ {
+ Init(info, hFont);
+ }
+
+ wxFontRefData(const wxFontRefData& data)
+ {
+ if ( data.m_nativeFontInfoOk )
+ {
+ Init(data.m_nativeFontInfo);
+ }
+ else
+ {
+ Init(data.m_pointSize, data.m_family, data.m_style, data.m_weight,
+ data.m_underlined, data.m_faceName, data.m_encoding);
+ }
+ }
+
+ virtual ~wxFontRefData();
+
+ // operations
+ bool Alloc(wxFont *font);
+
+ void Free();
+
+ // all wxFont accessors
+ int GetPointSize() const
+ {
+ return m_nativeFontInfoOk ? m_nativeFontInfo.GetPointSize()
+ : m_pointSize;
+ }
+
+ int GetFamily() const
+ {
+ return m_family;
+ }
+
+ int GetStyle() const
+ {
+ return m_nativeFontInfoOk ? m_nativeFontInfo.GetStyle()
+ : m_style;
+ }
+
+ int GetWeight() const
+ {
+ return m_nativeFontInfoOk ? m_nativeFontInfo.GetWeight()
+ : m_weight;
+ }
+
+ bool GetUnderlined() const
+ {
+ return m_nativeFontInfoOk ? m_nativeFontInfo.GetUnderlined()
+ : m_underlined;
+ }
+
+ wxString GetFaceName() const
+ {
+ wxString s;
+ if ( m_nativeFontInfoOk )
+ s = m_nativeFontInfo.GetFaceName();
+ else
+ s = m_faceName;
+
+ return s;
+ }
+
+ wxFontEncoding GetEncoding() const
+ {
+ return m_nativeFontInfoOk ? m_nativeFontInfo.GetEncoding()
+ : m_encoding;
+ }
+
+ WXHFONT GetHFONT() const { return m_hFont; }
+
+ // ... and setters
+ void SetPointSize(int pointSize)
+ {
+ if ( m_nativeFontInfoOk )
+ m_nativeFontInfo.SetPointSize(pointSize);
+ else
+ m_pointSize = pointSize;
+ }
+
+ void SetFamily(int family)
+ {
+ m_family = family;
+ }