X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/4f9297b0eead20a0bfee71df18e0d8f0cbc402fb..acc0ebd7a871124d4d6b36069340227e6c584f38:/src/html/winpars.cpp diff --git a/src/html/winpars.cpp b/src/html/winpars.cpp index b5f8b1ec68..ce9bd29032 100644 --- a/src/html/winpars.cpp +++ b/src/html/winpars.cpp @@ -22,7 +22,8 @@ #endif #ifndef WXPRECOMP -#include "wx/wx.h" + #include "wx/intl.h" + #include "wx/dc.h" #endif #include "wx/html/htmldefs.h" @@ -197,10 +198,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 +213,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 +223,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 +235,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 +307,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 +341,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 +375,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;