Add <span> tag and limited support for CSS styles to wxHTML.

Parse "style" attributes of the HTML tags and honour those of them that can be
mapped to the HTML 3 attributes.

Also add a handler for <span> tag.

Closes #10631.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@64443 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2010-05-30 23:12:25 +00:00
parent c9554803fa
commit f68e16c5fc
26 changed files with 590 additions and 3 deletions

View File

@@ -559,6 +559,31 @@ void wxHtmlWinParser::SetDC(wxDC *dc, double pixel_scale, double font_scale)
m_FontScale = font_scale;
}
void wxHtmlWinParser::SetFontPointSize(int pt)
{
if (pt <= m_FontsSizes[0])
m_FontSize = 1;
else if (pt >= m_FontsSizes[6])
m_FontSize = 7;
else
{
// Find the font closest to the given value with a simple linear search
// (binary search is not worth it here for so small number of elements)
for ( int n = 0; n < 6; n++ )
{
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;
break;
}
}
}
}
wxFont* wxHtmlWinParser::CreateCurrentFont()
{