X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/2b5f62a0b2db198609b45dec622a018dae37008e..e0c5c96f67eaf13ccbd378616bdf98c8dba01e78:/src/x11/font.cpp diff --git a/src/x11/font.cpp b/src/x11/font.cpp index 8cd3bba65c..4eaee81f00 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 @@ -105,10 +105,10 @@ public: // copy cstr wxFontRefData(const wxFontRefData& data); - + // from XFLD wxFontRefData(const wxString& fontname); - + // dstr virtual ~wxFontRefData(); @@ -124,10 +124,10 @@ public: void SetNoAntiAliasing( bool no = TRUE ) { m_noAA = no; } bool GetNoAntiAliasing() { return m_noAA; } - + // and this one also modifies all the other font data fields void SetNativeFontInfo(const wxNativeFontInfo& info); - + protected: // common part of all ctors void Init(int size, @@ -140,7 +140,7 @@ protected: // set all fields from (already initialized and valid) m_nativeFontInfo void InitFromNative(); - + // font attributes int m_pointSize; int m_family; @@ -152,7 +152,7 @@ protected: bool m_noAA; // No anti-aliasing wxNativeFontInfo m_nativeFontInfo; - + void ClearX11Fonts(); #if wxUSE_UNICODE @@ -190,7 +190,7 @@ void wxFontRefData::Init(int pointSize, m_underlined = underlined; m_encoding = encoding; - + #if wxUSE_UNICODE // Create native font info m_nativeFontInfo.description = pango_font_description_new(); @@ -396,7 +396,7 @@ wxFontRefData::wxFontRefData( const wxFontRefData& data ) m_encoding = data.m_encoding; m_noAA = data.m_noAA; - + m_nativeFontInfo = data.m_nativeFontInfo; } @@ -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 @@ -556,15 +556,15 @@ bool wxFont::Create(int pointSize, wxFontEncoding encoding) { UnRef(); - + m_refData = new wxFontRefData(pointSize, family, style, weight, underlined, faceName, encoding); return TRUE; } -#if wxUSE_UNICODE -#else +#if !wxUSE_UNICODE + bool wxFont::Create(const wxString& fontname, wxFontEncoding enc) { if( !fontname ) @@ -665,9 +665,9 @@ bool wxFont::Create(const wxString& fontname, wxFontEncoding enc) else return FALSE; } - return TRUE; + return TRUE; } -#endif +#endif // !wxUSE_UNICODE wxFont::~wxFont() { @@ -752,7 +752,7 @@ bool wxFont::GetNoAntiAliasing() 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(); } // ---------------------------------------------------------------------------- @@ -839,7 +841,7 @@ void wxFont::SetEncoding(wxFontEncoding encoding) M_FONTDATA->SetEncoding(encoding); } -void wxFont::SetNativeFontInfo( const wxNativeFontInfo& info ) +void wxFont::DoSetNativeFontInfo( const wxNativeFontInfo& info ) { Unshare(); @@ -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