X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/9045ad9dfc9d205ad645e6d496bec9ccddd91ced..222702b112dcc7bebe018d6f4d66fe469fefd02c:/src/x11/font.cpp diff --git a/src/x11/font.cpp b/src/x11/font.cpp index 0e2d09b1ff..5018bc39ed 100644 --- a/src/x11/font.cpp +++ b/src/x11/font.cpp @@ -17,7 +17,7 @@ // headers // ---------------------------------------------------------------------------- -#ifdef __GNUG__ +#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) #pragma implementation "font.h" #endif @@ -79,10 +79,10 @@ wxXFont::wxXFont() 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 @@ -123,7 +123,7 @@ public: 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); @@ -424,12 +424,12 @@ void wxFontRefData::ClearX11Fonts() { #if wxUSE_UNICODE #else - wxNode* node = m_fonts.First(); + wxList::compatibility_iterator node = m_fonts.GetFirst(); while (node) { - wxXFont* f = (wxXFont*) node->Data(); + wxXFont* f = (wxXFont*) node->GetData(); delete f; - node = node->Next(); + node = node->GetNext(); } m_fonts.Clear(); #endif @@ -745,14 +745,14 @@ wxFontEncoding wxFont::GetEncoding() const 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") ); @@ -762,7 +762,7 @@ wxNativeFontInfo *wxFont::GetNativeFontInfo() const GetInternalFont(); #endif - return new wxNativeFontInfo(M_FONTDATA->m_nativeFontInfo); + return &(M_FONTDATA->m_nativeFontInfo); } bool wxFont::IsFixedWidth() const @@ -770,6 +770,7 @@ 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 ) @@ -781,9 +782,10 @@ bool wxFont::IsFixedWidth() const return spacing.Upper() == _T('M'); } + // Unreaceable code for now + // return wxFontBase::IsFixedWidth(); #endif - return wxFontBase::IsFixedWidth(); } // ---------------------------------------------------------------------------- @@ -872,13 +874,13 @@ wxXFont* wxFont::GetInternalFont(double scale, WXDisplay* display) const int pointSize = (M_FONTDATA->m_pointSize * 10 * intScale) / 100; // search existing fonts first - wxNode* node = M_FONTDATA->m_fonts.First(); + wxList::compatibility_iterator node = M_FONTDATA->m_fonts.GetFirst(); while (node) { - wxXFont* f = (wxXFont*) node->Data(); + wxXFont* f = (wxXFont*) node->GetData(); if ((!display || (f->m_display == display)) && (f->m_scale == intScale)) return f; - node = node->Next(); + node = node->GetNext(); } // not found, create a new one