]> git.saurik.com Git - wxWidgets.git/blobdiff - src/common/fontmap.cpp
Applied patch #423927, (Min size for stretch parts of wxBoxSizer)
[wxWidgets.git] / src / common / fontmap.cpp
index d5b410beb12a1fd2136903a90f2ff49d9a6e8914..13b709008275f3720f89420c0b67074197f25cb7 100644 (file)
@@ -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;
                 }
             }