1 /////////////////////////////////////////////////////////////////////////////
2 // Name: src/x11/font.cpp
3 // Purpose: wxFont class
4 // Author: Julian Smart
7 // Copyright: (c) Julian Smart
8 // Licence: wxWindows licence
9 /////////////////////////////////////////////////////////////////////////////
11 // for compilers that support precompilation, includes "wx.h".
12 #include "wx/wxprec.h"
14 // ============================================================================
16 // ============================================================================
18 // ----------------------------------------------------------------------------
20 // ----------------------------------------------------------------------------
23 #pragma message disable nosimpint
24 #include "wx/vms_x_fix.h"
28 #pragma message enable nosimpint
34 #include "wx/string.h"
35 #include "wx/utils.h" // for wxGetDisplay()
36 #include "wx/settings.h"
37 #include "wx/gdicmn.h"
40 #include "wx/fontutil.h" // for wxNativeFontInfo
41 #include "wx/tokenzr.h"
42 #include "wx/fontenum.h"
44 #include "wx/x11/private.h"
46 // ----------------------------------------------------------------------------
48 // ----------------------------------------------------------------------------
50 // the default size (in points) for the fonts
51 static const int wxDEFAULT_FONT_SIZE
= 12;
56 // ----------------------------------------------------------------------------
58 // ----------------------------------------------------------------------------
60 // For every wxFont, there must be a font for each display and scale requested.
61 // So these objects are stored in wxFontRefData::m_fonts
62 class wxXFont
: public wxObject
68 WXFontStructPtr m_fontStruct
; // XFontStruct
69 WXDisplay
* m_display
; // XDisplay
70 int m_scale
; // Scale * 100
75 m_fontStruct
= (WXFontStructPtr
) 0;
76 m_display
= (WXDisplay
*) 0;
82 // Freeing the font used to produce a segv, but
83 // appears to be OK now (bug fix in X11?)
84 XFontStruct
* fontStruct
= (XFontStruct
*) m_fontStruct
;
85 XFreeFont((Display
*) m_display
, fontStruct
);
89 // ----------------------------------------------------------------------------
91 // ----------------------------------------------------------------------------
93 class wxFontRefData
: public wxGDIRefData
98 wxFontRefData(int size
= wxDEFAULT
,
99 wxFontFamily family
= wxFONTFAMILY_DEFAULT
,
100 wxFontStyle style
= wxFONTSTYLE_NORMAL
,
101 wxFontWeight weight
= wxFONTWEIGHT_NORMAL
,
102 bool underlined
= false,
103 const wxString
& faceName
= wxEmptyString
,
104 wxFontEncoding encoding
= wxFONTENCODING_DEFAULT
);
107 wxFontRefData(const wxFontRefData
& data
);
110 wxFontRefData(const wxString
& fontname
);
113 virtual ~wxFontRefData();
115 // setters: all of them also take care to modify m_nativeFontInfo if we
116 // have it so as to not lose the information not carried by our fields
117 void SetPointSize(int pointSize
);
118 void SetFamily(wxFontFamily family
);
119 void SetStyle(wxFontStyle style
);
120 void SetWeight(wxFontWeight weight
);
121 void SetUnderlined(bool underlined
);
122 bool SetFaceName(const wxString
& facename
);
123 void SetEncoding(wxFontEncoding encoding
);
125 // and this one also modifies all the other font data fields
126 void SetNativeFontInfo(const wxNativeFontInfo
& info
);
129 // common part of all ctors
135 const wxString
& faceName
,
136 wxFontEncoding encoding
);
138 // set all fields from (already initialized and valid) m_nativeFontInfo
139 void InitFromNative();
143 wxFontFamily m_family
;
145 wxFontWeight m_weight
;
148 wxFontEncoding m_encoding
; // Unused in Unicode mode
150 wxNativeFontInfo m_nativeFontInfo
;
152 void ClearX11Fonts();
156 // A list of wxXFonts
161 #define M_FONTDATA ((wxFontRefData*)m_refData)
163 // ----------------------------------------------------------------------------
165 // ----------------------------------------------------------------------------
167 void wxFontRefData::Init(int pointSize
,
172 const wxString
& faceName
,
173 wxFontEncoding encoding
)
175 m_family
= family
== wxFONTFAMILY_DEFAULT
? wxFONTFAMILY_SWISS
: family
;
177 m_faceName
= faceName
;
179 // we accept both wxDEFAULT and wxNORMAL here - should we?
180 m_style
= style
== wxDEFAULT
? wxFONTSTYLE_NORMAL
: style
;
181 m_weight
= weight
== wxDEFAULT
? wxFONTWEIGHT_NORMAL
: weight
;
183 m_underlined
= underlined
;
184 m_encoding
= encoding
;
187 if ( m_nativeFontInfo
.description
)
188 pango_font_description_free(m_nativeFontInfo
.description
);
190 // Create native font info
191 m_nativeFontInfo
.description
= pango_font_description_new();
193 // if a face name is specified, use it if it's available, otherwise use
195 if ( faceName
.empty() || !wxFontEnumerator::IsValidFacename(faceName
) )
197 // TODO: scan system for valid fonts matching the given family instead
198 // of hardcoding them here
201 case wxFONTFAMILY_TELETYPE
:
202 m_faceName
= wxT("monospace");
205 case wxFONTFAMILY_ROMAN
:
206 m_faceName
= wxT("serif");
210 m_faceName
= wxT("sans");
213 else // specified face name is available, use it
215 m_faceName
= faceName
;
218 m_nativeFontInfo
.SetFaceName(m_faceName
);
219 m_nativeFontInfo
.SetWeight((wxFontWeight
)m_weight
);
220 m_nativeFontInfo
.SetStyle((wxFontStyle
)m_style
);
221 #endif // wxUSE_UNICODE
223 SetPointSize(pointSize
);
226 void wxFontRefData::InitFromNative()
230 PangoFontDescription
*desc
= m_nativeFontInfo
.description
;
233 m_faceName
= wxGTK_CONV_BACK( pango_font_description_get_family( desc
) );
235 m_pointSize
= pango_font_description_get_size( desc
) / PANGO_SCALE
;
237 switch (pango_font_description_get_style( desc
))
239 case PANGO_STYLE_NORMAL
:
240 m_style
= wxFONTSTYLE_NORMAL
;
242 case PANGO_STYLE_ITALIC
:
243 m_style
= wxFONTSTYLE_ITALIC
;
245 case PANGO_STYLE_OBLIQUE
:
246 m_style
= wxFONTSTYLE_SLANT
;
250 // Not defined in some Pango versions
251 #define wxPANGO_WEIGHT_SEMIBOLD 600
253 switch (pango_font_description_get_weight( desc
))
255 case PANGO_WEIGHT_ULTRALIGHT
:
256 case PANGO_WEIGHT_LIGHT
:
257 m_weight
= wxFONTWEIGHT_LIGHT
;
261 wxFAIL_MSG(wxT("unknown Pango font weight"));
264 case PANGO_WEIGHT_NORMAL
:
265 m_weight
= wxFONTWEIGHT_NORMAL
;
268 case wxPANGO_WEIGHT_SEMIBOLD
:
269 case PANGO_WEIGHT_BOLD
:
270 case PANGO_WEIGHT_ULTRABOLD
:
271 case PANGO_WEIGHT_HEAVY
:
272 m_weight
= wxFONTWEIGHT_BOLD
;
276 if (m_faceName
== wxT("monospace"))
278 m_family
= wxFONTFAMILY_TELETYPE
;
280 else if (m_faceName
== wxT("sans"))
282 m_family
= wxFONTFAMILY_SWISS
;
286 m_family
= wxFONTFAMILY_UNKNOWN
;
289 // Pango description are never underlined (?)
290 m_underlined
= false;
292 // Cannot we choose that
293 m_encoding
= wxFONTENCODING_SYSTEM
;
295 // get the font parameters from the XLFD
296 // -------------------------------------
298 m_faceName
= m_nativeFontInfo
.GetXFontComponent(wxXLFD_FAMILY
);
300 m_weight
= wxFONTWEIGHT_NORMAL
;
302 wxString w
= m_nativeFontInfo
.GetXFontComponent(wxXLFD_WEIGHT
).Upper();
303 if ( !w
.empty() && w
!= wxT('*') )
305 // the test below catches all of BOLD, EXTRABOLD, DEMIBOLD, ULTRABOLD
307 if ( ((w
[0u] == wxT('B') && (!wxStrcmp(w
.c_str() + 1, wxT("OLD")) ||
308 !wxStrcmp(w
.c_str() + 1, wxT("LACK"))))) ||
309 wxStrstr(w
.c_str() + 1, wxT("BOLD")) )
311 m_weight
= wxFONTWEIGHT_BOLD
;
313 else if ( w
== wxT("LIGHT") || w
== wxT("THIN") )
315 m_weight
= wxFONTWEIGHT_LIGHT
;
319 switch ( wxToupper( m_nativeFontInfo
.
320 GetXFontComponent(wxXLFD_SLANT
)[0u]).GetValue() )
322 case wxT('I'): // italique
323 m_style
= wxFONTSTYLE_ITALIC
;
326 case wxT('O'): // oblique
327 m_style
= wxFONTSTYLE_SLANT
;
331 m_style
= wxFONTSTYLE_NORMAL
;
335 if ( m_nativeFontInfo
.GetXFontComponent(wxXLFD_POINTSIZE
).ToLong(&ptSize
) )
337 // size in XLFD is in 10 point units
338 m_pointSize
= (int)(ptSize
/ 10);
342 m_pointSize
= wxDEFAULT_FONT_SIZE
;
345 // examine the spacing: if the font is monospaced, assume wxTELETYPE
346 // family for compatibility with the old code which used it instead of
348 if ( m_nativeFontInfo
.GetXFontComponent(wxXLFD_SPACING
).Upper() == wxT('M') )
350 m_family
= wxFONTFAMILY_TELETYPE
;
352 else // not monospaceed
354 // don't even try guessing it, it doesn't work for too many fonts
356 m_family
= wxFONTFAMILY_UNKNOWN
;
359 // X fonts are never underlined...
360 m_underlined
= false;
362 // deal with font encoding
364 registry
= m_nativeFontInfo
.GetXFontComponent(wxXLFD_REGISTRY
).Upper(),
365 encoding
= m_nativeFontInfo
.GetXFontComponent(wxXLFD_ENCODING
).Upper();
367 if ( registry
== wxT("ISO8859") )
370 if ( wxSscanf(encoding
, wxT("%d"), &cp
) == 1 )
372 m_encoding
= (wxFontEncoding
)(wxFONTENCODING_ISO8859_1
+ cp
- 1);
375 else if ( registry
== wxT("MICROSOFT") )
378 if ( wxSscanf(encoding
, wxT("cp125%d"), &cp
) == 1 )
380 m_encoding
= (wxFontEncoding
)(wxFONTENCODING_CP1250
+ cp
);
383 else if ( registry
== wxT("KOI8") )
385 m_encoding
= wxFONTENCODING_KOI8
;
387 else // unknown encoding
389 // may be give a warning here? or use wxFontMapper?
390 m_encoding
= wxFONTENCODING_SYSTEM
;
395 wxFontRefData::wxFontRefData( const wxFontRefData
& data
)
398 m_pointSize
= data
.m_pointSize
;
399 m_family
= data
.m_family
;
400 m_style
= data
.m_style
;
401 m_weight
= data
.m_weight
;
403 m_underlined
= data
.m_underlined
;
405 m_faceName
= data
.m_faceName
;
406 m_encoding
= data
.m_encoding
;
408 m_nativeFontInfo
= data
.m_nativeFontInfo
;
411 wxFontRefData::wxFontRefData(int size
, wxFontFamily family
, wxFontStyle style
,
412 wxFontWeight weight
, bool underlined
,
413 const wxString
& faceName
,
414 wxFontEncoding encoding
)
416 Init(size
, family
, style
, weight
, underlined
, faceName
, encoding
);
419 wxFontRefData::wxFontRefData(const wxString
& fontname
)
421 // VZ: FromString() should really work in both cases, doesn't it?
423 m_nativeFontInfo
.FromString( fontname
);
425 m_nativeFontInfo
.SetXFontName(fontname
);
431 void wxFontRefData::ClearX11Fonts()
435 wxList::compatibility_iterator node
= m_fonts
.GetFirst();
438 wxXFont
* f
= (wxXFont
*) node
->GetData();
440 node
= node
->GetNext();
446 wxFontRefData::~wxFontRefData()
451 // ----------------------------------------------------------------------------
452 // wxFontRefData SetXXX()
453 // ----------------------------------------------------------------------------
455 void wxFontRefData::SetPointSize(int pointSize
)
457 // NB: Pango doesn't support point sizes less than 1
458 m_pointSize
= pointSize
== wxDEFAULT
|| pointSize
< 1 ? wxDEFAULT_FONT_SIZE
462 m_nativeFontInfo
.SetPointSize(m_pointSize
);
466 void wxFontRefData::SetFamily(wxFontFamily family
)
470 // TODO: what are we supposed to do with m_nativeFontInfo here?
473 void wxFontRefData::SetStyle(wxFontStyle style
)
479 PangoFontDescription
*desc
= m_nativeFontInfo
.description
;
483 case wxFONTSTYLE_ITALIC
:
484 pango_font_description_set_style( desc
, PANGO_STYLE_ITALIC
);
486 case wxFONTSTYLE_SLANT
:
487 pango_font_description_set_style( desc
, PANGO_STYLE_OBLIQUE
);
490 wxFAIL_MSG( wxT("unknown font style") );
492 case wxFONTSTYLE_NORMAL
:
493 pango_font_description_set_style( desc
, PANGO_STYLE_NORMAL
);
499 void wxFontRefData::SetWeight(wxFontWeight weight
)
504 void wxFontRefData::SetUnderlined(bool underlined
)
506 m_underlined
= underlined
;
508 // the XLFD doesn't have "underlined" field anyhow
511 bool wxFontRefData::SetFaceName(const wxString
& facename
)
513 m_faceName
= facename
;
517 void wxFontRefData::SetEncoding(wxFontEncoding encoding
)
519 m_encoding
= encoding
;
522 void wxFontRefData::SetNativeFontInfo(const wxNativeFontInfo
& info
)
524 // previously cached fonts shouldn't be used
527 m_nativeFontInfo
= info
;
529 // set all the other font parameters from the native font info
533 // ----------------------------------------------------------------------------
535 // ----------------------------------------------------------------------------
537 wxFont::wxFont(const wxNativeFontInfo
& info
)
540 Create( info
.GetPointSize(),
544 info
.GetUnderlined(),
546 info
.GetEncoding() );
548 (void) Create(info
.GetXFontName());
552 bool wxFont::Create(int pointSize
,
557 const wxString
& faceName
,
558 wxFontEncoding encoding
)
562 m_refData
= new wxFontRefData(pointSize
, family
, style
, weight
,
563 underlined
, faceName
, encoding
);
570 bool wxFont::Create(const wxString
& fontname
, wxFontEncoding enc
)
574 *this = wxSystemSettings::GetFont( wxSYS_DEFAULT_GUI_FONT
);
578 m_refData
= new wxFontRefData();
580 M_FONTDATA
->m_nativeFontInfo
.SetXFontName(fontname
); // X font name
584 wxStringTokenizer
tn( fontname
, wxT("-") );
586 tn
.GetNextToken(); // skip initial empty token
587 tn
.GetNextToken(); // foundry
590 M_FONTDATA
->m_faceName
= tn
.GetNextToken(); // family
592 tmp
= tn
.GetNextToken().MakeUpper(); // weight
593 if (tmp
== wxT("BOLD")) M_FONTDATA
->m_weight
= wxFONTWEIGHT_BOLD
;
594 if (tmp
== wxT("BLACK")) M_FONTDATA
->m_weight
= wxFONTWEIGHT_BOLD
;
595 if (tmp
== wxT("EXTRABOLD")) M_FONTDATA
->m_weight
= wxFONTWEIGHT_BOLD
;
596 if (tmp
== wxT("DEMIBOLD")) M_FONTDATA
->m_weight
= wxFONTWEIGHT_BOLD
;
597 if (tmp
== wxT("ULTRABOLD")) M_FONTDATA
->m_weight
= wxFONTWEIGHT_BOLD
;
599 if (tmp
== wxT("LIGHT")) M_FONTDATA
->m_weight
= wxFONTWEIGHT_LIGHT
;
600 if (tmp
== wxT("THIN")) M_FONTDATA
->m_weight
= wxFONTWEIGHT_LIGHT
;
602 tmp
= tn
.GetNextToken().MakeUpper(); // slant
603 if (tmp
== wxT("I")) M_FONTDATA
->m_style
= wxFONTSTYLE_ITALIC
;
604 if (tmp
== wxT("O")) M_FONTDATA
->m_style
= wxFONTSTYLE_ITALIC
;
606 tn
.GetNextToken(); // set width
607 tn
.GetNextToken(); // add. style
608 tn
.GetNextToken(); // pixel size
610 tmp
= tn
.GetNextToken(); // pointsize
613 long num
= wxStrtol (tmp
.c_str(), (wxChar
**) NULL
, 10);
614 M_FONTDATA
->m_pointSize
= (int)(num
/ 10);
617 tn
.GetNextToken(); // x-res
618 tn
.GetNextToken(); // y-res
620 tmp
= tn
.GetNextToken().MakeUpper(); // spacing
623 M_FONTDATA
->m_family
= wxFONTFAMILY_MODERN
;
624 else if (M_FONTDATA
->m_faceName
== wxT("TIMES"))
625 M_FONTDATA
->m_family
= wxFONTFAMILY_ROMAN
;
626 else if (M_FONTDATA
->m_faceName
== wxT("HELVETICA"))
627 M_FONTDATA
->m_family
= wxFONTFAMILY_SWISS
;
628 else if (M_FONTDATA
->m_faceName
== wxT("LUCIDATYPEWRITER"))
629 M_FONTDATA
->m_family
= wxFONTFAMILY_TELETYPE
;
630 else if (M_FONTDATA
->m_faceName
== wxT("LUCIDA"))
631 M_FONTDATA
->m_family
= wxFONTFAMILY_DECORATIVE
;
632 else if (M_FONTDATA
->m_faceName
== wxT("UTOPIA"))
633 M_FONTDATA
->m_family
= wxFONTFAMILY_SCRIPT
;
635 tn
.GetNextToken(); // avg width
637 // deal with font encoding
638 M_FONTDATA
->m_encoding
= enc
;
639 if ( M_FONTDATA
->m_encoding
== wxFONTENCODING_SYSTEM
)
641 wxString registry
= tn
.GetNextToken().MakeUpper(),
642 encoding
= tn
.GetNextToken().MakeUpper();
644 if ( registry
== wxT("ISO8859") )
647 if ( wxSscanf(encoding
, wxT("%d"), &cp
) == 1 )
649 M_FONTDATA
->m_encoding
=
650 (wxFontEncoding
)(wxFONTENCODING_ISO8859_1
+ cp
- 1);
653 else if ( registry
== wxT("MICROSOFT") )
656 if ( wxSscanf(encoding
, wxT("cp125%d"), &cp
) == 1 )
658 M_FONTDATA
->m_encoding
=
659 (wxFontEncoding
)(wxFONTENCODING_CP1250
+ cp
);
662 else if ( registry
== wxT("KOI8") )
664 M_FONTDATA
->m_encoding
= wxFONTENCODING_KOI8
;
666 //else: unknown encoding - may be give a warning here?
672 #endif // !wxUSE_UNICODE
678 wxGDIRefData
*wxFont::CreateGDIRefData() const
680 return new wxFontRefData
;
683 wxGDIRefData
*wxFont::CloneGDIRefData(const wxGDIRefData
*data
) const
685 return new wxFontRefData(*static_cast<const wxFontRefData
*>(data
));
688 // ----------------------------------------------------------------------------
689 // change the font attributes
690 // ----------------------------------------------------------------------------
692 void wxFont::Unshare()
694 // Don't change shared data
697 m_refData
= new wxFontRefData();
701 wxFontRefData
* ref
= new wxFontRefData(*(wxFontRefData
*)m_refData
);
707 // ----------------------------------------------------------------------------
709 // ----------------------------------------------------------------------------
711 int wxFont::GetPointSize() const
713 wxCHECK_MSG( IsOk(), 0, wxT("invalid font") );
715 return M_FONTDATA
->m_pointSize
;
718 wxString
wxFont::GetFaceName() const
720 wxCHECK_MSG( IsOk(), wxEmptyString
, wxT("invalid font") );
722 return M_FONTDATA
->m_faceName
;
725 wxFontFamily
wxFont::DoGetFamily() const
727 return M_FONTDATA
->m_family
;
730 wxFontStyle
wxFont::GetStyle() const
732 wxCHECK_MSG( IsOk(), wxFONTSTYLE_MAX
, wxT("invalid font") );
734 return M_FONTDATA
->m_style
;
737 wxFontWeight
wxFont::GetWeight() const
739 wxCHECK_MSG( IsOk(), wxFONTWEIGHT_MAX
, wxT("invalid font") );
741 return M_FONTDATA
->m_weight
;
744 bool wxFont::GetUnderlined() const
746 wxCHECK_MSG( IsOk(), false, wxT("invalid font") );
748 return M_FONTDATA
->m_underlined
;
751 wxFontEncoding
wxFont::GetEncoding() const
753 wxCHECK_MSG( IsOk(), wxFONTENCODING_DEFAULT
, wxT("invalid font") );
755 return M_FONTDATA
->m_encoding
;
758 const wxNativeFontInfo
*wxFont::GetNativeFontInfo() const
760 wxCHECK_MSG( IsOk(), NULL
, wxT("invalid font") );
764 if ( M_FONTDATA
->m_nativeFontInfo
.GetXFontName().empty() )
768 return &(M_FONTDATA
->m_nativeFontInfo
);
771 bool wxFont::IsFixedWidth() const
773 wxCHECK_MSG( IsOk(), false, wxT("invalid font") );
776 return wxFontBase::IsFixedWidth();
778 // Robert, is this right? HasNativeFont doesn't exist.
780 // if ( M_FONTDATA->HasNativeFont() )
782 // the monospace fonts are supposed to have "M" in the spacing field
783 wxString spacing
= M_FONTDATA
->
784 m_nativeFontInfo
.GetXFontComponent(wxXLFD_SPACING
);
786 return spacing
.Upper() == wxT('M');
788 // Unreaceable code for now
789 // return wxFontBase::IsFixedWidth();
794 // ----------------------------------------------------------------------------
795 // change font attributes
796 // ----------------------------------------------------------------------------
798 void wxFont::SetPointSize(int pointSize
)
802 M_FONTDATA
->SetPointSize(pointSize
);
805 void wxFont::SetFamily(wxFontFamily family
)
809 M_FONTDATA
->SetFamily(family
);
812 void wxFont::SetStyle(wxFontStyle style
)
816 M_FONTDATA
->SetStyle(style
);
819 void wxFont::SetWeight(wxFontWeight weight
)
823 M_FONTDATA
->SetWeight(weight
);
826 bool wxFont::SetFaceName(const wxString
& faceName
)
830 return M_FONTDATA
->SetFaceName(faceName
) &&
831 wxFontBase::SetFaceName(faceName
);
834 void wxFont::SetUnderlined(bool underlined
)
838 M_FONTDATA
->SetUnderlined(underlined
);
841 void wxFont::SetEncoding(wxFontEncoding encoding
)
845 M_FONTDATA
->SetEncoding(encoding
);
848 void wxFont::DoSetNativeFontInfo( const wxNativeFontInfo
& info
)
852 M_FONTDATA
->SetNativeFontInfo( info
);
857 // ----------------------------------------------------------------------------
858 // X11 implementation
859 // ----------------------------------------------------------------------------
861 // Find an existing, or create a new, XFontStruct
862 // based on this wxFont and the given scale. Append the
863 // font to list in the private data for future reference.
864 wxXFont
* wxFont::GetInternalFont(double scale
, WXDisplay
* display
) const
869 long intScale
= long(scale
* 100.0 + 0.5); // key for wxXFont
870 int pointSize
= (M_FONTDATA
->m_pointSize
* 10 * intScale
) / 100;
872 // search existing fonts first
873 wxList::compatibility_iterator node
= M_FONTDATA
->m_fonts
.GetFirst();
876 wxXFont
* f
= (wxXFont
*) node
->GetData();
877 if ((!display
|| (f
->m_display
== display
)) && (f
->m_scale
== intScale
))
879 node
= node
->GetNext();
882 wxString xFontName
= M_FONTDATA
->m_nativeFontInfo
.GetXFontName();
883 if (xFontName
== "-*-*-*-*-*--*-*-*-*-*-*-*-*")
884 // wxFont constructor not called with native font info parameter => take M_FONTDATA values
887 // not found, create a new one
888 XFontStruct
*font
= (XFontStruct
*)
889 wxLoadQueryNearestFont(pointSize
,
890 M_FONTDATA
->m_family
,
892 M_FONTDATA
->m_weight
,
893 M_FONTDATA
->m_underlined
,
895 M_FONTDATA
->m_encoding
,
900 wxFAIL_MSG( wxT("Could not allocate even a default font -- something is wrong.") );
905 wxXFont
* f
= new wxXFont
;
906 f
->m_fontStruct
= (WXFontStructPtr
)font
;
907 f
->m_display
= ( display
? display
: wxGetDisplay() );
908 f
->m_scale
= intScale
;
909 M_FONTDATA
->m_fonts
.Append(f
);
914 WXFontStructPtr
wxFont::GetFontStruct(double scale
, WXDisplay
* display
) const
916 wxXFont
* f
= GetInternalFont(scale
, display
);
918 return (f
? f
->m_fontStruct
: (WXFontStructPtr
) 0);
921 #endif // !wxUSE_UNICODE