X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/848c4eb27bacb870d97385560124970b84ee4d72..cdf0ff0ff1dc0a587fe1d304653cddcc3e6f7432:/src/html/htmlcell.cpp diff --git a/src/html/htmlcell.cpp b/src/html/htmlcell.cpp index 8ea2197716..2846a430b7 100644 --- a/src/html/htmlcell.cpp +++ b/src/html/htmlcell.cpp @@ -296,8 +296,17 @@ void wxHtmlWordCell::Split(wxDC& dc, pt1.x = 0; if ( pt2.y >= m_Height ) pt2.x = m_Width; - +#ifdef __WXMAC__ + // implementation using PartialExtents to support fractional widths + wxArrayInt widths ; + dc.GetPartialTextExtents(m_Word,widths) ; +#endif + // before selection: +#ifdef __WXMAC__ + while( i < len && pt1.x >= widths[i] ) + i++ ; +#else while ( pt1.x > 0 && i < len ) { dc.GetTextExtent(m_Word[i], &charW, &charH); @@ -308,9 +317,14 @@ void wxHtmlWordCell::Split(wxDC& dc, i++; } } +#endif // in selection: unsigned j = i; +#ifdef __WXMAC__ + while( j < len && pt2.x >= widths[j] ) + j++ ; +#else pos2 = pos1; pt2.x -= pos2; while ( pt2.x > 0 && j < len ) @@ -323,6 +337,7 @@ void wxHtmlWordCell::Split(wxDC& dc, j++; } } +#endif pos1 = i; pos2 = j; @@ -729,7 +744,7 @@ void wxHtmlContainerCell::Layout(int w) } while (nextCell && !nextCell->IsLinebreakAllowed()); } - // force new line if occured: + // force new line if occurred: if ((cell == NULL) || (xpos + nextWordWidth > s_width && cell->IsLinebreakAllowed())) { @@ -1237,7 +1252,8 @@ void wxHtmlContainerCell::RemoveExtraSpacing(bool top, bool bottom) cont = (wxHtmlContainerCell*)c; if ( IsEmptyContainer(cont) ) { - cont->SetIndent(0, wxHTML_INDENT_VERTICAL); } + cont->SetIndent(0, wxHTML_INDENT_VERTICAL); + } else { cont->RemoveExtraSpacing(false, true);