]> git.saurik.com Git - wxWidgets.git/blobdiff - src/common/fontcmn.cpp
Platform and compiler-specific checking for MSW and Mac now done
[wxWidgets.git] / src / common / fontcmn.cpp
index 50b3b19db8f602d46f719a08934e6f04f634fe7a..d448cd623833a3865705efae2e7f27719f95fb39 100644 (file)
@@ -6,7 +6,7 @@
 // Created:     20.09.99
 // RCS-ID:      $Id$
 // Copyright:   (c) wxWindows team
-// Licence:     wxWindows license
+// Licence:     wxWindows licence
 /////////////////////////////////////////////////////////////////////////////
 
 // ============================================================================
@@ -77,6 +77,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 +144,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 +323,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 +505,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 +558,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);