X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/551fe3a6f024a542d26ce8da202d76d8c83f3a6f..f98de4487faac59af9d2d07e2ff23b8e852ce8eb:/src/common/fontmap.cpp diff --git a/src/common/fontmap.cpp b/src/common/fontmap.cpp index 8514d41c5e..13b7090082 100644 --- a/src/common/fontmap.cpp +++ b/src/common/fontmap.cpp @@ -42,6 +42,7 @@ #endif #if wxUSE_GUI + #include "wx/fontutil.h" #include "wx/msgdlg.h" #include "wx/fontdlg.h" #include "wx/choicdlg.h" @@ -466,11 +467,14 @@ wxFontEncoding wxFontMapper::CharsetToEncoding(const wxString& charset, unsigned int value; if ( wxSscanf(p, wxT("8859-%u"), &value) == 1 ) { - if ( value < wxFONTENCODING_ISO8859_MAX - - wxFONTENCODING_ISO8859_1 ) + // make it 0 based and check that it is strictly positive in + // the process (no such thing as iso8859-0 encoding) + if ( (value-- > 0) && + (value < wxFONTENCODING_ISO8859_MAX - + wxFONTENCODING_ISO8859_1) ) { // it's a valid ISO8859 encoding - value += wxFONTENCODING_ISO8859_1 - 1; + value += wxFONTENCODING_ISO8859_1; encoding = (wxFontEncoding)value; } }