]> git.saurik.com Git - wxWidgets.git/blobdiff - src/html/winpars.cpp
adding constants for newer OSX versions to make sure our conditional expressions...
[wxWidgets.git] / src / html / winpars.cpp
index 916c43a989e9652b70b707ff60a69e24e583de86..d7047133c397e91a6538c05d4625e4209bb6693a 100644 (file)
@@ -573,11 +573,15 @@ void wxHtmlWinParser::SetFontPointSize(int pt)
         {
             if ( (pt > m_FontsSizes[n]) && (pt <= m_FontsSizes[n + 1]) )
             {
-                // In this range, find out which entry it is closest to
-                if ( (pt - m_FontsSizes[n]) < (m_FontsSizes[n + 1] - pt) )
-                    m_FontSize = n;
-                else
-                    m_FontSize = n + 1;
+                if ( (pt - m_FontsSizes[n]) >= (m_FontsSizes[n + 1] - pt) )
+                {
+                    // The actual size is closer to the next entry than to this
+                    // one, so use it.
+                    n++;
+                }
+
+                // Notice that m_FontSize starts from 1, hence +1 here.
+                m_FontSize = n + 1;
 
                 break;
             }