]> git.saurik.com Git - wxWidgets.git/commitdiff
added IsEncodingAvailable and GetAltForEncoding extended by facename argument and...
authorVáclav Slavík <vslavik@fastmail.fm>
Sat, 8 Jan 2000 23:45:31 +0000 (23:45 +0000)
committerVáclav Slavík <vslavik@fastmail.fm>
Sat, 8 Jan 2000 23:45:31 +0000 (23:45 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@5313 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

include/wx/fontmap.h
src/common/fontmap.cpp

index e5dc01d6e09305474042c8f50bafa8e2ab2e4796..ba5403b81d09750749435514c8a4bde111b4e52c 100644 (file)
@@ -55,8 +55,21 @@ public:
     // return FALSE
     virtual bool GetAltForEncoding(wxFontEncoding encoding,
                                    wxNativeEncodingInfo *info,
     // return FALSE
     virtual bool GetAltForEncoding(wxFontEncoding encoding,
                                    wxNativeEncodingInfo *info,
+                                   const wxString& facename = wxEmptyString,
                                    bool interactive = TRUE);
 
                                    bool interactive = TRUE);
 
+    // version better suitable for 'public' use. Returns wxFontEcoding
+    // that can be used it wxFont ctor
+    bool GetAltForEncoding(wxFontEncoding encoding,
+                           wxFontEncoding *alt_encoding,
+                           const wxString& facename = wxEmptyString,
+                           bool interactive = TRUE);
+
+    // checks whether given encoding is available in given face or not.
+    // If no facename is given, 
+    virtual bool IsEncodingAvailable(wxFontEncoding encoding,
+                                     const wxString& facename = wxEmptyString);
+
     // returns the encoding for the given charset (in the form of RFC 2046) or
     // wxFONTENCODING_SYSTEM if couldn't decode it
     virtual wxFontEncoding CharsetToEncoding(const wxString& charset,
     // returns the encoding for the given charset (in the form of RFC 2046) or
     // wxFONTENCODING_SYSTEM if couldn't decode it
     virtual wxFontEncoding CharsetToEncoding(const wxString& charset,
index 05b1edd2abc9fdcfccb57be33b6955fe4f1adb05..56f3461d2d9f3abd7486a617ddd584cda3072389 100644 (file)
@@ -498,10 +498,13 @@ bool wxFontMapper::TestAltEncoding(const wxString& configEntry,
 
 bool wxFontMapper::GetAltForEncoding(wxFontEncoding encoding,
                                      wxNativeEncodingInfo *info,
 
 bool wxFontMapper::GetAltForEncoding(wxFontEncoding encoding,
                                      wxNativeEncodingInfo *info,
+                                     const wxString& facename,
                                      bool interactive)
 {
     wxCHECK_MSG( info, FALSE, wxT("bad pointer in GetAltForEncoding") );
 
                                      bool interactive)
 {
     wxCHECK_MSG( info, FALSE, wxT("bad pointer in GetAltForEncoding") );
 
+    info->facename = facename;
+
     if ( encoding == wxFONTENCODING_DEFAULT )
     {
         encoding = wxFont::GetDefaultEncoding();
     if ( encoding == wxFONTENCODING_DEFAULT )
     {
         encoding = wxFont::GetDefaultEncoding();
@@ -609,3 +612,28 @@ bool wxFontMapper::GetAltForEncoding(wxFontEncoding encoding,
 
     return FALSE;
 }
 
     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;
+    
+    wxGetNativeFontEncoding(encoding, &info);
+    info.facename = facename;
+    return wxTestFontEncoding(info);
+}