X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/4f9297b0eead20a0bfee71df18e0d8f0cbc402fb..f0b22b4a039b5797b94ecde35e2b67f6716c9e84:/src/html/winpars.cpp?ds=sidebyside diff --git a/src/html/winpars.cpp b/src/html/winpars.cpp index b5f8b1ec68..e90c35f723 100644 --- a/src/html/winpars.cpp +++ b/src/html/winpars.cpp @@ -197,10 +197,12 @@ void wxHtmlWinParser::AddText(const char* txt) char temp[wxHTML_BUFLEN]; register char d; int templen = 0; - + if (m_tmpLastWasSpace) { - while ((i < lng) && ((txt[i] == '\n') || (txt[i] == '\r') || (txt[i] == ' ') || (txt[i] == '\t'))) i++; + while ((i < lng) && + ((txt[i] == '\n') || (txt[i] == '\r') || (txt[i] == ' ') || + (txt[i] == '\t'))) i++; } while (i < lng) @@ -210,7 +212,8 @@ void wxHtmlWinParser::AddText(const char* txt) if ((d == '\n') || (d == '\r') || (d == ' ') || (d == '\t')) { i++, x++; - while ((i < lng) && ((txt[i] == '\n') || (txt[i] == '\r') || (txt[i] == ' ') || (txt[i] == '\t'))) i++, x++; + while ((i < lng) && ((txt[i] == '\n') || (txt[i] == '\r') || + (txt[i] == ' ') || (txt[i] == '\t'))) i++, x++; } else i++; @@ -219,9 +222,11 @@ void wxHtmlWinParser::AddText(const char* txt) temp[templen-1] = ' '; temp[templen] = 0; templen = 0; - if (m_EncConv) m_EncConv->Convert(temp); - c = new wxHtmlWordCell(temp, *(GetDC())); - if (m_UseLink) c->SetLink(m_Link); + if (m_EncConv) + m_EncConv->Convert(temp); + c = new wxHtmlWordCell(GetEntitiesParser()->Parse(temp), *(GetDC())); + if (m_UseLink) + c->SetLink(m_Link); m_Container->InsertCell(c); m_tmpLastWasSpace = TRUE; } @@ -229,9 +234,11 @@ void wxHtmlWinParser::AddText(const char* txt) if (templen) { temp[templen] = 0; - if (m_EncConv) m_EncConv->Convert(temp); - c = new wxHtmlWordCell(temp, *(GetDC())); - if (m_UseLink) c->SetLink(m_Link); + if (m_EncConv) + m_EncConv->Convert(temp); + c = new wxHtmlWordCell(GetEntitiesParser()->Parse(temp), *(GetDC())); + if (m_UseLink) + c->SetLink(m_Link); m_Container->InsertCell(c); m_tmpLastWasSpace = FALSE; } @@ -299,7 +306,7 @@ wxFont* wxHtmlWinParser::CreateCurrentFont() *faceptr = face; *encptr = m_OutputEnc; *fontptr = new wxFont( - m_FontsSizes[fs] * m_PixelScale, + (int) (m_FontsSizes[fs] * m_PixelScale), ff ? wxMODERN : wxSWISS, fi ? wxITALIC : wxNORMAL, fb ? wxBOLD : wxNORMAL, @@ -333,7 +340,11 @@ void wxHtmlWinParser::SetFontFace(const wxString& face) void wxHtmlWinParser::SetInputEncoding(wxFontEncoding enc) { m_InputEnc = m_OutputEnc = wxFONTENCODING_DEFAULT; - if (m_EncConv) {delete m_EncConv; m_EncConv = NULL;} + if (m_EncConv) + { + delete m_EncConv; + m_EncConv = NULL; + } if (enc == wxFONTENCODING_DEFAULT) return; @@ -363,6 +374,10 @@ void wxHtmlWinParser::SetInputEncoding(wxFontEncoding enc) m_OutputEnc = wxFONTENCODING_DEFAULT; m_InputEnc = enc; + if (m_OutputEnc == wxFONTENCODING_DEFAULT) + GetEntitiesParser()->SetEncoding(wxFONTENCODING_SYSTEM); + else + GetEntitiesParser()->SetEncoding(m_OutputEnc); if (m_InputEnc == m_OutputEnc) return;