Fix off by 1 error in wxHTML font size from points calculation.
m_FontSize is in 1..7 range, not 0..6, so add 1 to it when setting it from the index into m_FontsSizes array. Also update the comment explaining the valid range of m_FontsSize. Closes #14442. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@71878 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
Reference in New Issue
Block a user