// headers
// ----------------------------------------------------------------------------
-#ifdef __GNUG__
- #pragma implementation "font.h"
-#endif
-
#ifdef __VMS
#pragma message disable nosimpint
#include "wx/vms_x_fix.h"
wxXFont::~wxXFont()
{
- // TODO: why does freeing the font produce a segv???
- // Note that XFreeFont wasn't called in wxWin 1.68 either.
- // XFontStruct* fontStruct = (XFontStruct*) m_fontStruct;
- // XFreeFont((Display*) m_display, fontStruct);
+ // Freeing the font used to produce a segv, but
+ // appears to be OK now (bug fix in X11?)
+ XFontStruct* fontStruct = (XFontStruct*) m_fontStruct;
+ XFreeFont((Display*) m_display, fontStruct);
}
#endif
void SetEncoding(wxFontEncoding encoding);
void SetNoAntiAliasing( bool no = TRUE ) { m_noAA = no; }
- bool GetNoAntiAliasing() { return m_noAA; }
+ bool GetNoAntiAliasing() const { return m_noAA; }
// and this one also modifies all the other font data fields
void SetNativeFontInfo(const wxNativeFontInfo& info);
case wxFONTFAMILY_TELETYPE:
pango_font_description_set_family( m_nativeFontInfo.description, "monospace" );
break;
- case wxFONTFAMILY_SWISS:
+ case wxFONTFAMILY_ROMAN:
pango_font_description_set_family( m_nativeFontInfo.description, "serif" );
break;
default:
{
#if wxUSE_UNICODE
#else
- wxNode* node = m_fonts.GetFirst();
+ wxList::compatibility_iterator node = m_fonts.GetFirst();
while (node)
{
wxXFont* f = (wxXFont*) node->GetData();
return M_FONTDATA->m_encoding;
}
-bool wxFont::GetNoAntiAliasing()
+bool wxFont::GetNoAntiAliasing() const
{
wxCHECK_MSG( Ok(), wxFONTENCODING_DEFAULT, wxT("invalid font") );
return M_FONTDATA->m_noAA;
}
-wxNativeFontInfo *wxFont::GetNativeFontInfo() const
+const wxNativeFontInfo *wxFont::GetNativeFontInfo() const
{
wxCHECK_MSG( Ok(), (wxNativeFontInfo *)NULL, wxT("invalid font") );
GetInternalFont();
#endif
- return new wxNativeFontInfo(M_FONTDATA->m_nativeFontInfo);
+ return &(M_FONTDATA->m_nativeFontInfo);
}
bool wxFont::IsFixedWidth() const
wxCHECK_MSG( Ok(), FALSE, wxT("invalid font") );
#if wxUSE_UNICODE
+ return wxFontBase::IsFixedWidth();
#else
// Robert, is this right? HasNativeFont doesn't exist.
if ( TRUE )
return spacing.Upper() == _T('M');
}
+ // Unreaceable code for now
+ // return wxFontBase::IsFixedWidth();
#endif
- return wxFontBase::IsFixedWidth();
}
// ----------------------------------------------------------------------------
int pointSize = (M_FONTDATA->m_pointSize * 10 * intScale) / 100;
// search existing fonts first
- wxNode* node = M_FONTDATA->m_fonts.GetFirst();
+ wxList::compatibility_iterator node = M_FONTDATA->m_fonts.GetFirst();
while (node)
{
wxXFont* f = (wxXFont*) node->GetData();
node = node->GetNext();
}
+ wxString xFontName = M_FONTDATA->m_nativeFontInfo.GetXFontName();
+ if (xFontName == "-*-*-*-*-*--*-*-*-*-*-*-*-*")
+ // wxFont constructor not called with native font info parameter => take M_FONTDATA values
+ xFontName.Clear();
+
// not found, create a new one
XFontStruct *font = (XFontStruct *)
wxLoadQueryNearestFont(pointSize,
M_FONTDATA->m_weight,
M_FONTDATA->m_underlined,
wxT(""),
- M_FONTDATA->m_encoding);
+ M_FONTDATA->m_encoding,
+ & xFontName);
if ( !font )
{