added IsEncodingAvailable and GetAltForEncoding extended by facename argument and added GetAltForEncoding alternative that returns only wxFontEncoding (and thus more useful for wxWin users)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@5313 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -55,8 +55,21 @@ public:
|
|||||||
// return FALSE
|
// return FALSE
|
||||||
virtual bool GetAltForEncoding(wxFontEncoding encoding,
|
virtual bool GetAltForEncoding(wxFontEncoding encoding,
|
||||||
wxNativeEncodingInfo *info,
|
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
|
// returns the encoding for the given charset (in the form of RFC 2046) or
|
||||||
// wxFONTENCODING_SYSTEM if couldn't decode it
|
// wxFONTENCODING_SYSTEM if couldn't decode it
|
||||||
virtual wxFontEncoding CharsetToEncoding(const wxString& charset,
|
virtual wxFontEncoding CharsetToEncoding(const wxString& charset,
|
||||||
|
@@ -498,10 +498,13 @@ bool wxFontMapper::TestAltEncoding(const wxString& configEntry,
|
|||||||
|
|
||||||
bool wxFontMapper::GetAltForEncoding(wxFontEncoding encoding,
|
bool wxFontMapper::GetAltForEncoding(wxFontEncoding encoding,
|
||||||
wxNativeEncodingInfo *info,
|
wxNativeEncodingInfo *info,
|
||||||
|
const wxString& facename,
|
||||||
bool interactive)
|
bool interactive)
|
||||||
{
|
{
|
||||||
wxCHECK_MSG( info, FALSE, wxT("bad pointer in GetAltForEncoding") );
|
wxCHECK_MSG( info, FALSE, wxT("bad pointer in GetAltForEncoding") );
|
||||||
|
|
||||||
|
info->facename = facename;
|
||||||
|
|
||||||
if ( encoding == wxFONTENCODING_DEFAULT )
|
if ( encoding == wxFONTENCODING_DEFAULT )
|
||||||
{
|
{
|
||||||
encoding = wxFont::GetDefaultEncoding();
|
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);
|
||||||
|
}
|
||||||
|
Reference in New Issue
Block a user