1 /////////////////////////////////////////////////////////////////////////////
2 // Name: src/os2/font.cpp
3 // Purpose: wxFont class
4 // Author: David Webster
8 // Copyright: (c) David Webster
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
12 // For compilers that support precompilation, includes "wx.h".
13 #include "wx/wxprec.h"
15 // ============================================================================
17 // ============================================================================
19 // ----------------------------------------------------------------------------
21 // ----------------------------------------------------------------------------
32 #include "wx/os2/private.h"
34 #include "wx/fontutil.h"
35 #include "wx/fontmap.h"
36 #include "wx/encinfo.h"
38 #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 wxEmptyString
, 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( wxFont
* pFont
)
380 if (!m_bNativeFontInfoOk
)
382 wxFillLogFont( &m_vNativeFontInfo
.fa
383 ,&m_vNativeFontInfo
.fn
390 m_bNativeFontInfoOk
= true;
401 if((lRc
= ::GpiCreateLogFont( m_hPS
404 ,&m_vNativeFontInfo
.fa
407 m_hFont
= (WXHFONT
)flId
;
412 vError
= ::WinGetLastError(vHabmain
);
413 sError
= wxPMErrorToStr(vError
);
414 wxLogLastError(wxT("CreateFont"));
417 ::GpiSetCharSet(m_hPS
, flId
); // sets font for presentation space
418 ::GpiQueryFontMetrics(m_hPS
, sizeof(FONTMETRICS
), &m_vNativeFontInfo
.fm
);
421 // Set refData members with the results
423 memcpy(&m_vFattrs
, &m_vNativeFontInfo
.fa
, sizeof(m_vFattrs
));
424 memcpy(&m_vFname
, &m_vNativeFontInfo
.fn
, sizeof(m_vFname
));
426 // Going to leave the point size alone. Mostly we use outline fonts
427 // that can be set to any point size inside of Presentation Parameters,
428 // regardless of whether or not the actual font is registered in the system.
429 // The GpiCreateLogFont will do enough by selecting the right family,
432 if (strcmp(m_vNativeFontInfo
.fm
.szFamilyname
, "Times New Roman") == 0)
434 else if (strcmp(m_vNativeFontInfo
.fm
.szFamilyname
, "Times New Roman MT 30") == 0)
436 else if (strcmp(m_vNativeFontInfo
.fm
.szFamilyname
, "@Times New Roman MT 30") == 0)
438 else if (strcmp(m_vNativeFontInfo
.fm
.szFamilyname
, "Tms Rmn") == 0)
440 else if (strcmp(m_vNativeFontInfo
.fm
.szFamilyname
, "WarpSans") == 0)
441 m_nFamily
= wxDECORATIVE
;
442 else if (strcmp(m_vNativeFontInfo
.fm
.szFamilyname
, "Helvetica") == 0)
444 else if (strcmp(m_vNativeFontInfo
.fm
.szFamilyname
, "Helv") == 0)
446 else if (strcmp(m_vNativeFontInfo
.fm
.szFamilyname
, "Script") == 0)
447 m_nFamily
= wxSCRIPT
;
448 else if (strcmp(m_vNativeFontInfo
.fm
.szFamilyname
, "Courier New") == 0)
449 m_nFamily
= wxTELETYPE
;
450 else if (strcmp(m_vNativeFontInfo
.fm
.szFamilyname
, "Courier") == 0)
451 m_nFamily
= wxTELETYPE
;
452 else if (strcmp(m_vNativeFontInfo
.fm
.szFamilyname
, "System Monospaced") == 0)
453 m_nFamily
= wxTELETYPE
;
454 else if (strcmp(m_vNativeFontInfo
.fm
.szFamilyname
, "System VIO") == 0)
455 m_nFamily
= wxMODERN
;
456 else if (strcmp(m_vNativeFontInfo
.fm
.szFamilyname
, "System Proportional") == 0)
457 m_nFamily
= wxMODERN
;
458 else if (strcmp(m_vNativeFontInfo
.fm
.szFamilyname
, "Arial") == 0)
460 else if (strcmp(m_vNativeFontInfo
.fm
.szFamilyname
, "Swiss") == 0)
465 if (m_vNativeFontInfo
.fa
.fsSelection
& FATTR_SEL_ITALIC
)
466 m_nStyle
= wxFONTSTYLE_ITALIC
;
468 m_nStyle
= wxFONTSTYLE_NORMAL
;
469 switch(m_vNativeFontInfo
.fn
.usWeightClass
)
471 case FWEIGHT_DONT_CARE
:
472 m_nWeight
= wxFONTWEIGHT_NORMAL
;
476 m_nWeight
= wxFONTWEIGHT_NORMAL
;
480 m_nWeight
= wxFONTWEIGHT_LIGHT
;
484 m_nWeight
= wxFONTWEIGHT_BOLD
;
487 case FWEIGHT_ULTRA_BOLD
:
488 m_nWeight
= wxFONTWEIGHT_MAX
;
492 m_nWeight
= wxFONTWEIGHT_NORMAL
;
494 m_bUnderlined
= ((m_vNativeFontInfo
.fa
.fsSelection
& FATTR_SEL_UNDERSCORE
) != 0);
495 m_sFaceName
= (wxChar
*)m_vNativeFontInfo
.fa
.szFacename
;
496 m_vEncoding
= wxGetFontEncFromCharSet(m_vNativeFontInfo
.fa
.usCodePage
);
499 // We don't actuall keep the font around if using a temporary PS
504 ::GpiDeleteSetId( m_hPS
508 ::WinReleasePS(m_hPS
);
512 // Select the font into the Presentation space
514 ::GpiSetCharSet(m_hPS
, flId
); // sets font for presentation space
516 } // end of wxFontRefData::Alloc
518 void wxFontRefData::Free()
522 m_pFM
= (PFONTMETRICS
)NULL
;
526 ::GpiDeleteSetId(m_hPS
, 1L); /* delete the logical font */
531 ::WinReleasePS(m_hPS
);
533 } // end of wxFontRefData::Free
535 // ----------------------------------------------------------------------------
537 // ----------------------------------------------------------------------------
539 void wxNativeFontInfo::Init()
541 memset(&fa
, '\0', sizeof(FATTRS
));
542 } // end of wxNativeFontInfo::Init
544 int wxNativeFontInfo::GetPointSize() const
547 } // end of wxNativeFontInfo::GetPointSize
549 wxFontStyle
wxNativeFontInfo::GetStyle() const
551 return fa
.fsSelection
& FATTR_SEL_ITALIC
? wxFONTSTYLE_ITALIC
: wxFONTSTYLE_NORMAL
;
552 } // end of wxNativeFontInfo::GetStyle
554 wxFontWeight
wxNativeFontInfo::GetWeight() const
556 switch(fn
.usWeightClass
)
558 case FWEIGHT_DONT_CARE
:
559 return wxFONTWEIGHT_NORMAL
;
562 return wxFONTWEIGHT_NORMAL
;
565 return wxFONTWEIGHT_LIGHT
;
568 return wxFONTWEIGHT_BOLD
;
570 case FWEIGHT_ULTRA_BOLD
:
571 return wxFONTWEIGHT_MAX
;
573 return wxFONTWEIGHT_NORMAL
;
574 } // end of wxNativeFontInfo::GetWeight
576 bool wxNativeFontInfo::GetUnderlined() const
578 return ((fa
.fsSelection
& FATTR_SEL_UNDERSCORE
) != 0);
579 } // end of wxNativeFontInfo::GetUnderlined
581 wxString
wxNativeFontInfo::GetFaceName() const
583 return (wxChar
*)fm
.szFacename
;
584 } // end of wxNativeFontInfo::GetFaceName
586 wxFontFamily
wxNativeFontInfo::GetFamily() const
591 // Extract family from facename
593 if (strcmp(fm
.szFamilyname
, "Times New Roman") == 0)
595 else if (strcmp(fm
.szFamilyname
, "Times New Roman MT 30") == 0)
597 else if (strcmp(fm
.szFamilyname
, "@Times New Roman MT 30") == 0)
599 else if (strcmp(fm
.szFamilyname
, "Tms Rmn") == 0)
601 else if (strcmp(fm
.szFamilyname
, "WarpSans") == 0)
602 nFamily
= wxDECORATIVE
;
603 else if (strcmp(fm
.szFamilyname
, "Helvetica") == 0)
605 else if (strcmp(fm
.szFamilyname
, "Helv") == 0)
607 else if (strcmp(fm
.szFamilyname
, "Script") == 0)
609 else if (strcmp(fm
.szFamilyname
, "Courier New") == 0)
610 nFamily
= wxTELETYPE
;
611 else if (strcmp(fm
.szFamilyname
, "Courier") == 0)
612 nFamily
= wxTELETYPE
;
613 else if (strcmp(fm
.szFamilyname
, "System Monospaced") == 0)
614 nFamily
= wxTELETYPE
;
615 else if (strcmp(fm
.szFamilyname
, "System VIO") == 0)
617 else if (strcmp(fm
.szFamilyname
, "System Proportional") == 0)
619 else if (strcmp(fm
.szFamilyname
, "Arial") == 0)
621 else if (strcmp(fm
.szFamilyname
, "Swiss") == 0)
625 return (wxFontFamily
)nFamily
;
626 } // end of wxNativeFontInfo::GetFamily
628 wxFontEncoding
wxNativeFontInfo::GetEncoding() const
630 return wxGetFontEncFromCharSet(fa
.usCodePage
);
631 } // end of wxNativeFontInfo::GetEncoding
633 void wxNativeFontInfo::SetPointSize(
637 fm
.lEmHeight
= (LONG
)nPointsize
;
638 } // end of wxNativeFontInfo::SetPointSize
640 void wxNativeFontInfo::SetStyle(
647 wxFAIL_MSG( _T("unknown font style") );
650 case wxFONTSTYLE_NORMAL
:
653 case wxFONTSTYLE_ITALIC
:
654 case wxFONTSTYLE_SLANT
:
655 fa
.fsSelection
|= FATTR_SEL_ITALIC
;
658 } // end of wxNativeFontInfo::SetStyle
660 void wxNativeFontInfo::SetWeight(
667 wxFAIL_MSG( _T("unknown font weight") );
670 case wxFONTWEIGHT_NORMAL
:
671 fn
.usWeightClass
= FWEIGHT_NORMAL
;
674 case wxFONTWEIGHT_LIGHT
:
675 fn
.usWeightClass
= FWEIGHT_LIGHT
;
678 case wxFONTWEIGHT_BOLD
:
679 fn
.usWeightClass
= FWEIGHT_BOLD
;
682 } // end of wxNativeFontInfo::SetWeight
684 void wxNativeFontInfo::SetUnderlined(
689 fa
.fsSelection
|= FATTR_SEL_UNDERSCORE
;
690 } // end of wxNativeFontInfo::SetUnderlined
692 void wxNativeFontInfo::SetFaceName(
693 const wxString
& sFacename
696 wxStrncpy((wxChar
*)fa
.szFacename
, sFacename
, WXSIZEOF(fa
.szFacename
));
697 } // end of wxNativeFontInfo::SetFaceName
699 void wxNativeFontInfo::SetFamily(
708 sFacename
= wxT("Tms Rmn");
712 sFacename
= wxT("WarpSans");
716 sFacename
= wxT("Tms Rmn");
720 sFacename
= wxT("Courier") ;
724 sFacename
= wxT("System VIO") ;
728 sFacename
= wxT("Helv") ;
733 sFacename
= wxT("System VIO") ;
736 if (!wxStrlen((wxChar
*)fa
.szFacename
) )
738 SetFaceName(sFacename
);
740 } // end of wxNativeFontInfo::SetFamily
742 void wxNativeFontInfo::SetEncoding( wxFontEncoding eEncoding
)
744 wxNativeEncodingInfo vInfo
;
746 if ( !wxGetNativeFontEncoding( eEncoding
750 if (wxFontMapper::Get()->GetAltForEncoding( eEncoding
754 if (!vInfo
.facename
.empty())
757 // If we have this encoding only in some particular facename, use
758 // the facename - it is better to show the correct characters in a
759 // wrong facename than unreadable text in a correct one
761 SetFaceName(vInfo
.facename
);
766 // unsupported encoding, replace with the default
770 fa
.usCodePage
= (USHORT
)vInfo
.charset
;
771 } // end of wxNativeFontInfo::SetFaceName
773 bool wxNativeFontInfo::FromString( const wxString
& rsStr
)
777 wxStringTokenizer
vTokenizer(rsStr
, _T(";"));
782 wxString sToken
= vTokenizer
.GetNextToken();
784 if (sToken
!= _T('0'))
787 sToken
= vTokenizer
.GetNextToken();
788 if (!sToken
.ToLong(&lVal
))
792 sToken
= vTokenizer
.GetNextToken();
793 if (!sToken
.ToLong(&lVal
))
795 fa
.lAveCharWidth
= lVal
;
797 sToken
= vTokenizer
.GetNextToken();
798 if (!sToken
.ToLong(&lVal
))
800 fa
.fsSelection
= (USHORT
)lVal
;
802 sToken
= vTokenizer
.GetNextToken();
803 if (!sToken
.ToLong(&lVal
))
805 fa
.fsType
= (USHORT
)lVal
;
807 sToken
= vTokenizer
.GetNextToken();
808 if (!sToken
.ToLong(&lVal
))
810 fa
.fsFontUse
= (USHORT
)lVal
;
812 sToken
= vTokenizer
.GetNextToken();
813 if (!sToken
.ToLong(&lVal
))
815 fa
.idRegistry
= (USHORT
)lVal
;
817 sToken
= vTokenizer
.GetNextToken();
818 if (!sToken
.ToLong(&lVal
))
820 fa
.usCodePage
= (USHORT
)lVal
;
822 sToken
= vTokenizer
.GetNextToken();
823 if (!sToken
.ToLong(&lVal
))
827 sToken
= vTokenizer
.GetNextToken();
828 if (!sToken
.ToLong(&lVal
))
830 fn
.usWeightClass
= (USHORT
)lVal
;
832 sToken
= vTokenizer
.GetNextToken();
835 wxStrcpy((wxChar
*)fa
.szFacename
, sToken
.c_str());
837 } // end of wxNativeFontInfo::FromString
839 wxString
wxNativeFontInfo::ToString() const
843 sStr
.Printf(_T("%d;%ld;%ld;%ld;%d;%d;%d;%d;%d;%ld;%d;%s"),
844 0, // version, in case we want to change the format later
857 } // end of wxNativeFontInfo::ToString
859 // ----------------------------------------------------------------------------
861 // ----------------------------------------------------------------------------
863 bool wxFont::Create( const wxNativeFontInfo
& rInfo
,
867 m_refData
= new wxFontRefData( rInfo
872 } // end of wxFont::Create
875 const wxString
& rsFontdesc
878 wxNativeFontInfo vInfo
;
880 if (vInfo
.FromString(rsFontdesc
))
882 } // end of wxFont::wxFont
884 // ----------------------------------------------------------------------------
885 // Constructor for a font. Note that the real construction is done
886 // in wxDC::SetFont, when information is available about scaling etc.
887 // ----------------------------------------------------------------------------
888 bool wxFont::Create( int nPointSize
,
893 const wxString
& rsFaceName
,
894 wxFontEncoding vEncoding
)
899 // wxDEFAULT is a valid value for the font size too so we must treat it
900 // specially here (otherwise the size would be 70 == wxDEFAULT value)
902 if (nPointSize
== wxDEFAULT
)
904 nPointSize
= wxNORMAL_FONT
->GetPointSize();
906 m_refData
= new wxFontRefData( nPointSize
916 } // end of wxFont::Create
920 } // end of wxFont::~wxFont
922 // ----------------------------------------------------------------------------
923 // real implementation
924 // Boris' Kovalenko comments:
925 // Because OS/2 fonts are associated with PS we can not create the font
926 // here, but we may check that font definition is true
927 // ----------------------------------------------------------------------------
929 bool wxFont::RealizeResource()
931 if ( GetResourceHandle() )
935 return M_FONTDATA
->Alloc(this);
936 } // end of wxFont::RealizeResource
938 bool wxFont::FreeResource( bool WXUNUSED(bForce
) )
940 if (GetResourceHandle())
946 } // end of wxFont::FreeResource
948 WXHANDLE
wxFont::GetResourceHandle()
951 } // end of wxFont::GetResourceHandle
953 WXHFONT
wxFont::GetHFONT() const
955 return M_FONTDATA
? M_FONTDATA
->GetHFONT() : 0;
956 } // end of wxFont::GetHFONT
958 bool wxFont::IsFree() const
960 return M_FONTDATA
&& (M_FONTDATA
->GetHFONT() == 0);
961 } // end of wxFont::IsFree
963 void wxFont::Unshare()
965 // Don't change shared data
968 m_refData
= new wxFontRefData();
972 wxFontRefData
* ref
= new wxFontRefData(*M_FONTDATA
);
976 } // end of wxFont::Unshare
978 // ----------------------------------------------------------------------------
979 // change font attribute: we recreate font when doing it
980 // ----------------------------------------------------------------------------
982 void wxFont::SetPointSize(
988 M_FONTDATA
->SetPointSize(nPointSize
);
991 } // end of wxFont::SetPointSize
993 void wxFont::SetFamily(
999 M_FONTDATA
->SetFamily(nFamily
);
1002 } // end of wxFont::SetFamily
1004 void wxFont::SetStyle(
1010 M_FONTDATA
->SetStyle(nStyle
);
1013 } // end of wxFont::SetStyle
1015 void wxFont::SetWeight(
1021 M_FONTDATA
->SetWeight(nWeight
);
1024 } // end of wxFont::SetWeight
1026 void wxFont::SetFaceName(
1027 const wxString
& rsFaceName
1032 M_FONTDATA
->SetFaceName(rsFaceName
);
1035 } // end of wxFont::SetFaceName
1037 void wxFont::SetUnderlined(
1043 M_FONTDATA
->SetUnderlined(bUnderlined
);
1046 } // end of wxFont::SetUnderlined
1048 void wxFont::SetEncoding(
1049 wxFontEncoding vEncoding
1054 M_FONTDATA
->SetEncoding(vEncoding
);
1057 } // end of wxFont::SetEncoding
1059 void wxFont::DoSetNativeFontInfo(
1060 const wxNativeFontInfo
& rInfo
1067 *M_FONTDATA
= wxFontRefData(rInfo
);
1072 // ----------------------------------------------------------------------------
1074 // ----------------------------------------------------------------------------
1076 int wxFont::GetPointSize() const
1078 wxCHECK_MSG( Ok(), 0, wxT("invalid font") );
1080 return M_FONTDATA
->GetPointSize();
1081 } // end of wxFont::GetPointSize
1083 int wxFont::GetFamily() const
1085 wxCHECK_MSG( Ok(), 0, wxT("invalid font") );
1087 return M_FONTDATA
->GetFamily();
1088 } // end of wxFont::GetFamily
1090 int wxFont::GetStyle() const
1092 wxCHECK_MSG( Ok(), 0, wxT("invalid font") );
1094 return M_FONTDATA
->GetStyle();
1095 } // end of wxFont::GetStyle
1097 int wxFont::GetWeight() const
1099 wxCHECK_MSG( Ok(), 0, wxT("invalid font") );
1101 return M_FONTDATA
->GetWeight();
1104 bool wxFont::GetUnderlined() const
1106 wxCHECK_MSG( Ok(), FALSE
, wxT("invalid font") );
1108 return M_FONTDATA
->GetUnderlined();
1109 } // end of wxFont::GetUnderlined
1111 wxString
wxFont::GetFaceName() const
1113 wxCHECK_MSG( Ok(), wxEmptyString
, wxT("invalid font") );
1115 return M_FONTDATA
->GetFaceName();
1116 } // end of wxFont::GetFaceName
1118 wxFontEncoding
wxFont::GetEncoding() const
1120 wxCHECK_MSG( Ok(), wxFONTENCODING_DEFAULT
, wxT("invalid font") );
1122 return M_FONTDATA
->GetEncoding();
1123 } // end of wxFont::GetEncoding
1125 const wxNativeFontInfo
* wxFont::GetNativeFontInfo() const
1127 return M_FONTDATA
->HasNativeFontInfo() ? &(M_FONTDATA
->GetNativeFontInfo())
1129 } // end of wxFont::GetNativeFontInfo
1132 // Internal use only method to set the FONTMETRICS array
1139 M_FONTDATA
->SetFM(pFM
);
1140 M_FONTDATA
->SetNumFonts(nNumFonts
);
1141 } // end of wxFont::SetFM
1150 M_FONTDATA
->SetPS(hPS
);
1153 } // end of wxFont::SetPS