X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/7beba2fc73283f5b750227459da57e66bcd475f5..07cf98cb8eb7625eeffc95e407a9fa1ad863b451:/src/common/fontmap.cpp diff --git a/src/common/fontmap.cpp b/src/common/fontmap.cpp index 3222cf0f61..09880ab43f 100644 --- a/src/common/fontmap.cpp +++ b/src/common/fontmap.cpp @@ -438,9 +438,9 @@ wxFontEncoding wxFontMapper::CharsetToEncoding(const wxString& charset, wxString *encodingNamesTranslated = new wxString[count]; - for ( size_t n = 0; n < count; n++ ) + for ( size_t i = 0; i < count; i++ ) { - encodingNamesTranslated[n] = wxGetTranslation(gs_encodingDescs[n]); + encodingNamesTranslated[i] = wxGetTranslation(gs_encodingDescs[i]); } // the parent window @@ -501,6 +501,22 @@ bool wxFontMapper::GetAltForEncoding(wxFontEncoding encoding, { wxCHECK_MSG( info, FALSE, _T("bad pointer in GetAltForEncoding") ); + if ( encoding == wxFONTENCODING_DEFAULT ) + { + encoding = wxFont::GetDefaultEncoding(); + } + + // if we failed to load the system default encoding, something is really + // wrong and we'd better stop now - otherwise we will go into endless + // recursion trying to create the font in the msg box with the error + // message + if ( encoding == wxFONTENCODING_SYSTEM ) + { + wxFatalError(_("can't load any font, aborting")); + + // wxFatalError doesn't return + } + wxString configEntry = GetEncodingName(encoding); // do we have a font spec for this encoding? @@ -564,8 +580,7 @@ bool wxFontMapper::GetAltForEncoding(wxFontEncoding encoding, wxFontData retData = dialog.GetFontData(); wxFont font = retData.GetChosenFont(); - info->xregistry = retData.EncodingInfo().xregistry; - info->xencoding = retData.EncodingInfo().xencoding; + *info = retData.EncodingInfo(); // remember this in the config if ( ChangePath(FONTMAPPER_FONT_FROM_ENCODING_PATH, &pathOld) )