X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/e52cac90cda8f499169a247e7f23c985b16a70e6..5ea6dbbfff67d1dfad08044ab721ba56425ef6e1:/src/html/htmlcell.cpp?ds=sidebyside diff --git a/src/html/htmlcell.cpp b/src/html/htmlcell.cpp index eab1485438..e8680be944 100644 --- a/src/html/htmlcell.cpp +++ b/src/html/htmlcell.cpp @@ -73,20 +73,26 @@ bool wxHtmlCell::AdjustPagebreak(int *pagebreak) wxHtmlWordCell::wxHtmlWordCell(const wxString& word, wxDC& dc) : wxHtmlCell() { m_Word = word; - - m_Word.Replace(wxT(" "), wxT(" "), TRUE); - m_Word.Replace(wxT("©"), wxT("(c)"), TRUE); - m_Word.Replace(wxT("""), wxT("\""), TRUE); - m_Word.Replace(wxT("<"), wxT("<"), TRUE); - m_Word.Replace(wxT(">"), wxT(">"), TRUE); - m_Word.Replace(wxT("&"), wxT("&"), TRUE); - - m_Word.Replace(wxT("  "), wxT(" "), TRUE); - m_Word.Replace(wxT("© "), wxT("(c)"), TRUE); - m_Word.Replace(wxT("" "), wxT("\""), TRUE); - m_Word.Replace(wxT("< "), wxT("<"), TRUE); - m_Word.Replace(wxT("> "), wxT(">"), TRUE); - m_Word.Replace(wxT("& "), wxT("&"), TRUE); + + if (m_Word.Find(wxT('&')) != -1) + { + static wxChar* substitutions[][3] = + { + { wxT(" "), wxT("  "), wxT(" ") }, + { wxT("©"), wxT("© "), wxT("(c)") }, + { wxT("""), wxT("" "), wxT("\"") }, + { wxT("<"), wxT("< "), wxT("<") }, + { wxT(">"), wxT("> "), wxT(">") }, + { wxT("&"), wxT("& "), wxT("&") /*this one should be last one*/ }, + { NULL, NULL, NULL } + }; + + for (int i = 0; substitutions[i][0] != NULL; i++) + { + m_Word.Replace(substitutions[i][0], substitutions[i][2], TRUE); + m_Word.Replace(substitutions[i][1], substitutions[i][2], TRUE); + } + } dc.GetTextExtent(m_Word, &m_Width, &m_Height, &m_Descent); SetCanLiveOnPagebreak(FALSE); @@ -384,7 +390,7 @@ void wxHtmlContainerCell::SetAlign(const wxHtmlTag& tag) -void wxHtmlContainerCell::SetWidthFloat(const wxHtmlTag& tag) +void wxHtmlContainerCell::SetWidthFloat(const wxHtmlTag& tag, double pixel_scale) { if (tag.HasParam("WIDTH")) { int wdi; @@ -396,7 +402,7 @@ void wxHtmlContainerCell::SetWidthFloat(const wxHtmlTag& tag) } else { wxSscanf(wd.c_str(), wxT("%i"), &wdi); - SetWidthFloat(wdi, wxHTML_UNITS_PIXELS); + SetWidthFloat((int)(pixel_scale * (double)wdi), wxHTML_UNITS_PIXELS); } } }