From bff67a6a811bd0f8ec2315242ad2eb0324d9939d Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Sun, 23 Dec 2001 23:53:46 +0000 Subject: [PATCH] use wxFontMapper when setting the encoding (fix to restore the behaviour broken by the native font info change) git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@13175 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/msw/font.cpp | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/src/msw/font.cpp b/src/msw/font.cpp index bf831d467a..7a55510e19 100644 --- a/src/msw/font.cpp +++ b/src/msw/font.cpp @@ -37,10 +37,11 @@ #include "wx/log.h" #endif // WX_PRECOMP +#include "wx/msw/private.h" + #include "wx/fontutil.h" -#include "wx/tokenzr.h" +#include "wx/fontmap.h" -#include "wx/msw/private.h" #include "wx/tokenzr.h" IMPLEMENT_DYNAMIC_CLASS(wxFont, wxGDIObject) @@ -463,8 +464,20 @@ void wxNativeFontInfo::SetEncoding(wxFontEncoding encoding) wxNativeEncodingInfo info; if ( !wxGetNativeFontEncoding(encoding, &info) ) { - // unsupported encoding, replace with the default - info.charset = ANSI_CHARSET; +#if wxUSE_FONTMAP + if ( !wxTheFontMapper->GetAltForEncoding(encoding, &info) ) +#endif // wxUSE_FONTMAP + { + // unsupported encoding, replace with the default + info.charset = ANSI_CHARSET; + } + else if ( !info.facename.empty() ) + { + // if we have this encoding only in some particular facename, use + // the facename - it is better to show the correct characters in a + // wrong facename than unreadable text in a correct one + SetFaceName(info.facename); + } } lf.lfCharSet = info.charset; -- 2.45.2