]> git.saurik.com Git - wxWidgets.git/blobdiff - src/common/fontmap.cpp
somebody added #ifdefed #pragma to disable warnings about // in c source, instead...
[wxWidgets.git] / src / common / fontmap.cpp
index 05b1edd2abc9fdcfccb57be33b6955fe4f1adb05..694bbc943f399e8c41ce1d86adb07d7593a01541 100644 (file)
@@ -498,10 +498,13 @@ bool wxFontMapper::TestAltEncoding(const wxString& configEntry,
 
 bool wxFontMapper::GetAltForEncoding(wxFontEncoding encoding,
                                      wxNativeEncodingInfo *info,
+                                     const wxString& facename,
                                      bool interactive)
 {
     wxCHECK_MSG( info, FALSE, wxT("bad pointer in GetAltForEncoding") );
 
+    info->facename = facename;
+
     if ( encoding == wxFONTENCODING_DEFAULT )
     {
         encoding = wxFont::GetDefaultEncoding();
@@ -518,7 +521,7 @@ bool wxFontMapper::GetAltForEncoding(wxFontEncoding encoding,
         // wxFatalError doesn't return
     }
 
-    wxString configEntry = GetEncodingName(encoding);
+    wxString configEntry = facename + _T("_") + GetEncodingName(encoding);
 
     // do we have a font spec for this encoding?
     wxString pathOld;
@@ -582,6 +585,7 @@ bool wxFontMapper::GetAltForEncoding(wxFontEncoding encoding,
                 wxFont font = retData.GetChosenFont();
 
                 *info = retData.EncodingInfo();
+                info -> encoding = retData.GetEncoding();
 
                 // remember this in the config
                 if ( ChangePath(FONTMAPPER_FONT_FROM_ENCODING_PATH, &pathOld) )
@@ -601,7 +605,6 @@ bool wxFontMapper::GetAltForEncoding(wxFontEncoding encoding,
 
 
     // now try the default mappings:
-    
     wxFontEncodingArray equiv = wxEncodingConverter::GetAllEquivalents(encoding);
     for ( unsigned i = (equiv[0] == encoding) ? 1 : 0; i < equiv.GetCount(); i++ )
         if ( TestAltEncoding(configEntry, equiv[i], info) )
@@ -609,3 +612,32 @@ bool wxFontMapper::GetAltForEncoding(wxFontEncoding encoding,
 
     return FALSE;
 }
+
+
+
+bool wxFontMapper::GetAltForEncoding(wxFontEncoding encoding,
+                                     wxFontEncoding *alt_encoding,
+                                     const wxString& facename,
+                                     bool interactive)
+{
+    wxNativeEncodingInfo info;
+    bool r = GetAltForEncoding(encoding, &info, facename, interactive);
+    *alt_encoding = info.encoding;
+    return r;
+}
+
+
+
+bool wxFontMapper::IsEncodingAvailable(wxFontEncoding encoding,
+                                       const wxString& facename)
+{
+    wxNativeEncodingInfo info;
+
+    if (wxGetNativeFontEncoding(encoding, &info))
+    {
+        info.facename = facename;
+        return wxTestFontEncoding(info);
+    }
+    else
+        return FALSE;
+}