1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: wxFont class
4 // Author: David Webster
8 // Copyright: (c) David Webster
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
12 // ============================================================================
14 // ============================================================================
16 // ----------------------------------------------------------------------------
18 // ----------------------------------------------------------------------------
21 // For compilers that support precompilation, includes "wx.h".
22 #include "wx/wxprec.h"
34 #include "wx/os2/private.h"
36 #include "wx/fontutil.h"
37 #include "wx/fontmap.h"
39 #include "wx/tokenzr.h"
41 IMPLEMENT_DYNAMIC_CLASS(wxFont
, wxGDIObject
)
43 // ----------------------------------------------------------------------------
44 // wxFontRefData - the internal description of the font
45 // ----------------------------------------------------------------------------
47 class WXDLLEXPORT wxFontRefData
: public wxGDIRefData
52 Init(-1, wxFONTFAMILY_DEFAULT
, wxFONTSTYLE_NORMAL
, wxFONTWEIGHT_NORMAL
, FALSE
,
53 "", wxFONTENCODING_DEFAULT
);
56 wxFontRefData( int nSize
61 ,const wxString
& sFaceName
62 ,wxFontEncoding vEncoding
75 wxFontRefData( const wxNativeFontInfo
& rInfo
86 wxFontRefData(const wxFontRefData
& rData
)
88 Init( rData
.m_nPointSize
96 m_nFontId
= rData
.m_nFontId
;
99 virtual ~wxFontRefData();
104 bool Alloc(wxFont
* pFont
);
108 // All wxFont accessors
110 inline int GetPointSize(void) const
113 // We don't use the actual native font point size since it is
114 // the chosen physical font, which is usually only and approximation
115 // of the desired outline font. The actual displayable point size
116 // is the one stored in the refData
121 inline int GetFamily(void) const
126 inline int GetStyle(void) const
128 return m_bNativeFontInfoOk
? m_vNativeFontInfo
.GetStyle()
132 inline int GetWeight(void) const
134 return m_bNativeFontInfoOk
? m_vNativeFontInfo
.GetWeight()
138 inline bool GetUnderlined(void) const
140 return m_bNativeFontInfoOk
? m_vNativeFontInfo
.GetUnderlined()
144 inline wxString
GetFaceName(void) const
148 if (m_bNativeFontInfoOk
)
149 sFaceName
= m_vNativeFontInfo
.GetFaceName();
151 sFaceName
= m_sFaceName
;
156 inline wxFontEncoding
GetEncoding(void) const
158 return m_bNativeFontInfoOk
? m_vNativeFontInfo
.GetEncoding()
162 inline WXHFONT
GetHFONT(void) const { return m_hFont
; }
163 inline HPS
GetPS(void) const { return m_hPS
; }
164 inline PFONTMETRICS
GetFM(void) const { return m_pFM
; }
165 inline int GetNumFonts(void) const { return m_nNumFonts
; }
168 inline void SetPointSize(int nPointSize
)
170 if (m_bNativeFontInfoOk
)
171 m_vNativeFontInfo
.SetPointSize(nPointSize
);
173 m_nPointSize
= nPointSize
;
176 inline void SetFamily(int nFamily
)
181 inline void SetStyle(int nStyle
)
183 if (m_bNativeFontInfoOk
)
184 m_vNativeFontInfo
.SetStyle((wxFontStyle
)nStyle
);
189 inline void SetWeight(int nWeight
)
191 if (m_bNativeFontInfoOk
)
192 m_vNativeFontInfo
.SetWeight((wxFontWeight
)nWeight
);
197 inline void SetFaceName(const wxString
& sFaceName
)
199 if (m_bNativeFontInfoOk
)
200 m_vNativeFontInfo
.SetFaceName(sFaceName
);
202 m_sFaceName
= sFaceName
;
205 inline void SetUnderlined(bool bUnderlined
)
207 if (m_bNativeFontInfoOk
)
208 m_vNativeFontInfo
.SetUnderlined(bUnderlined
);
210 m_bUnderlined
= bUnderlined
;
213 inline void SetEncoding(wxFontEncoding vEncoding
)
215 if (m_bNativeFontInfoOk
)
216 m_vNativeFontInfo
.SetEncoding(vEncoding
);
218 m_vEncoding
= vEncoding
;
221 inline void SetPS(HPS hPS
)
226 inline void SetFM(PFONTMETRICS pFM
)
231 inline void SetNumFonts(int nNumFonts
)
233 m_nNumFonts
= nNumFonts
;
237 // Native font info tests
239 bool HasNativeFontInfo() const { return m_bNativeFontInfoOk
; }
241 const wxNativeFontInfo
& GetNativeFontInfo() const
242 { return m_vNativeFontInfo
; }
246 // Common part of all ctors
253 ,const wxString
& rsFaceName
254 ,wxFontEncoding vEncoding
257 void Init( const wxNativeFontInfo
& rInfo
262 // If TRUE, the pointer to the actual font is temporary and SHOULD NOT BE
263 // DELETED by destructor
269 // Font characterstics
276 wxString m_sFaceName
;
277 wxFontEncoding m_vEncoding
;
283 wxNativeFontInfo m_vNativeFontInfo
;
284 bool m_bNativeFontInfoOk
;
287 // Some PM specific stuff
289 PFONTMETRICS m_pFM
; // array of FONTMETRICS structs
290 int m_nNumFonts
; // number of fonts in array
291 HPS m_hPS
; // PS handle this font belongs to
292 FATTRS m_vFattrs
; // Current fattrs struct
293 FACENAMEDESC m_vFname
; // Current facename struct
294 bool m_bInternalPS
; // Internally generated PS?
295 }; // end of CLASS wxFontRefData
297 // ============================================================================
299 // ============================================================================
301 // ----------------------------------------------------------------------------
303 // ----------------------------------------------------------------------------
305 void wxFontRefData::Init(
311 , const wxString
& rsFaceName
312 , wxFontEncoding vEncoding
316 m_nPointSize
= nPointSize
;
320 m_bUnderlined
= bUnderlined
;
321 m_sFaceName
= rsFaceName
;
322 m_vEncoding
= vEncoding
;
325 m_bNativeFontInfoOk
= FALSE
;
328 m_bTemporary
= FALSE
;
329 m_pFM
= (PFONTMETRICS
)NULL
;
332 } // end of wxFontRefData::Init
334 void wxFontRefData::Init(
335 const wxNativeFontInfo
& rInfo
336 , WXHFONT hFont
//this is the FontId -- functions as the hFont for OS/2
337 , WXHANDLE hPS
// Presentation Space we are using
341 // hFont may be zero, or it be passed in case we really want to
342 // use the exact font created in the underlying system
343 // (for example where we can't guarantee conversion from HFONT
344 // to LOGFONT back to HFONT)
347 m_nFontId
= (int)hFont
;
349 m_bNativeFontInfoOk
= TRUE
;
350 m_vNativeFontInfo
= rInfo
;
352 if (hPS
== NULLHANDLE
)
354 m_hPS
= ::WinGetPS(HWND_DESKTOP
);
355 m_bInternalPS
= TRUE
;
361 m_bTemporary
= FALSE
;
362 m_pFM
= (PFONTMETRICS
)NULL
;
364 } // end of wxFontRefData::Init
366 wxFontRefData::~wxFontRefData()
371 bool wxFontRefData::Alloc(
379 PFONTMETRICS pFM
= NULL
;
383 if (!m_bNativeFontInfoOk
)
385 wxFillLogFont( &m_vNativeFontInfo
.fa
386 ,&m_vNativeFontInfo
.fn
393 m_bNativeFontInfoOk
= TRUE
;
404 if((lRc
= ::GpiCreateLogFont( m_hPS
407 ,&m_vNativeFontInfo
.fa
410 m_hFont
= (WXHFONT
)flId
;
415 vError
= ::WinGetLastError(vHabmain
);
416 sError
= wxPMErrorToStr(vError
);
417 wxLogLastError("CreateFont");
420 ::GpiSetCharSet(m_hPS
, flId
); // sets font for presentation space
421 ::GpiQueryFontMetrics(m_hPS
, sizeof(FONTMETRICS
), &m_vNativeFontInfo
.fm
);
424 // Set refData members with the results
426 memcpy(&m_vFattrs
, &m_vNativeFontInfo
.fa
, sizeof(m_vFattrs
));
427 memcpy(&m_vFname
, &m_vNativeFontInfo
.fn
, sizeof(m_vFname
));
429 // Going to leave the point size alone. Mostly we use outline fonts
430 // that can be set to any point size inside of Presentation Parameters,
431 // regardless of whether or not the actual font is registered in the system.
432 // The GpiCreateLogFont will do enough by selecting the right family,
435 if (strcmp(m_vNativeFontInfo
.fm
.szFamilyname
, "Times New Roman") == 0)
437 else if (strcmp(m_vNativeFontInfo
.fm
.szFamilyname
, "Times New Roman MT 30") == 0)
439 else if (strcmp(m_vNativeFontInfo
.fm
.szFamilyname
, "@Times New Roman MT 30") == 0)
441 else if (strcmp(m_vNativeFontInfo
.fm
.szFamilyname
, "Tms Rmn") == 0)
443 else if (strcmp(m_vNativeFontInfo
.fm
.szFamilyname
, "WarpSans") == 0)
444 m_nFamily
= wxDECORATIVE
;
445 else if (strcmp(m_vNativeFontInfo
.fm
.szFamilyname
, "Helvetica") == 0)
447 else if (strcmp(m_vNativeFontInfo
.fm
.szFamilyname
, "Helv") == 0)
449 else if (strcmp(m_vNativeFontInfo
.fm
.szFamilyname
, "Script") == 0)
450 m_nFamily
= wxSCRIPT
;
451 else if (strcmp(m_vNativeFontInfo
.fm
.szFamilyname
, "Courier New") == 0)
452 m_nFamily
= wxTELETYPE
;
453 else if (strcmp(m_vNativeFontInfo
.fm
.szFamilyname
, "Courier") == 0)
454 m_nFamily
= wxTELETYPE
;
455 else if (strcmp(m_vNativeFontInfo
.fm
.szFamilyname
, "System Monospaced") == 0)
456 m_nFamily
= wxTELETYPE
;
457 else if (strcmp(m_vNativeFontInfo
.fm
.szFamilyname
, "System VIO") == 0)
458 m_nFamily
= wxMODERN
;
459 else if (strcmp(m_vNativeFontInfo
.fm
.szFamilyname
, "System Proportional") == 0)
460 m_nFamily
= wxMODERN
;
461 else if (strcmp(m_vNativeFontInfo
.fm
.szFamilyname
, "Arial") == 0)
463 else if (strcmp(m_vNativeFontInfo
.fm
.szFamilyname
, "Swiss") == 0)
468 if (m_vNativeFontInfo
.fa
.fsSelection
& FATTR_SEL_ITALIC
)
469 m_nStyle
= wxFONTSTYLE_ITALIC
;
471 m_nStyle
= wxFONTSTYLE_NORMAL
;
472 switch(m_vNativeFontInfo
.fn
.usWeightClass
)
474 case FWEIGHT_DONT_CARE
:
475 m_nWeight
= wxFONTWEIGHT_NORMAL
;
479 m_nWeight
= wxFONTWEIGHT_NORMAL
;
483 m_nWeight
= wxFONTWEIGHT_LIGHT
;
487 m_nWeight
= wxFONTWEIGHT_BOLD
;
490 case FWEIGHT_ULTRA_BOLD
:
491 m_nWeight
= wxFONTWEIGHT_MAX
;
495 m_nWeight
= wxFONTWEIGHT_NORMAL
;
497 m_bUnderlined
= ((m_vNativeFontInfo
.fa
.fsSelection
& FATTR_SEL_UNDERSCORE
) != 0);
498 m_sFaceName
= m_vNativeFontInfo
.fa
.szFacename
;
499 m_vEncoding
= wxGetFontEncFromCharSet(m_vNativeFontInfo
.fa
.usCodePage
);
502 // We don't actuall keep the font around if using a temporary PS
507 ::GpiDeleteSetId( m_hPS
511 ::WinReleasePS(m_hPS
);
515 // Select the font into the Presentation space
517 ::GpiSetCharSet(m_hPS
, flId
); // sets font for presentation space
519 } // end of wxFontRefData::Alloc
521 void wxFontRefData::Free()
525 m_pFM
= (PFONTMETRICS
)NULL
;
529 ::GpiDeleteSetId(m_hPS
, 1L); /* delete the logical font */
534 ::WinReleasePS(m_hPS
);
536 } // end of wxFontRefData::Free
538 // ----------------------------------------------------------------------------
540 // ----------------------------------------------------------------------------
542 void wxNativeFontInfo::Init()
544 memset(&fa
, '\0', sizeof(FATTRS
));
545 } // end of wxNativeFontInfo::Init
547 int wxNativeFontInfo::GetPointSize() const
550 } // end of wxNativeFontInfo::GetPointSize
552 wxFontStyle
wxNativeFontInfo::GetStyle() const
554 return fa
.fsSelection
& FATTR_SEL_ITALIC
? wxFONTSTYLE_ITALIC
: wxFONTSTYLE_NORMAL
;
555 } // end of wxNativeFontInfo::GetStyle
557 wxFontWeight
wxNativeFontInfo::GetWeight() const
559 switch(fn
.usWeightClass
)
561 case FWEIGHT_DONT_CARE
:
562 return wxFONTWEIGHT_NORMAL
;
565 return wxFONTWEIGHT_NORMAL
;
568 return wxFONTWEIGHT_LIGHT
;
571 return wxFONTWEIGHT_BOLD
;
573 case FWEIGHT_ULTRA_BOLD
:
574 return wxFONTWEIGHT_MAX
;
576 return wxFONTWEIGHT_NORMAL
;
577 } // end of wxNativeFontInfo::GetWeight
579 bool wxNativeFontInfo::GetUnderlined() const
581 return ((fa
.fsSelection
& FATTR_SEL_UNDERSCORE
) != 0);
582 } // end of wxNativeFontInfo::GetUnderlined
584 wxString
wxNativeFontInfo::GetFaceName() const
586 return fm
.szFacename
;
587 } // end of wxNativeFontInfo::GetFaceName
589 wxFontFamily
wxNativeFontInfo::GetFamily() const
594 // Extract family from facename
596 if (strcmp(fm
.szFamilyname
, "Times New Roman") == 0)
598 else if (strcmp(fm
.szFamilyname
, "Times New Roman MT 30") == 0)
600 else if (strcmp(fm
.szFamilyname
, "@Times New Roman MT 30") == 0)
602 else if (strcmp(fm
.szFamilyname
, "Tms Rmn") == 0)
604 else if (strcmp(fm
.szFamilyname
, "WarpSans") == 0)
605 nFamily
= wxDECORATIVE
;
606 else if (strcmp(fm
.szFamilyname
, "Helvetica") == 0)
608 else if (strcmp(fm
.szFamilyname
, "Helv") == 0)
610 else if (strcmp(fm
.szFamilyname
, "Script") == 0)
612 else if (strcmp(fm
.szFamilyname
, "Courier New") == 0)
613 nFamily
= wxTELETYPE
;
614 else if (strcmp(fm
.szFamilyname
, "Courier") == 0)
615 nFamily
= wxTELETYPE
;
616 else if (strcmp(fm
.szFamilyname
, "System Monospaced") == 0)
617 nFamily
= wxTELETYPE
;
618 else if (strcmp(fm
.szFamilyname
, "System VIO") == 0)
620 else if (strcmp(fm
.szFamilyname
, "System Proportional") == 0)
622 else if (strcmp(fm
.szFamilyname
, "Arial") == 0)
624 else if (strcmp(fm
.szFamilyname
, "Swiss") == 0)
628 return (wxFontFamily
)nFamily
;
629 } // end of wxNativeFontInfo::GetFamily
631 wxFontEncoding
wxNativeFontInfo::GetEncoding() const
633 return wxGetFontEncFromCharSet(fa
.usCodePage
);
634 } // end of wxNativeFontInfo::GetEncoding
636 void wxNativeFontInfo::SetPointSize(
640 fm
.lEmHeight
= (LONG
)nPointsize
;
641 } // end of wxNativeFontInfo::SetPointSize
643 void wxNativeFontInfo::SetStyle(
650 wxFAIL_MSG( _T("unknown font style") );
653 case wxFONTSTYLE_NORMAL
:
656 case wxFONTSTYLE_ITALIC
:
657 case wxFONTSTYLE_SLANT
:
658 fa
.fsSelection
|= FATTR_SEL_ITALIC
;
661 } // end of wxNativeFontInfo::SetStyle
663 void wxNativeFontInfo::SetWeight(
670 wxFAIL_MSG( _T("unknown font weight") );
673 case wxFONTWEIGHT_NORMAL
:
674 fn
.usWeightClass
= FWEIGHT_NORMAL
;
677 case wxFONTWEIGHT_LIGHT
:
678 fn
.usWeightClass
= FWEIGHT_LIGHT
;
681 case wxFONTWEIGHT_BOLD
:
682 fn
.usWeightClass
= FWEIGHT_BOLD
;
685 } // end of wxNativeFontInfo::SetWeight
687 void wxNativeFontInfo::SetUnderlined(
692 fa
.fsSelection
|= FATTR_SEL_UNDERSCORE
;
693 } // end of wxNativeFontInfo::SetUnderlined
695 void wxNativeFontInfo::SetFaceName(
699 wxStrncpy(fa
.szFacename
, sFacename
, WXSIZEOF(fa
.szFacename
));
700 } // end of wxNativeFontInfo::SetFaceName
702 void wxNativeFontInfo::SetFamily(
711 sFacename
= wxT("Tms Rmn");
715 sFacename
= wxT("WarpSans");
719 sFacename
= wxT("Tms Rmn");
723 sFacename
= wxT("Courier") ;
727 sFacename
= wxT("System VIO") ;
731 sFacename
= wxT("Helv") ;
736 sFacename
= wxT("System VIO") ;
739 if (!wxStrlen(fa
.szFacename
) )
741 SetFaceName(sFacename
);
743 } // end of wxNativeFontInfo::SetFamily
745 void wxNativeFontInfo::SetEncoding(
746 wxFontEncoding eEncoding
749 wxNativeEncodingInfo vInfo
;
751 if ( !wxGetNativeFontEncoding( eEncoding
755 if (wxFontMapper::Get()->GetAltForEncoding( eEncoding
759 if (!vInfo
.facename
.empty())
762 // If we have this encoding only in some particular facename, use
763 // the facename - it is better to show the correct characters in a
764 // wrong facename than unreadable text in a correct one
766 SetFaceName(vInfo
.facename
);
771 // unsupported encoding, replace with the default
775 fa
.usCodePage
= vInfo
.charset
;
776 } // end of wxNativeFontInfo::SetFaceName
778 bool wxNativeFontInfo::FromString(
779 const wxString
& rsStr
784 wxStringTokenizer
vTokenizer(rsStr
, _T(";"));
789 wxString sToken
= vTokenizer
.GetNextToken();
791 if (sToken
!= _T('0'))
794 sToken
= vTokenizer
.GetNextToken();
795 if (!sToken
.ToLong(&lVal
))
799 sToken
= vTokenizer
.GetNextToken();
800 if (!sToken
.ToLong(&lVal
))
802 fa
.lAveCharWidth
= lVal
;
804 sToken
= vTokenizer
.GetNextToken();
805 if (!sToken
.ToLong(&lVal
))
807 fa
.fsSelection
= (USHORT
)lVal
;
809 sToken
= vTokenizer
.GetNextToken();
810 if (!sToken
.ToLong(&lVal
))
812 fa
.fsType
= (USHORT
)lVal
;
814 sToken
= vTokenizer
.GetNextToken();
815 if (!sToken
.ToLong(&lVal
))
817 fa
.fsFontUse
= (USHORT
)lVal
;
819 sToken
= vTokenizer
.GetNextToken();
820 if (!sToken
.ToLong(&lVal
))
822 fa
.idRegistry
= (USHORT
)lVal
;
824 sToken
= vTokenizer
.GetNextToken();
825 if (!sToken
.ToLong(&lVal
))
827 fa
.usCodePage
= (USHORT
)lVal
;
829 sToken
= vTokenizer
.GetNextToken();
830 if (!sToken
.ToLong(&lVal
))
834 sToken
= vTokenizer
.GetNextToken();
835 if (!sToken
.ToLong(&lVal
))
837 fn
.usWeightClass
= (USHORT
)lVal
;
839 sToken
= vTokenizer
.GetNextToken();
842 wxStrcpy(fa
.szFacename
, sToken
.c_str());
844 } // end of wxNativeFontInfo::FromString
846 wxString
wxNativeFontInfo::ToString() const
850 sStr
.Printf(_T("%d;%ld;%ld;%ld;%d;%d;%d;%d;%d;%ld;%d;%s"),
851 0, // version, in case we want to change the format later
864 } // end of wxNativeFontInfo::ToString
866 // ----------------------------------------------------------------------------
868 // ----------------------------------------------------------------------------
872 } // end of wxFont::Init
875 const wxNativeFontInfo
& rInfo
880 m_refData
= new wxFontRefData( rInfo
885 } // end of wxFont::Create
888 const wxString
& rsFontdesc
891 wxNativeFontInfo vInfo
;
893 if (vInfo
.FromString(rsFontdesc
))
895 } // end of wxFont::wxFont
897 // ----------------------------------------------------------------------------
898 // Constructor for a font. Note that the real construction is done
899 // in wxDC::SetFont, when information is available about scaling etc.
900 // ----------------------------------------------------------------------------
907 , const wxString
& rsFaceName
908 , wxFontEncoding vEncoding
914 // wxDEFAULT is a valid value for the font size too so we must treat it
915 // specially here (otherwise the size would be 70 == wxDEFAULT value)
917 if (nPointSize
== wxDEFAULT
)
919 nPointSize
= wxNORMAL_FONT
->GetPointSize();
921 m_refData
= new wxFontRefData( nPointSize
931 } // end of wxFont::Create
935 } // end of wxFont::~wxFont
937 // ----------------------------------------------------------------------------
938 // real implementation
939 // Boris' Kovalenko comments:
940 // Because OS/2 fonts are associated with PS we can not create the font
941 // here, but we may check that font definition is true
942 // ----------------------------------------------------------------------------
944 bool wxFont::RealizeResource()
946 if ( GetResourceHandle() )
950 return M_FONTDATA
->Alloc(this);
951 } // end of wxFont::RealizeResource
953 bool wxFont::FreeResource(
957 if (GetResourceHandle())
963 } // end of wxFont::FreeResource
965 WXHANDLE
wxFont::GetResourceHandle()
968 } // end of wxFont::GetResourceHandle
970 WXHFONT
wxFont::GetHFONT() const
972 return M_FONTDATA
? M_FONTDATA
->GetHFONT() : 0;
973 } // end of wxFont::GetHFONT
975 bool wxFont::IsFree() const
977 return M_FONTDATA
&& (M_FONTDATA
->GetHFONT() == 0);
978 } // end of wxFont::IsFree
980 void wxFont::Unshare()
982 // Don't change shared data
985 m_refData
= new wxFontRefData();
989 wxFontRefData
* ref
= new wxFontRefData(*M_FONTDATA
);
993 } // end of wxFont::Unshare
995 // ----------------------------------------------------------------------------
996 // change font attribute: we recreate font when doing it
997 // ----------------------------------------------------------------------------
999 void wxFont::SetPointSize(
1005 M_FONTDATA
->SetPointSize(nPointSize
);
1008 } // end of wxFont::SetPointSize
1010 void wxFont::SetFamily(
1016 M_FONTDATA
->SetFamily(nFamily
);
1019 } // end of wxFont::SetFamily
1021 void wxFont::SetStyle(
1027 M_FONTDATA
->SetStyle(nStyle
);
1030 } // end of wxFont::SetStyle
1032 void wxFont::SetWeight(
1038 M_FONTDATA
->SetWeight(nWeight
);
1041 } // end of wxFont::SetWeight
1043 void wxFont::SetFaceName(
1044 const wxString
& rsFaceName
1049 M_FONTDATA
->SetFaceName(rsFaceName
);
1052 } // end of wxFont::SetFaceName
1054 void wxFont::SetUnderlined(
1060 M_FONTDATA
->SetUnderlined(bUnderlined
);
1063 } // end of wxFont::SetUnderlined
1065 void wxFont::SetEncoding(
1066 wxFontEncoding vEncoding
1071 M_FONTDATA
->SetEncoding(vEncoding
);
1074 } // end of wxFont::SetEncoding
1076 void wxFont::SetNativeFontInfo(
1077 const wxNativeFontInfo
& rInfo
1084 *M_FONTDATA
= wxFontRefData(rInfo
);
1089 // ----------------------------------------------------------------------------
1091 // ----------------------------------------------------------------------------
1093 int wxFont::GetPointSize() const
1095 wxCHECK_MSG( Ok(), 0, wxT("invalid font") );
1097 return M_FONTDATA
->GetPointSize();
1098 } // end of wxFont::GetPointSize
1100 int wxFont::GetFamily() const
1102 wxCHECK_MSG( Ok(), 0, wxT("invalid font") );
1104 return M_FONTDATA
->GetFamily();
1105 } // end of wxFont::GetFamily
1107 int wxFont::GetStyle() const
1109 wxCHECK_MSG( Ok(), 0, wxT("invalid font") );
1111 return M_FONTDATA
->GetStyle();
1112 } // end of wxFont::GetStyle
1114 int wxFont::GetWeight() const
1116 wxCHECK_MSG( Ok(), 0, wxT("invalid font") );
1118 return M_FONTDATA
->GetWeight();
1121 bool wxFont::GetUnderlined() const
1123 wxCHECK_MSG( Ok(), FALSE
, wxT("invalid font") );
1125 return M_FONTDATA
->GetUnderlined();
1126 } // end of wxFont::GetUnderlined
1128 wxString
wxFont::GetFaceName() const
1130 wxCHECK_MSG( Ok(), wxT(""), wxT("invalid font") );
1132 return M_FONTDATA
->GetFaceName();
1133 } // end of wxFont::GetFaceName
1135 wxFontEncoding
wxFont::GetEncoding() const
1137 wxCHECK_MSG( Ok(), wxFONTENCODING_DEFAULT
, wxT("invalid font") );
1139 return M_FONTDATA
->GetEncoding();
1140 } // end of wxFont::GetEncoding
1142 wxNativeFontInfo
* wxFont::GetNativeFontInfo() const
1144 if (M_FONTDATA
->HasNativeFontInfo())
1145 return new wxNativeFontInfo(M_FONTDATA
->GetNativeFontInfo());
1147 } // end of wxFont::GetNativeFontInfo
1150 // Internal use only method to set the FONTMETRICS array
1157 M_FONTDATA
->SetFM(pFM
);
1158 M_FONTDATA
->SetNumFonts(nNumFonts
);
1159 } // end of wxFont::SetFM
1168 M_FONTDATA
->SetPS(hPS
);
1171 } // end of wxFont::SetPS