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"
33 #include "wx/os2/private.h"
35 #include "wx/fontutil.h"
36 #include "wx/fontmap.h"
38 #include "wx/tokenzr.h"
40 IMPLEMENT_DYNAMIC_CLASS(wxFont
, wxGDIObject
)
42 // ----------------------------------------------------------------------------
43 // wxFontRefData - the internal description of the font
44 // ----------------------------------------------------------------------------
46 class WXDLLEXPORT wxFontRefData
: public wxGDIRefData
51 Init(-1, wxFONTFAMILY_DEFAULT
, wxFONTSTYLE_NORMAL
, wxFONTWEIGHT_NORMAL
, FALSE
,
52 "", wxFONTENCODING_DEFAULT
);
55 wxFontRefData( int nSize
60 ,const wxString
& sFaceName
61 ,wxFontEncoding vEncoding
74 wxFontRefData( const wxNativeFontInfo
& rInfo
85 wxFontRefData(const wxFontRefData
& rData
)
87 Init( rData
.m_nPointSize
95 m_nFontId
= rData
.m_nFontId
;
98 virtual ~wxFontRefData();
103 bool Alloc(wxFont
* pFont
);
107 // All wxFont accessors
109 inline int GetPointSize(void) const
112 // We don't use the actual native font point size since it is
113 // the chosen physical font, which is usually only and approximation
114 // of the desired outline font. The actual displayable point size
115 // is the one stored in the refData
120 inline int GetFamily(void) const
125 inline int GetStyle(void) const
127 return m_bNativeFontInfoOk
? m_vNativeFontInfo
.GetStyle()
131 inline int GetWeight(void) const
133 return m_bNativeFontInfoOk
? m_vNativeFontInfo
.GetWeight()
137 inline bool GetUnderlined(void) const
139 return m_bNativeFontInfoOk
? m_vNativeFontInfo
.GetUnderlined()
143 inline wxString
GetFaceName(void) const
147 if (m_bNativeFontInfoOk
)
148 sFaceName
= m_vNativeFontInfo
.GetFaceName();
150 sFaceName
= m_sFaceName
;
155 inline wxFontEncoding
GetEncoding(void) const
157 return m_bNativeFontInfoOk
? m_vNativeFontInfo
.GetEncoding()
161 inline WXHFONT
GetHFONT(void) const { return m_hFont
; }
162 inline HPS
GetPS(void) const { return m_hPS
; }
163 inline PFONTMETRICS
GetFM(void) const { return m_pFM
; }
164 inline int GetNumFonts(void) const { return m_nNumFonts
; }
167 inline void SetPointSize(int nPointSize
)
169 if (m_bNativeFontInfoOk
)
170 m_vNativeFontInfo
.SetPointSize(nPointSize
);
172 m_nPointSize
= nPointSize
;
175 inline void SetFamily(int nFamily
)
180 inline void SetStyle(int nStyle
)
182 if (m_bNativeFontInfoOk
)
183 m_vNativeFontInfo
.SetStyle((wxFontStyle
)nStyle
);
188 inline void SetWeight(int nWeight
)
190 if (m_bNativeFontInfoOk
)
191 m_vNativeFontInfo
.SetWeight((wxFontWeight
)nWeight
);
196 inline void SetFaceName(const wxString
& sFaceName
)
198 if (m_bNativeFontInfoOk
)
199 m_vNativeFontInfo
.SetFaceName(sFaceName
);
201 m_sFaceName
= sFaceName
;
204 inline void SetUnderlined(bool bUnderlined
)
206 if (m_bNativeFontInfoOk
)
207 m_vNativeFontInfo
.SetUnderlined(bUnderlined
);
209 m_bUnderlined
= bUnderlined
;
212 inline void SetEncoding(wxFontEncoding vEncoding
)
214 if (m_bNativeFontInfoOk
)
215 m_vNativeFontInfo
.SetEncoding(vEncoding
);
217 m_vEncoding
= vEncoding
;
220 inline void SetPS(HPS hPS
)
225 inline void SetFM(PFONTMETRICS pFM
)
230 inline void SetNumFonts(int nNumFonts
)
232 m_nNumFonts
= nNumFonts
;
236 // Native font info tests
238 bool HasNativeFontInfo() const { return m_bNativeFontInfoOk
; }
240 const wxNativeFontInfo
& GetNativeFontInfo() const
241 { return m_vNativeFontInfo
; }
245 // Common part of all ctors
252 ,const wxString
& rsFaceName
253 ,wxFontEncoding vEncoding
256 void Init( const wxNativeFontInfo
& rInfo
261 // If TRUE, the pointer to the actual font is temporary and SHOULD NOT BE
262 // DELETED by destructor
268 // Font characterstics
275 wxString m_sFaceName
;
276 wxFontEncoding m_vEncoding
;
282 wxNativeFontInfo m_vNativeFontInfo
;
283 bool m_bNativeFontInfoOk
;
286 // Some PM specific stuff
288 PFONTMETRICS m_pFM
; // array of FONTMETRICS structs
289 int m_nNumFonts
; // number of fonts in array
290 HPS m_hPS
; // PS handle this font belongs to
291 FATTRS m_vFattrs
; // Current fattrs struct
292 FACENAMEDESC m_vFname
; // Current facename struct
293 bool m_bInternalPS
; // Internally generated PS?
294 }; // end of CLASS wxFontRefData
296 // ============================================================================
298 // ============================================================================
300 // ----------------------------------------------------------------------------
302 // ----------------------------------------------------------------------------
304 void wxFontRefData::Init(
310 , const wxString
& rsFaceName
311 , wxFontEncoding vEncoding
315 m_nPointSize
= nPointSize
;
319 m_bUnderlined
= bUnderlined
;
320 m_sFaceName
= rsFaceName
;
321 m_vEncoding
= vEncoding
;
324 m_bNativeFontInfoOk
= FALSE
;
327 m_bTemporary
= FALSE
;
328 m_pFM
= (PFONTMETRICS
)NULL
;
331 } // end of wxFontRefData::Init
333 void wxFontRefData::Init(
334 const wxNativeFontInfo
& rInfo
335 , WXHFONT hFont
//this is the FontId -- functions as the hFont for OS/2
336 , WXHANDLE hPS
// Presentation Space we are using
340 // hFont may be zero, or it be passed in case we really want to
341 // use the exact font created in the underlying system
342 // (for example where we can't guarantee conversion from HFONT
343 // to LOGFONT back to HFONT)
346 m_nFontId
= (int)hFont
;
348 m_bNativeFontInfoOk
= TRUE
;
349 m_vNativeFontInfo
= rInfo
;
351 if (hPS
== NULLHANDLE
)
353 m_hPS
= ::WinGetPS(HWND_DESKTOP
);
354 m_bInternalPS
= TRUE
;
360 m_bTemporary
= FALSE
;
361 m_pFM
= (PFONTMETRICS
)NULL
;
363 } // end of wxFontRefData::Init
365 wxFontRefData::~wxFontRefData()
370 bool wxFontRefData::Alloc(
378 PFONTMETRICS pFM
= NULL
;
382 if (!m_bNativeFontInfoOk
)
384 wxFillLogFont( &m_vNativeFontInfo
.fa
385 ,&m_vNativeFontInfo
.fn
392 m_bNativeFontInfoOk
= TRUE
;
403 if((lRc
= ::GpiCreateLogFont( m_hPS
406 ,&m_vNativeFontInfo
.fa
409 m_hFont
= (WXHFONT
)flId
;
414 vError
= ::WinGetLastError(vHabmain
);
415 sError
= wxPMErrorToStr(vError
);
416 wxLogLastError("CreateFont");
419 ::GpiSetCharSet(m_hPS
, flId
); // sets font for presentation space
420 ::GpiQueryFontMetrics(m_hPS
, sizeof(FONTMETRICS
), &m_vNativeFontInfo
.fm
);
423 // Set refData members with the results
425 memcpy(&m_vFattrs
, &m_vNativeFontInfo
.fa
, sizeof(m_vFattrs
));
426 memcpy(&m_vFname
, &m_vNativeFontInfo
.fn
, sizeof(m_vFname
));
428 // Going to leave the point size alone. Mostly we use outline fonts
429 // that can be set to any point size inside of Presentation Parameters,
430 // regardless of whether or not the actual font is registered in the system.
431 // The GpiCreateLogFont will do enough by selecting the right family,
434 if (strcmp(m_vNativeFontInfo
.fm
.szFamilyname
, "Times New Roman") == 0)
436 else if (strcmp(m_vNativeFontInfo
.fm
.szFamilyname
, "Times New Roman MT 30") == 0)
438 else if (strcmp(m_vNativeFontInfo
.fm
.szFamilyname
, "@Times New Roman MT 30") == 0)
440 else if (strcmp(m_vNativeFontInfo
.fm
.szFamilyname
, "Tms Rmn") == 0)
442 else if (strcmp(m_vNativeFontInfo
.fm
.szFamilyname
, "WarpSans") == 0)
443 m_nFamily
= wxDECORATIVE
;
444 else if (strcmp(m_vNativeFontInfo
.fm
.szFamilyname
, "Helvetica") == 0)
446 else if (strcmp(m_vNativeFontInfo
.fm
.szFamilyname
, "Helv") == 0)
448 else if (strcmp(m_vNativeFontInfo
.fm
.szFamilyname
, "Script") == 0)
449 m_nFamily
= wxSCRIPT
;
450 else if (strcmp(m_vNativeFontInfo
.fm
.szFamilyname
, "Courier New") == 0)
451 m_nFamily
= wxTELETYPE
;
452 else if (strcmp(m_vNativeFontInfo
.fm
.szFamilyname
, "Courier") == 0)
453 m_nFamily
= wxTELETYPE
;
454 else if (strcmp(m_vNativeFontInfo
.fm
.szFamilyname
, "System Monospaced") == 0)
455 m_nFamily
= wxTELETYPE
;
456 else if (strcmp(m_vNativeFontInfo
.fm
.szFamilyname
, "System VIO") == 0)
457 m_nFamily
= wxMODERN
;
458 else if (strcmp(m_vNativeFontInfo
.fm
.szFamilyname
, "System Proportional") == 0)
459 m_nFamily
= wxMODERN
;
460 else if (strcmp(m_vNativeFontInfo
.fm
.szFamilyname
, "Arial") == 0)
462 else if (strcmp(m_vNativeFontInfo
.fm
.szFamilyname
, "Swiss") == 0)
467 if (m_vNativeFontInfo
.fa
.fsSelection
& FATTR_SEL_ITALIC
)
468 m_nStyle
= wxFONTSTYLE_ITALIC
;
470 m_nStyle
= wxFONTSTYLE_NORMAL
;
471 switch(m_vNativeFontInfo
.fn
.usWeightClass
)
473 case FWEIGHT_DONT_CARE
:
474 m_nWeight
= wxFONTWEIGHT_NORMAL
;
478 m_nWeight
= wxFONTWEIGHT_NORMAL
;
482 m_nWeight
= wxFONTWEIGHT_LIGHT
;
486 m_nWeight
= wxFONTWEIGHT_BOLD
;
489 case FWEIGHT_ULTRA_BOLD
:
490 m_nWeight
= wxFONTWEIGHT_MAX
;
494 m_nWeight
= wxFONTWEIGHT_NORMAL
;
496 m_bUnderlined
= ((m_vNativeFontInfo
.fa
.fsSelection
& FATTR_SEL_UNDERSCORE
) != 0);
497 m_sFaceName
= m_vNativeFontInfo
.fa
.szFacename
;
498 m_vEncoding
= wxGetFontEncFromCharSet(m_vNativeFontInfo
.fa
.usCodePage
);
501 // We don't actuall keep the font around if using a temporary PS
506 ::GpiDeleteSetId( m_hPS
510 ::WinReleasePS(m_hPS
);
514 // Select the font into the Presentation space
516 ::GpiSetCharSet(m_hPS
, flId
); // sets font for presentation space
518 } // end of wxFontRefData::Alloc
520 void wxFontRefData::Free()
524 m_pFM
= (PFONTMETRICS
)NULL
;
528 ::GpiDeleteSetId(m_hPS
, 1L); /* delete the logical font */
533 ::WinReleasePS(m_hPS
);
535 } // end of wxFontRefData::Free
537 // ----------------------------------------------------------------------------
539 // ----------------------------------------------------------------------------
541 void wxNativeFontInfo::Init()
543 memset(&fa
, '\0', sizeof(FATTRS
));
544 } // end of wxNativeFontInfo::Init
546 int wxNativeFontInfo::GetPointSize() const
549 } // end of wxNativeFontInfo::GetPointSize
551 wxFontStyle
wxNativeFontInfo::GetStyle() const
553 return fa
.fsSelection
& FATTR_SEL_ITALIC
? wxFONTSTYLE_ITALIC
: wxFONTSTYLE_NORMAL
;
554 } // end of wxNativeFontInfo::GetStyle
556 wxFontWeight
wxNativeFontInfo::GetWeight() const
558 switch(fn
.usWeightClass
)
560 case FWEIGHT_DONT_CARE
:
561 return wxFONTWEIGHT_NORMAL
;
564 return wxFONTWEIGHT_NORMAL
;
567 return wxFONTWEIGHT_LIGHT
;
570 return wxFONTWEIGHT_BOLD
;
572 case FWEIGHT_ULTRA_BOLD
:
573 return wxFONTWEIGHT_MAX
;
575 return wxFONTWEIGHT_NORMAL
;
576 } // end of wxNativeFontInfo::GetWeight
578 bool wxNativeFontInfo::GetUnderlined() const
580 return ((fa
.fsSelection
& FATTR_SEL_UNDERSCORE
) != 0);
581 } // end of wxNativeFontInfo::GetUnderlined
583 wxString
wxNativeFontInfo::GetFaceName() const
585 return fm
.szFacename
;
586 } // end of wxNativeFontInfo::GetFaceName
588 wxFontFamily
wxNativeFontInfo::GetFamily() const
593 // Extract family from facename
595 if (strcmp(fm
.szFamilyname
, "Times New Roman") == 0)
597 else if (strcmp(fm
.szFamilyname
, "Times New Roman MT 30") == 0)
599 else if (strcmp(fm
.szFamilyname
, "@Times New Roman MT 30") == 0)
601 else if (strcmp(fm
.szFamilyname
, "Tms Rmn") == 0)
603 else if (strcmp(fm
.szFamilyname
, "WarpSans") == 0)
604 nFamily
= wxDECORATIVE
;
605 else if (strcmp(fm
.szFamilyname
, "Helvetica") == 0)
607 else if (strcmp(fm
.szFamilyname
, "Helv") == 0)
609 else if (strcmp(fm
.szFamilyname
, "Script") == 0)
611 else if (strcmp(fm
.szFamilyname
, "Courier New") == 0)
612 nFamily
= wxTELETYPE
;
613 else if (strcmp(fm
.szFamilyname
, "Courier") == 0)
614 nFamily
= wxTELETYPE
;
615 else if (strcmp(fm
.szFamilyname
, "System Monospaced") == 0)
616 nFamily
= wxTELETYPE
;
617 else if (strcmp(fm
.szFamilyname
, "System VIO") == 0)
619 else if (strcmp(fm
.szFamilyname
, "System Proportional") == 0)
621 else if (strcmp(fm
.szFamilyname
, "Arial") == 0)
623 else if (strcmp(fm
.szFamilyname
, "Swiss") == 0)
627 return (wxFontFamily
)nFamily
;
628 } // end of wxNativeFontInfo::GetFamily
630 wxFontEncoding
wxNativeFontInfo::GetEncoding() const
632 return wxGetFontEncFromCharSet(fa
.usCodePage
);
633 } // end of wxNativeFontInfo::GetEncoding
635 void wxNativeFontInfo::SetPointSize(
639 fm
.lEmHeight
= (LONG
)nPointsize
;
640 } // end of wxNativeFontInfo::SetPointSize
642 void wxNativeFontInfo::SetStyle(
649 wxFAIL_MSG( _T("unknown font style") );
652 case wxFONTSTYLE_NORMAL
:
655 case wxFONTSTYLE_ITALIC
:
656 case wxFONTSTYLE_SLANT
:
657 fa
.fsSelection
|= FATTR_SEL_ITALIC
;
660 } // end of wxNativeFontInfo::SetStyle
662 void wxNativeFontInfo::SetWeight(
669 wxFAIL_MSG( _T("unknown font weight") );
672 case wxFONTWEIGHT_NORMAL
:
673 fn
.usWeightClass
= FWEIGHT_NORMAL
;
676 case wxFONTWEIGHT_LIGHT
:
677 fn
.usWeightClass
= FWEIGHT_LIGHT
;
680 case wxFONTWEIGHT_BOLD
:
681 fn
.usWeightClass
= FWEIGHT_BOLD
;
684 } // end of wxNativeFontInfo::SetWeight
686 void wxNativeFontInfo::SetUnderlined(
691 fa
.fsSelection
|= FATTR_SEL_UNDERSCORE
;
692 } // end of wxNativeFontInfo::SetUnderlined
694 void wxNativeFontInfo::SetFaceName(
698 wxStrncpy(fa
.szFacename
, sFacename
, WXSIZEOF(fa
.szFacename
));
699 } // end of wxNativeFontInfo::SetFaceName
701 void wxNativeFontInfo::SetFamily(
710 sFacename
= wxT("Tms Rmn");
714 sFacename
= wxT("WarpSans");
718 sFacename
= wxT("Tms Rmn");
722 sFacename
= wxT("Courier") ;
726 sFacename
= wxT("System VIO") ;
730 sFacename
= wxT("Helv") ;
735 sFacename
= wxT("System VIO") ;
738 if (!wxStrlen(fa
.szFacename
) )
740 SetFaceName(sFacename
);
742 } // end of wxNativeFontInfo::SetFamily
744 void wxNativeFontInfo::SetEncoding(
745 wxFontEncoding eEncoding
748 wxNativeEncodingInfo vInfo
;
750 if ( !wxGetNativeFontEncoding( eEncoding
754 if (wxFontMapper::Get()->GetAltForEncoding( eEncoding
758 if (!vInfo
.facename
.empty())
761 // If we have this encoding only in some particular facename, use
762 // the facename - it is better to show the correct characters in a
763 // wrong facename than unreadable text in a correct one
765 SetFaceName(vInfo
.facename
);
770 // unsupported encoding, replace with the default
774 fa
.usCodePage
= vInfo
.charset
;
775 } // end of wxNativeFontInfo::SetFaceName
777 bool wxNativeFontInfo::FromString(
778 const wxString
& rsStr
783 wxStringTokenizer
vTokenizer(rsStr
, _T(";"));
788 wxString sToken
= vTokenizer
.GetNextToken();
790 if (sToken
!= _T('0'))
793 sToken
= vTokenizer
.GetNextToken();
794 if (!sToken
.ToLong(&lVal
))
798 sToken
= vTokenizer
.GetNextToken();
799 if (!sToken
.ToLong(&lVal
))
801 fa
.lAveCharWidth
= lVal
;
803 sToken
= vTokenizer
.GetNextToken();
804 if (!sToken
.ToLong(&lVal
))
806 fa
.fsSelection
= (USHORT
)lVal
;
808 sToken
= vTokenizer
.GetNextToken();
809 if (!sToken
.ToLong(&lVal
))
811 fa
.fsType
= (USHORT
)lVal
;
813 sToken
= vTokenizer
.GetNextToken();
814 if (!sToken
.ToLong(&lVal
))
816 fa
.fsFontUse
= (USHORT
)lVal
;
818 sToken
= vTokenizer
.GetNextToken();
819 if (!sToken
.ToLong(&lVal
))
821 fa
.idRegistry
= (USHORT
)lVal
;
823 sToken
= vTokenizer
.GetNextToken();
824 if (!sToken
.ToLong(&lVal
))
826 fa
.usCodePage
= (USHORT
)lVal
;
828 sToken
= vTokenizer
.GetNextToken();
829 if (!sToken
.ToLong(&lVal
))
833 sToken
= vTokenizer
.GetNextToken();
834 if (!sToken
.ToLong(&lVal
))
836 fn
.usWeightClass
= (USHORT
)lVal
;
838 sToken
= vTokenizer
.GetNextToken();
841 wxStrcpy(fa
.szFacename
, sToken
.c_str());
843 } // end of wxNativeFontInfo::FromString
845 wxString
wxNativeFontInfo::ToString() const
849 sStr
.Printf(_T("%d;%ld;%ld;%ld;%d;%d;%d;%d;%d;%ld;%d;%s"),
850 0, // version, in case we want to change the format later
863 } // end of wxNativeFontInfo::ToString
865 // ----------------------------------------------------------------------------
867 // ----------------------------------------------------------------------------
871 } // end of wxFont::Init
874 const wxNativeFontInfo
& rInfo
879 m_refData
= new wxFontRefData( rInfo
884 } // end of wxFont::Create
887 const wxString
& rsFontdesc
890 wxNativeFontInfo vInfo
;
892 if (vInfo
.FromString(rsFontdesc
))
894 } // end of wxFont::wxFont
896 // ----------------------------------------------------------------------------
897 // Constructor for a font. Note that the real construction is done
898 // in wxDC::SetFont, when information is available about scaling etc.
899 // ----------------------------------------------------------------------------
906 , const wxString
& rsFaceName
907 , wxFontEncoding vEncoding
913 // wxDEFAULT is a valid value for the font size too so we must treat it
914 // specially here (otherwise the size would be 70 == wxDEFAULT value)
916 if (nPointSize
== wxDEFAULT
)
918 nPointSize
= wxNORMAL_FONT
->GetPointSize();
920 m_refData
= new wxFontRefData( nPointSize
930 } // end of wxFont::Create
934 } // end of wxFont::~wxFont
936 // ----------------------------------------------------------------------------
937 // real implementation
938 // Boris' Kovalenko comments:
939 // Because OS/2 fonts are associated with PS we can not create the font
940 // here, but we may check that font definition is true
941 // ----------------------------------------------------------------------------
943 bool wxFont::RealizeResource()
945 if ( GetResourceHandle() )
949 return M_FONTDATA
->Alloc(this);
950 } // end of wxFont::RealizeResource
952 bool wxFont::FreeResource(
956 if (GetResourceHandle())
962 } // end of wxFont::FreeResource
964 WXHANDLE
wxFont::GetResourceHandle()
967 } // end of wxFont::GetResourceHandle
969 WXHFONT
wxFont::GetHFONT() const
971 return M_FONTDATA
? M_FONTDATA
->GetHFONT() : 0;
972 } // end of wxFont::GetHFONT
974 bool wxFont::IsFree() const
976 return M_FONTDATA
&& (M_FONTDATA
->GetHFONT() == 0);
977 } // end of wxFont::IsFree
979 void wxFont::Unshare()
981 // Don't change shared data
984 m_refData
= new wxFontRefData();
988 wxFontRefData
* ref
= new wxFontRefData(*M_FONTDATA
);
992 } // end of wxFont::Unshare
994 // ----------------------------------------------------------------------------
995 // change font attribute: we recreate font when doing it
996 // ----------------------------------------------------------------------------
998 void wxFont::SetPointSize(
1004 M_FONTDATA
->SetPointSize(nPointSize
);
1007 } // end of wxFont::SetPointSize
1009 void wxFont::SetFamily(
1015 M_FONTDATA
->SetFamily(nFamily
);
1018 } // end of wxFont::SetFamily
1020 void wxFont::SetStyle(
1026 M_FONTDATA
->SetStyle(nStyle
);
1029 } // end of wxFont::SetStyle
1031 void wxFont::SetWeight(
1037 M_FONTDATA
->SetWeight(nWeight
);
1040 } // end of wxFont::SetWeight
1042 void wxFont::SetFaceName(
1043 const wxString
& rsFaceName
1048 M_FONTDATA
->SetFaceName(rsFaceName
);
1051 } // end of wxFont::SetFaceName
1053 void wxFont::SetUnderlined(
1059 M_FONTDATA
->SetUnderlined(bUnderlined
);
1062 } // end of wxFont::SetUnderlined
1064 void wxFont::SetEncoding(
1065 wxFontEncoding vEncoding
1070 M_FONTDATA
->SetEncoding(vEncoding
);
1073 } // end of wxFont::SetEncoding
1075 void wxFont::SetNativeFontInfo(
1076 const wxNativeFontInfo
& rInfo
1083 *M_FONTDATA
= wxFontRefData(rInfo
);
1088 // ----------------------------------------------------------------------------
1090 // ----------------------------------------------------------------------------
1092 int wxFont::GetPointSize() const
1094 wxCHECK_MSG( Ok(), 0, wxT("invalid font") );
1096 return M_FONTDATA
->GetPointSize();
1097 } // end of wxFont::GetPointSize
1099 int wxFont::GetFamily() const
1101 wxCHECK_MSG( Ok(), 0, wxT("invalid font") );
1103 return M_FONTDATA
->GetFamily();
1104 } // end of wxFont::GetFamily
1106 int wxFont::GetStyle() const
1108 wxCHECK_MSG( Ok(), 0, wxT("invalid font") );
1110 return M_FONTDATA
->GetStyle();
1111 } // end of wxFont::GetStyle
1113 int wxFont::GetWeight() const
1115 wxCHECK_MSG( Ok(), 0, wxT("invalid font") );
1117 return M_FONTDATA
->GetWeight();
1120 bool wxFont::GetUnderlined() const
1122 wxCHECK_MSG( Ok(), FALSE
, wxT("invalid font") );
1124 return M_FONTDATA
->GetUnderlined();
1125 } // end of wxFont::GetUnderlined
1127 wxString
wxFont::GetFaceName() const
1129 wxCHECK_MSG( Ok(), wxT(""), wxT("invalid font") );
1131 return M_FONTDATA
->GetFaceName();
1132 } // end of wxFont::GetFaceName
1134 wxFontEncoding
wxFont::GetEncoding() const
1136 wxCHECK_MSG( Ok(), wxFONTENCODING_DEFAULT
, wxT("invalid font") );
1138 return M_FONTDATA
->GetEncoding();
1139 } // end of wxFont::GetEncoding
1141 wxNativeFontInfo
* wxFont::GetNativeFontInfo() const
1143 if (M_FONTDATA
->HasNativeFontInfo())
1144 return new wxNativeFontInfo(M_FONTDATA
->GetNativeFontInfo());
1146 } // end of wxFont::GetNativeFontInfo
1149 // Internal use only method to set the FONTMETRICS array
1156 M_FONTDATA
->SetFM(pFM
);
1157 M_FONTDATA
->SetNumFonts(nNumFonts
);
1158 } // end of wxFont::SetFM
1167 M_FONTDATA
->SetPS(hPS
);
1170 } // end of wxFont::SetPS