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"
38 #include "wx/encinfo.h"
40 #include "wx/tokenzr.h"
42 IMPLEMENT_DYNAMIC_CLASS(wxFont
, wxGDIObject
)
44 // ----------------------------------------------------------------------------
45 // wxFontRefData - the internal description of the font
46 // ----------------------------------------------------------------------------
48 class WXDLLEXPORT wxFontRefData
: public wxGDIRefData
53 Init(-1, wxFONTFAMILY_DEFAULT
, wxFONTSTYLE_NORMAL
, wxFONTWEIGHT_NORMAL
, FALSE
,
54 "", wxFONTENCODING_DEFAULT
);
57 wxFontRefData( int nSize
62 ,const wxString
& sFaceName
63 ,wxFontEncoding vEncoding
76 wxFontRefData( const wxNativeFontInfo
& rInfo
87 wxFontRefData(const wxFontRefData
& rData
)
89 Init( rData
.m_nPointSize
97 m_nFontId
= rData
.m_nFontId
;
100 virtual ~wxFontRefData();
105 bool Alloc(wxFont
* pFont
);
109 // All wxFont accessors
111 inline int GetPointSize(void) const
114 // We don't use the actual native font point size since it is
115 // the chosen physical font, which is usually only and approximation
116 // of the desired outline font. The actual displayable point size
117 // is the one stored in the refData
122 inline int GetFamily(void) const
127 inline int GetStyle(void) const
129 return m_bNativeFontInfoOk
? m_vNativeFontInfo
.GetStyle()
133 inline int GetWeight(void) const
135 return m_bNativeFontInfoOk
? m_vNativeFontInfo
.GetWeight()
139 inline bool GetUnderlined(void) const
141 return m_bNativeFontInfoOk
? m_vNativeFontInfo
.GetUnderlined()
145 inline wxString
GetFaceName(void) const
149 if (m_bNativeFontInfoOk
)
150 sFaceName
= m_vNativeFontInfo
.GetFaceName();
152 sFaceName
= m_sFaceName
;
157 inline wxFontEncoding
GetEncoding(void) const
159 return m_bNativeFontInfoOk
? m_vNativeFontInfo
.GetEncoding()
163 inline WXHFONT
GetHFONT(void) const { return m_hFont
; }
164 inline HPS
GetPS(void) const { return m_hPS
; }
165 inline PFONTMETRICS
GetFM(void) const { return m_pFM
; }
166 inline int GetNumFonts(void) const { return m_nNumFonts
; }
169 inline void SetPointSize(int nPointSize
)
171 if (m_bNativeFontInfoOk
)
172 m_vNativeFontInfo
.SetPointSize(nPointSize
);
174 m_nPointSize
= nPointSize
;
177 inline void SetFamily(int nFamily
)
182 inline void SetStyle(int nStyle
)
184 if (m_bNativeFontInfoOk
)
185 m_vNativeFontInfo
.SetStyle((wxFontStyle
)nStyle
);
190 inline void SetWeight(int nWeight
)
192 if (m_bNativeFontInfoOk
)
193 m_vNativeFontInfo
.SetWeight((wxFontWeight
)nWeight
);
198 inline void SetFaceName(const wxString
& sFaceName
)
200 if (m_bNativeFontInfoOk
)
201 m_vNativeFontInfo
.SetFaceName(sFaceName
);
203 m_sFaceName
= sFaceName
;
206 inline void SetUnderlined(bool bUnderlined
)
208 if (m_bNativeFontInfoOk
)
209 m_vNativeFontInfo
.SetUnderlined(bUnderlined
);
211 m_bUnderlined
= bUnderlined
;
214 inline void SetEncoding(wxFontEncoding vEncoding
)
216 if (m_bNativeFontInfoOk
)
217 m_vNativeFontInfo
.SetEncoding(vEncoding
);
219 m_vEncoding
= vEncoding
;
222 inline void SetPS(HPS hPS
)
227 inline void SetFM(PFONTMETRICS pFM
)
232 inline void SetNumFonts(int nNumFonts
)
234 m_nNumFonts
= nNumFonts
;
238 // Native font info tests
240 bool HasNativeFontInfo() const { return m_bNativeFontInfoOk
; }
242 const wxNativeFontInfo
& GetNativeFontInfo() const
243 { return m_vNativeFontInfo
; }
247 // Common part of all ctors
254 ,const wxString
& rsFaceName
255 ,wxFontEncoding vEncoding
258 void Init( const wxNativeFontInfo
& rInfo
263 // If TRUE, the pointer to the actual font is temporary and SHOULD NOT BE
264 // DELETED by destructor
270 // Font characterstics
277 wxString m_sFaceName
;
278 wxFontEncoding m_vEncoding
;
284 wxNativeFontInfo m_vNativeFontInfo
;
285 bool m_bNativeFontInfoOk
;
288 // Some PM specific stuff
290 PFONTMETRICS m_pFM
; // array of FONTMETRICS structs
291 int m_nNumFonts
; // number of fonts in array
292 HPS m_hPS
; // PS handle this font belongs to
293 FATTRS m_vFattrs
; // Current fattrs struct
294 FACENAMEDESC m_vFname
; // Current facename struct
295 bool m_bInternalPS
; // Internally generated PS?
296 }; // end of CLASS wxFontRefData
298 // ============================================================================
300 // ============================================================================
302 // ----------------------------------------------------------------------------
304 // ----------------------------------------------------------------------------
306 void wxFontRefData::Init(
312 , const wxString
& rsFaceName
313 , wxFontEncoding vEncoding
317 m_nPointSize
= nPointSize
;
321 m_bUnderlined
= bUnderlined
;
322 m_sFaceName
= rsFaceName
;
323 m_vEncoding
= vEncoding
;
326 m_bNativeFontInfoOk
= FALSE
;
329 m_bTemporary
= FALSE
;
330 m_pFM
= (PFONTMETRICS
)NULL
;
333 } // end of wxFontRefData::Init
335 void wxFontRefData::Init(
336 const wxNativeFontInfo
& rInfo
337 , WXHFONT hFont
//this is the FontId -- functions as the hFont for OS/2
338 , WXHANDLE hPS
// Presentation Space we are using
342 // hFont may be zero, or it be passed in case we really want to
343 // use the exact font created in the underlying system
344 // (for example where we can't guarantee conversion from HFONT
345 // to LOGFONT back to HFONT)
348 m_nFontId
= (int)hFont
;
350 m_bNativeFontInfoOk
= TRUE
;
351 m_vNativeFontInfo
= rInfo
;
353 if (hPS
== NULLHANDLE
)
355 m_hPS
= ::WinGetPS(HWND_DESKTOP
);
356 m_bInternalPS
= TRUE
;
362 m_bTemporary
= FALSE
;
363 m_pFM
= (PFONTMETRICS
)NULL
;
365 } // end of wxFontRefData::Init
367 wxFontRefData::~wxFontRefData()
372 bool wxFontRefData::Alloc(
380 PFONTMETRICS pFM
= NULL
;
384 if (!m_bNativeFontInfoOk
)
386 wxFillLogFont( &m_vNativeFontInfo
.fa
387 ,&m_vNativeFontInfo
.fn
394 m_bNativeFontInfoOk
= TRUE
;
405 if((lRc
= ::GpiCreateLogFont( m_hPS
408 ,&m_vNativeFontInfo
.fa
411 m_hFont
= (WXHFONT
)flId
;
416 vError
= ::WinGetLastError(vHabmain
);
417 sError
= wxPMErrorToStr(vError
);
418 wxLogLastError("CreateFont");
421 ::GpiSetCharSet(m_hPS
, flId
); // sets font for presentation space
422 ::GpiQueryFontMetrics(m_hPS
, sizeof(FONTMETRICS
), &m_vNativeFontInfo
.fm
);
425 // Set refData members with the results
427 memcpy(&m_vFattrs
, &m_vNativeFontInfo
.fa
, sizeof(m_vFattrs
));
428 memcpy(&m_vFname
, &m_vNativeFontInfo
.fn
, sizeof(m_vFname
));
430 // Going to leave the point size alone. Mostly we use outline fonts
431 // that can be set to any point size inside of Presentation Parameters,
432 // regardless of whether or not the actual font is registered in the system.
433 // The GpiCreateLogFont will do enough by selecting the right family,
436 if (strcmp(m_vNativeFontInfo
.fm
.szFamilyname
, "Times New Roman") == 0)
438 else if (strcmp(m_vNativeFontInfo
.fm
.szFamilyname
, "Times New Roman MT 30") == 0)
440 else if (strcmp(m_vNativeFontInfo
.fm
.szFamilyname
, "@Times New Roman MT 30") == 0)
442 else if (strcmp(m_vNativeFontInfo
.fm
.szFamilyname
, "Tms Rmn") == 0)
444 else if (strcmp(m_vNativeFontInfo
.fm
.szFamilyname
, "WarpSans") == 0)
445 m_nFamily
= wxDECORATIVE
;
446 else if (strcmp(m_vNativeFontInfo
.fm
.szFamilyname
, "Helvetica") == 0)
448 else if (strcmp(m_vNativeFontInfo
.fm
.szFamilyname
, "Helv") == 0)
450 else if (strcmp(m_vNativeFontInfo
.fm
.szFamilyname
, "Script") == 0)
451 m_nFamily
= wxSCRIPT
;
452 else if (strcmp(m_vNativeFontInfo
.fm
.szFamilyname
, "Courier New") == 0)
453 m_nFamily
= wxTELETYPE
;
454 else if (strcmp(m_vNativeFontInfo
.fm
.szFamilyname
, "Courier") == 0)
455 m_nFamily
= wxTELETYPE
;
456 else if (strcmp(m_vNativeFontInfo
.fm
.szFamilyname
, "System Monospaced") == 0)
457 m_nFamily
= wxTELETYPE
;
458 else if (strcmp(m_vNativeFontInfo
.fm
.szFamilyname
, "System VIO") == 0)
459 m_nFamily
= wxMODERN
;
460 else if (strcmp(m_vNativeFontInfo
.fm
.szFamilyname
, "System Proportional") == 0)
461 m_nFamily
= wxMODERN
;
462 else if (strcmp(m_vNativeFontInfo
.fm
.szFamilyname
, "Arial") == 0)
464 else if (strcmp(m_vNativeFontInfo
.fm
.szFamilyname
, "Swiss") == 0)
469 if (m_vNativeFontInfo
.fa
.fsSelection
& FATTR_SEL_ITALIC
)
470 m_nStyle
= wxFONTSTYLE_ITALIC
;
472 m_nStyle
= wxFONTSTYLE_NORMAL
;
473 switch(m_vNativeFontInfo
.fn
.usWeightClass
)
475 case FWEIGHT_DONT_CARE
:
476 m_nWeight
= wxFONTWEIGHT_NORMAL
;
480 m_nWeight
= wxFONTWEIGHT_NORMAL
;
484 m_nWeight
= wxFONTWEIGHT_LIGHT
;
488 m_nWeight
= wxFONTWEIGHT_BOLD
;
491 case FWEIGHT_ULTRA_BOLD
:
492 m_nWeight
= wxFONTWEIGHT_MAX
;
496 m_nWeight
= wxFONTWEIGHT_NORMAL
;
498 m_bUnderlined
= ((m_vNativeFontInfo
.fa
.fsSelection
& FATTR_SEL_UNDERSCORE
) != 0);
499 m_sFaceName
= m_vNativeFontInfo
.fa
.szFacename
;
500 m_vEncoding
= wxGetFontEncFromCharSet(m_vNativeFontInfo
.fa
.usCodePage
);
503 // We don't actuall keep the font around if using a temporary PS
508 ::GpiDeleteSetId( m_hPS
512 ::WinReleasePS(m_hPS
);
516 // Select the font into the Presentation space
518 ::GpiSetCharSet(m_hPS
, flId
); // sets font for presentation space
520 } // end of wxFontRefData::Alloc
522 void wxFontRefData::Free()
526 m_pFM
= (PFONTMETRICS
)NULL
;
530 ::GpiDeleteSetId(m_hPS
, 1L); /* delete the logical font */
535 ::WinReleasePS(m_hPS
);
537 } // end of wxFontRefData::Free
539 // ----------------------------------------------------------------------------
541 // ----------------------------------------------------------------------------
543 void wxNativeFontInfo::Init()
545 memset(&fa
, '\0', sizeof(FATTRS
));
546 } // end of wxNativeFontInfo::Init
548 int wxNativeFontInfo::GetPointSize() const
551 } // end of wxNativeFontInfo::GetPointSize
553 wxFontStyle
wxNativeFontInfo::GetStyle() const
555 return fa
.fsSelection
& FATTR_SEL_ITALIC
? wxFONTSTYLE_ITALIC
: wxFONTSTYLE_NORMAL
;
556 } // end of wxNativeFontInfo::GetStyle
558 wxFontWeight
wxNativeFontInfo::GetWeight() const
560 switch(fn
.usWeightClass
)
562 case FWEIGHT_DONT_CARE
:
563 return wxFONTWEIGHT_NORMAL
;
566 return wxFONTWEIGHT_NORMAL
;
569 return wxFONTWEIGHT_LIGHT
;
572 return wxFONTWEIGHT_BOLD
;
574 case FWEIGHT_ULTRA_BOLD
:
575 return wxFONTWEIGHT_MAX
;
577 return wxFONTWEIGHT_NORMAL
;
578 } // end of wxNativeFontInfo::GetWeight
580 bool wxNativeFontInfo::GetUnderlined() const
582 return ((fa
.fsSelection
& FATTR_SEL_UNDERSCORE
) != 0);
583 } // end of wxNativeFontInfo::GetUnderlined
585 wxString
wxNativeFontInfo::GetFaceName() const
587 return fm
.szFacename
;
588 } // end of wxNativeFontInfo::GetFaceName
590 wxFontFamily
wxNativeFontInfo::GetFamily() const
595 // Extract family from facename
597 if (strcmp(fm
.szFamilyname
, "Times New Roman") == 0)
599 else if (strcmp(fm
.szFamilyname
, "Times New Roman MT 30") == 0)
601 else if (strcmp(fm
.szFamilyname
, "@Times New Roman MT 30") == 0)
603 else if (strcmp(fm
.szFamilyname
, "Tms Rmn") == 0)
605 else if (strcmp(fm
.szFamilyname
, "WarpSans") == 0)
606 nFamily
= wxDECORATIVE
;
607 else if (strcmp(fm
.szFamilyname
, "Helvetica") == 0)
609 else if (strcmp(fm
.szFamilyname
, "Helv") == 0)
611 else if (strcmp(fm
.szFamilyname
, "Script") == 0)
613 else if (strcmp(fm
.szFamilyname
, "Courier New") == 0)
614 nFamily
= wxTELETYPE
;
615 else if (strcmp(fm
.szFamilyname
, "Courier") == 0)
616 nFamily
= wxTELETYPE
;
617 else if (strcmp(fm
.szFamilyname
, "System Monospaced") == 0)
618 nFamily
= wxTELETYPE
;
619 else if (strcmp(fm
.szFamilyname
, "System VIO") == 0)
621 else if (strcmp(fm
.szFamilyname
, "System Proportional") == 0)
623 else if (strcmp(fm
.szFamilyname
, "Arial") == 0)
625 else if (strcmp(fm
.szFamilyname
, "Swiss") == 0)
629 return (wxFontFamily
)nFamily
;
630 } // end of wxNativeFontInfo::GetFamily
632 wxFontEncoding
wxNativeFontInfo::GetEncoding() const
634 return wxGetFontEncFromCharSet(fa
.usCodePage
);
635 } // end of wxNativeFontInfo::GetEncoding
637 void wxNativeFontInfo::SetPointSize(
641 fm
.lEmHeight
= (LONG
)nPointsize
;
642 } // end of wxNativeFontInfo::SetPointSize
644 void wxNativeFontInfo::SetStyle(
651 wxFAIL_MSG( _T("unknown font style") );
654 case wxFONTSTYLE_NORMAL
:
657 case wxFONTSTYLE_ITALIC
:
658 case wxFONTSTYLE_SLANT
:
659 fa
.fsSelection
|= FATTR_SEL_ITALIC
;
662 } // end of wxNativeFontInfo::SetStyle
664 void wxNativeFontInfo::SetWeight(
671 wxFAIL_MSG( _T("unknown font weight") );
674 case wxFONTWEIGHT_NORMAL
:
675 fn
.usWeightClass
= FWEIGHT_NORMAL
;
678 case wxFONTWEIGHT_LIGHT
:
679 fn
.usWeightClass
= FWEIGHT_LIGHT
;
682 case wxFONTWEIGHT_BOLD
:
683 fn
.usWeightClass
= FWEIGHT_BOLD
;
686 } // end of wxNativeFontInfo::SetWeight
688 void wxNativeFontInfo::SetUnderlined(
693 fa
.fsSelection
|= FATTR_SEL_UNDERSCORE
;
694 } // end of wxNativeFontInfo::SetUnderlined
696 void wxNativeFontInfo::SetFaceName(
700 wxStrncpy(fa
.szFacename
, sFacename
, WXSIZEOF(fa
.szFacename
));
701 } // end of wxNativeFontInfo::SetFaceName
703 void wxNativeFontInfo::SetFamily(
712 sFacename
= wxT("Tms Rmn");
716 sFacename
= wxT("WarpSans");
720 sFacename
= wxT("Tms Rmn");
724 sFacename
= wxT("Courier") ;
728 sFacename
= wxT("System VIO") ;
732 sFacename
= wxT("Helv") ;
737 sFacename
= wxT("System VIO") ;
740 if (!wxStrlen(fa
.szFacename
) )
742 SetFaceName(sFacename
);
744 } // end of wxNativeFontInfo::SetFamily
746 void wxNativeFontInfo::SetEncoding(
747 wxFontEncoding eEncoding
750 wxNativeEncodingInfo vInfo
;
752 if ( !wxGetNativeFontEncoding( eEncoding
756 if (wxFontMapper::Get()->GetAltForEncoding( eEncoding
760 if (!vInfo
.facename
.empty())
763 // If we have this encoding only in some particular facename, use
764 // the facename - it is better to show the correct characters in a
765 // wrong facename than unreadable text in a correct one
767 SetFaceName(vInfo
.facename
);
772 // unsupported encoding, replace with the default
776 fa
.usCodePage
= vInfo
.charset
;
777 } // end of wxNativeFontInfo::SetFaceName
779 bool wxNativeFontInfo::FromString(
780 const wxString
& rsStr
785 wxStringTokenizer
vTokenizer(rsStr
, _T(";"));
790 wxString sToken
= vTokenizer
.GetNextToken();
792 if (sToken
!= _T('0'))
795 sToken
= vTokenizer
.GetNextToken();
796 if (!sToken
.ToLong(&lVal
))
800 sToken
= vTokenizer
.GetNextToken();
801 if (!sToken
.ToLong(&lVal
))
803 fa
.lAveCharWidth
= lVal
;
805 sToken
= vTokenizer
.GetNextToken();
806 if (!sToken
.ToLong(&lVal
))
808 fa
.fsSelection
= (USHORT
)lVal
;
810 sToken
= vTokenizer
.GetNextToken();
811 if (!sToken
.ToLong(&lVal
))
813 fa
.fsType
= (USHORT
)lVal
;
815 sToken
= vTokenizer
.GetNextToken();
816 if (!sToken
.ToLong(&lVal
))
818 fa
.fsFontUse
= (USHORT
)lVal
;
820 sToken
= vTokenizer
.GetNextToken();
821 if (!sToken
.ToLong(&lVal
))
823 fa
.idRegistry
= (USHORT
)lVal
;
825 sToken
= vTokenizer
.GetNextToken();
826 if (!sToken
.ToLong(&lVal
))
828 fa
.usCodePage
= (USHORT
)lVal
;
830 sToken
= vTokenizer
.GetNextToken();
831 if (!sToken
.ToLong(&lVal
))
835 sToken
= vTokenizer
.GetNextToken();
836 if (!sToken
.ToLong(&lVal
))
838 fn
.usWeightClass
= (USHORT
)lVal
;
840 sToken
= vTokenizer
.GetNextToken();
843 wxStrcpy(fa
.szFacename
, sToken
.c_str());
845 } // end of wxNativeFontInfo::FromString
847 wxString
wxNativeFontInfo::ToString() const
851 sStr
.Printf(_T("%d;%ld;%ld;%ld;%d;%d;%d;%d;%d;%ld;%d;%s"),
852 0, // version, in case we want to change the format later
865 } // end of wxNativeFontInfo::ToString
867 // ----------------------------------------------------------------------------
869 // ----------------------------------------------------------------------------
873 } // end of wxFont::Init
876 const wxNativeFontInfo
& rInfo
881 m_refData
= new wxFontRefData( rInfo
886 } // end of wxFont::Create
889 const wxString
& rsFontdesc
892 wxNativeFontInfo vInfo
;
894 if (vInfo
.FromString(rsFontdesc
))
896 } // end of wxFont::wxFont
898 // ----------------------------------------------------------------------------
899 // Constructor for a font. Note that the real construction is done
900 // in wxDC::SetFont, when information is available about scaling etc.
901 // ----------------------------------------------------------------------------
908 , const wxString
& rsFaceName
909 , wxFontEncoding vEncoding
915 // wxDEFAULT is a valid value for the font size too so we must treat it
916 // specially here (otherwise the size would be 70 == wxDEFAULT value)
918 if (nPointSize
== wxDEFAULT
)
920 nPointSize
= wxNORMAL_FONT
->GetPointSize();
922 m_refData
= new wxFontRefData( nPointSize
932 } // end of wxFont::Create
936 } // end of wxFont::~wxFont
938 // ----------------------------------------------------------------------------
939 // real implementation
940 // Boris' Kovalenko comments:
941 // Because OS/2 fonts are associated with PS we can not create the font
942 // here, but we may check that font definition is true
943 // ----------------------------------------------------------------------------
945 bool wxFont::RealizeResource()
947 if ( GetResourceHandle() )
951 return M_FONTDATA
->Alloc(this);
952 } // end of wxFont::RealizeResource
954 bool wxFont::FreeResource(
958 if (GetResourceHandle())
964 } // end of wxFont::FreeResource
966 WXHANDLE
wxFont::GetResourceHandle()
969 } // end of wxFont::GetResourceHandle
971 WXHFONT
wxFont::GetHFONT() const
973 return M_FONTDATA
? M_FONTDATA
->GetHFONT() : 0;
974 } // end of wxFont::GetHFONT
976 bool wxFont::IsFree() const
978 return M_FONTDATA
&& (M_FONTDATA
->GetHFONT() == 0);
979 } // end of wxFont::IsFree
981 void wxFont::Unshare()
983 // Don't change shared data
986 m_refData
= new wxFontRefData();
990 wxFontRefData
* ref
= new wxFontRefData(*M_FONTDATA
);
994 } // end of wxFont::Unshare
996 // ----------------------------------------------------------------------------
997 // change font attribute: we recreate font when doing it
998 // ----------------------------------------------------------------------------
1000 void wxFont::SetPointSize(
1006 M_FONTDATA
->SetPointSize(nPointSize
);
1009 } // end of wxFont::SetPointSize
1011 void wxFont::SetFamily(
1017 M_FONTDATA
->SetFamily(nFamily
);
1020 } // end of wxFont::SetFamily
1022 void wxFont::SetStyle(
1028 M_FONTDATA
->SetStyle(nStyle
);
1031 } // end of wxFont::SetStyle
1033 void wxFont::SetWeight(
1039 M_FONTDATA
->SetWeight(nWeight
);
1042 } // end of wxFont::SetWeight
1044 void wxFont::SetFaceName(
1045 const wxString
& rsFaceName
1050 M_FONTDATA
->SetFaceName(rsFaceName
);
1053 } // end of wxFont::SetFaceName
1055 void wxFont::SetUnderlined(
1061 M_FONTDATA
->SetUnderlined(bUnderlined
);
1064 } // end of wxFont::SetUnderlined
1066 void wxFont::SetEncoding(
1067 wxFontEncoding vEncoding
1072 M_FONTDATA
->SetEncoding(vEncoding
);
1075 } // end of wxFont::SetEncoding
1077 void wxFont::DoSetNativeFontInfo(
1078 const wxNativeFontInfo
& rInfo
1085 *M_FONTDATA
= wxFontRefData(rInfo
);
1090 // ----------------------------------------------------------------------------
1092 // ----------------------------------------------------------------------------
1094 int wxFont::GetPointSize() const
1096 wxCHECK_MSG( Ok(), 0, wxT("invalid font") );
1098 return M_FONTDATA
->GetPointSize();
1099 } // end of wxFont::GetPointSize
1101 int wxFont::GetFamily() const
1103 wxCHECK_MSG( Ok(), 0, wxT("invalid font") );
1105 return M_FONTDATA
->GetFamily();
1106 } // end of wxFont::GetFamily
1108 int wxFont::GetStyle() const
1110 wxCHECK_MSG( Ok(), 0, wxT("invalid font") );
1112 return M_FONTDATA
->GetStyle();
1113 } // end of wxFont::GetStyle
1115 int wxFont::GetWeight() const
1117 wxCHECK_MSG( Ok(), 0, wxT("invalid font") );
1119 return M_FONTDATA
->GetWeight();
1122 bool wxFont::GetUnderlined() const
1124 wxCHECK_MSG( Ok(), FALSE
, wxT("invalid font") );
1126 return M_FONTDATA
->GetUnderlined();
1127 } // end of wxFont::GetUnderlined
1129 wxString
wxFont::GetFaceName() const
1131 wxCHECK_MSG( Ok(), wxT(""), wxT("invalid font") );
1133 return M_FONTDATA
->GetFaceName();
1134 } // end of wxFont::GetFaceName
1136 wxFontEncoding
wxFont::GetEncoding() const
1138 wxCHECK_MSG( Ok(), wxFONTENCODING_DEFAULT
, wxT("invalid font") );
1140 return M_FONTDATA
->GetEncoding();
1141 } // end of wxFont::GetEncoding
1143 const wxNativeFontInfo
* wxFont::GetNativeFontInfo() const
1145 return M_FONTDATA
->HasNativeFontInfo() ? &(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