]> git.saurik.com Git - wxWidgets.git/blobdiff - src/msw/fontutil.cpp
Smooth Aqua buttons in wxTreeCtrl.
[wxWidgets.git] / src / msw / fontutil.cpp
index 065b899c615336f68194bdcbc3ac0f437eba723d..5fdf917e370e22c06289625248f5d867a6370d7a 100644 (file)
 
 #include "wx/tokenzr.h"
 
 
 #include "wx/tokenzr.h"
 
+// for MSVC5 and old w32api
+#ifndef HANGUL_CHARSET
+#    define HANGUL_CHARSET  129
+#endif
+
 // ============================================================================
 // implementation
 // ============================================================================
 // ============================================================================
 // implementation
 // ============================================================================
@@ -63,8 +68,6 @@ bool wxNativeEncodingInfo::FromString(const wxString& s)
     encoding = (wxFontEncoding)enc;
 
     facename = tokenizer.GetNextToken();
     encoding = (wxFontEncoding)enc;
 
     facename = tokenizer.GetNextToken();
-    if ( !facename )
-        return FALSE;
 
     wxString tmp = tokenizer.GetNextToken();
     if ( !tmp )
 
     wxString tmp = tokenizer.GetNextToken();
     if ( !tmp )
@@ -123,7 +126,26 @@ bool wxGetNativeFontEncoding(wxFontEncoding encoding,
             info->charset = ANSI_CHARSET;
             break;
 
             info->charset = ANSI_CHARSET;
             break;
 
-#if !defined(__WIN16__)
+#if !defined(__WIN16__) && !defined(__WXMICROWIN__)
+
+        // The following four fonts are multi-byte charsets
+        case wxFONTENCODING_CP932:
+            info->charset = SHIFTJIS_CHARSET;
+            break;
+
+        case wxFONTENCODING_CP936:
+            info->charset = GB2312_CHARSET;
+            break;
+
+        case wxFONTENCODING_CP949:
+            info->charset = HANGUL_CHARSET;
+            break;
+
+        case wxFONTENCODING_CP950:
+            info->charset = CHINESEBIG5_CHARSET;
+            break;
+
+        // The rest are single byte encodings
         case wxFONTENCODING_CP1250:
             info->charset = EASTEUROPE_CHARSET;
             break;
         case wxFONTENCODING_CP1250:
             info->charset = EASTEUROPE_CHARSET;
             break;
@@ -155,6 +177,8 @@ bool wxGetNativeFontEncoding(wxFontEncoding encoding,
         case wxFONTENCODING_CP874:
             info->charset = THAI_CHARSET;
             break;
         case wxFONTENCODING_CP874:
             info->charset = THAI_CHARSET;
             break;
+
+
 #endif // !Win16
 
         case wxFONTENCODING_CP437:
 #endif // !Win16
 
         case wxFONTENCODING_CP437:
@@ -213,7 +237,7 @@ wxFontEncoding wxGetFontEncFromCharSet(int cs)
             fontEncoding = wxFONTENCODING_CP1252;
             break;
 
             fontEncoding = wxFONTENCODING_CP1252;
             break;
 
-#ifdef __WIN32__
+#if defined(__WIN32__) && !defined(__WXMICROWIN__)
         case EASTEUROPE_CHARSET:
             fontEncoding = wxFONTENCODING_CP1250;
             break;
         case EASTEUROPE_CHARSET:
             fontEncoding = wxFONTENCODING_CP1250;
             break;
@@ -245,6 +269,23 @@ wxFontEncoding wxGetFontEncFromCharSet(int cs)
         case THAI_CHARSET:
             fontEncoding = wxFONTENCODING_CP437;
             break;
         case THAI_CHARSET:
             fontEncoding = wxFONTENCODING_CP437;
             break;
+
+        case SHIFTJIS_CHARSET:
+            fontEncoding = wxFONTENCODING_CP932;
+            break;
+
+        case GB2312_CHARSET:
+            fontEncoding = wxFONTENCODING_CP936;
+            break;
+
+        case HANGUL_CHARSET:
+            fontEncoding = wxFONTENCODING_CP949;
+            break;
+
+        case CHINESEBIG5_CHARSET:
+            fontEncoding = wxFONTENCODING_CP950;
+            break;
+
 #endif // Win32
 
         case OEM_CHARSET:
 #endif // Win32
 
         case OEM_CHARSET:
@@ -369,7 +410,9 @@ void wxFillLogFont(LOGFONT *logFont, const wxFont *font)
     wxFontEncoding encoding = font->GetEncoding();
     if ( !wxGetNativeFontEncoding(encoding, &info) )
     {
     wxFontEncoding encoding = font->GetEncoding();
     if ( !wxGetNativeFontEncoding(encoding, &info) )
     {
+#if wxUSE_FONTMAP
         if ( !wxTheFontMapper->GetAltForEncoding(encoding, &info) )
         if ( !wxTheFontMapper->GetAltForEncoding(encoding, &info) )
+#endif // wxUSE_FONTMAP
         {
             // unsupported encoding, replace with the default
             info.charset = ANSI_CHARSET;
         {
             // unsupported encoding, replace with the default
             info.charset = ANSI_CHARSET;