X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/cafbf6fb1f450c26823544bbd31cf87f87a1cbed..c34e3c7930684745d6aaf4696fc18faa32463d0e:/src/common/fontcmn.cpp diff --git a/src/common/fontcmn.cpp b/src/common/fontcmn.cpp index 50b3b19db8..f1b77746b2 100644 --- a/src/common/fontcmn.cpp +++ b/src/common/fontcmn.cpp @@ -6,7 +6,7 @@ // Created: 20.09.99 // RCS-ID: $Id$ // Copyright: (c) wxWindows team -// Licence: wxWindows license +// Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// // ============================================================================ @@ -17,7 +17,7 @@ // headers // ---------------------------------------------------------------------------- -#ifdef __GNUG__ +#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) #pragma implementation "fontbase.h" #endif @@ -34,6 +34,12 @@ #endif // WX_PRECOMP #include "wx/gdicmn.h" + +#if defined(__WXMSW__) + #include "wx/msw/private.h" // includes windows.h for LOGFONT + #include "wx/msw/winundef.h" +#endif + #include "wx/fontutil.h" // for wxNativeFontInfo #include "wx/fontmap.h" @@ -77,6 +83,33 @@ wxFont *wxFontBase::New(int size, return new wxFont(size, family, style, weight, underlined, face, encoding); } +/* static */ +wxFont *wxFontBase::New(int pointSize, + wxFontFamily family, + int flags, + const wxString& face, + wxFontEncoding encoding) +{ + return New + ( + pointSize, + family, + flags & wxFONTFLAG_ITALIC + ? wxFONTSTYLE_ITALIC + : flags & wxFONTFLAG_SLANT + ? wxFONTSTYLE_SLANT + : wxFONTSTYLE_NORMAL, + flags & wxFONTFLAG_LIGHT + ? wxFONTWEIGHT_LIGHT + : flags & wxFONTFLAG_BOLD + ? wxFONTWEIGHT_BOLD + : wxFONTWEIGHT_NORMAL, + (flags & wxFONTFLAG_UNDERLINED) != 0, + face, + encoding + ); +} + /* static */ wxFont *wxFontBase::New(const wxNativeFontInfo& info) { @@ -117,7 +150,7 @@ wxNativeFontInfo *wxFontBase::GetNativeFontInfo() const #endif } -void wxFontBase::SetNativeFontInfo(const wxNativeFontInfo& info) +void wxFontBase::DoSetNativeFontInfo(const wxNativeFontInfo& info) { #ifdef wxNO_NATIVE_FONTINFO SetPointSize(info.pointSize); @@ -296,8 +329,11 @@ bool wxNativeFontInfo::FromString(const wxString& s) underlined = l != 0; faceName = tokenizer.GetNextToken(); + +#ifndef __WXMAC__ if( !faceName ) return FALSE; +#endif token = tokenizer.GetNextToken(); if ( !token.ToLong(&l) ) @@ -475,7 +511,7 @@ wxString wxNativeFontInfo::ToUserString() const wxFontEncoding enc = GetEncoding(); if ( enc != wxFONTENCODING_DEFAULT && enc != wxFONTENCODING_SYSTEM ) { - desc << _T(' ') << wxTheFontMapper->GetEncodingName(enc); + desc << _T(' ') << wxFontMapper::Get()->GetEncodingName(enc); } #endif // wxUSE_FONTMAP @@ -528,7 +564,7 @@ bool wxNativeFontInfo::FromUserString(const wxString& s) SetPointSize(size); } #if wxUSE_FONTMAP - else if ( (encoding = wxTheFontMapper->CharsetToEncoding(token, FALSE)) + else if ( (encoding = wxFontMapper::Get()->CharsetToEncoding(token, FALSE)) != wxFONTENCODING_DEFAULT ) { SetEncoding(encoding);