From daaa6710be38d83363ea4c29cc498936c335e89f Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Tue, 8 May 2001 00:03:46 +0000 Subject: [PATCH] fixed iso8859-15 handling (backmerged from 2.2) git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@10038 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/common/fontmap.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/common/fontmap.cpp b/src/common/fontmap.cpp index d5b410beb1..13b7090082 100644 --- a/src/common/fontmap.cpp +++ b/src/common/fontmap.cpp @@ -467,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; } } -- 2.45.2