From 519194a1372657a15203806ad7e0bc5149868448 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Caol=C3=A1n=20McNamara?= Date: Tue, 29 Mar 2011 15:07:07 +0100 Subject: [PATCH] fix up patch --- ...4580-X-and-strike-through-escapes-ra.patch | 57 +++++++------------ 1 file changed, 22 insertions(+), 35 deletions(-) diff --git a/0001-Resolves-rhbz-684580-X-and-strike-through-escapes-ra.patch b/0001-Resolves-rhbz-684580-X-and-strike-through-escapes-ra.patch index 85c3dec..52b46da 100644 --- a/0001-Resolves-rhbz-684580-X-and-strike-through-escapes-ra.patch +++ b/0001-Resolves-rhbz-684580-X-and-strike-through-escapes-ra.patch @@ -13,7 +13,7 @@ diff --git a/vcl/source/gdi/outdev3.cxx b/vcl/source/gdi/outdev3.cxx index 02febe3..d43c163 100644 --- a/vcl/source/gdi/outdev3.cxx +++ b/vcl/source/gdi/outdev3.cxx -@@ -4005,6 +4005,11 @@ void OutputDevice::ImplDrawStrikeoutChar( long nBaseX, long nBaseY, +@@ -3967,6 +3967,11 @@ FontStrikeout eStrikeout, Color aColor ) { @@ -25,50 +25,37 @@ index 02febe3..d43c163 100644 // PDF-export does its own strikeout drawing... why again? if( mpPDFWriter && mpPDFWriter->isBuiltinFont(mpFontEntry->maFontSelData.mpFontData) ) return; -@@ -4017,35 +4022,23 @@ void OutputDevice::ImplDrawStrikeoutChar( long nBaseX, long nBaseY, - cStrikeoutChar = 'X'; - static const int nTestStrLen = 4; - static const int nMaxStrikeStrLen = 2048; -- xub_Unicode aChars[ nMaxStrikeStrLen +1]; // +1 for valgrind... -+ xub_Unicode aChars[nMaxStrikeStrLen+1]; // +1 for valgrind... - for( int i = 0; i < nTestStrLen; ++i) +@@ -3984,25 +3989,7 @@ aChars[i] = cStrikeoutChar; const String aStrikeoutTest( aChars, nTestStrLen ); - // calculate approximation of strikeout atom size +- // calculate approximation of strikeout atom size - long nStrikeoutWidth = nWidth; -+ long nStrikeoutWidth = 0; - SalLayout* pLayout = ImplLayout( aStrikeoutTest, 0, nTestStrLen ); - if( pLayout ) - { +- SalLayout* pLayout = ImplLayout( aStrikeoutTest, 0, nTestStrLen ); +- if( pLayout ) +- { - nStrikeoutWidth = (pLayout->GetTextWidth() +nTestStrLen/2) / (nTestStrLen * pLayout->GetUnitsPerPixel()); -+ nStrikeoutWidth = pLayout->GetTextWidth() / (nTestStrLen * pLayout->GetUnitsPerPixel()); - pLayout->Release(); - } - if( nStrikeoutWidth <= 0 ) // sanity check - return; - +- pLayout->Release(); +- } +- if( nStrikeoutWidth <= 0 ) // sanity check +- return; +- - // calculate acceptable strikeout length - // allow the strikeout to be one pixel larger than the text it strikes out -- long nMaxWidth = nStrikeoutWidth * 3 / 4; +- long nMaxWidth = nStrikeoutWidth / 2; - if ( nMaxWidth < 2 ) - nMaxWidth = 2; - nMaxWidth += nWidth + 1; - -- int nStrikeStrLen = (nMaxWidth - 1) / nStrikeoutWidth; -- // if the text width is smaller than the strikeout text, then do not -- // strike out at all. This case requires user interaction, e.g. adding -- // a space to the text -- if( nStrikeStrLen <= 0 ) -- return; +- int nStrikeStrLen = (nMaxWidth + nStrikeoutWidth - 1) / nStrikeoutWidth; + int nStrikeStrLen = (nWidth+(nStrikeoutWidth-1)) / nStrikeoutWidth; - if( nStrikeStrLen > nMaxStrikeStrLen ) - nStrikeStrLen = nMaxStrikeStrLen; - -@@ -4074,8 +4067,29 @@ void OutputDevice::ImplDrawStrikeoutChar( long nBaseX, long nBaseY, + // if the text width is smaller than the strikeout text, then do not + // strike out at all. This case requires user interaction, e.g. adding + // a space to the text +@@ -4034,8 +4021,28 @@ ImplInitTextColor(); - pLayout->DrawBase() = Point( nBaseX+mnTextOffX, nBaseY+mnTextOffY ); + pLayout->DrawBase() = Point( nX+mnTextOffX, nY+mnTextOffY ); + + Rectangle aPixelRect; + aPixelRect.nLeft = nBaseX+mnTextOffX; @@ -89,7 +76,6 @@ index 02febe3..d43c163 100644 + ImplInitClipRegion(); + pLayout->DrawText( *mpGraphics ); -+ pLayout->Release(); + Pop(); @@ -99,7 +85,7 @@ diff --git a/vcl/source/gdi/pdfwriter_impl.cxx b/vcl/source/gdi/pdfwriter_impl.c index 442a25d..485dad3 100644 --- a/vcl/source/gdi/pdfwriter_impl.cxx +++ b/vcl/source/gdi/pdfwriter_impl.cxx -@@ -8264,6 +8264,9 @@ void PDFWriterImpl::drawStrikeoutLine( OStringBuffer& aLine, long nWidth, FontSt +@@ -8223,6 +8223,9 @@ void PDFWriterImpl::drawStrikeoutChar( const Point& rPos, long nWidth, FontStrikeout eStrikeout ) { @@ -109,9 +95,9 @@ index 442a25d..485dad3 100644 String aStrikeoutChar = String::CreateFromAscii( eStrikeout == STRIKEOUT_SLASH ? "/" : "X" ); String aStrikeout = aStrikeoutChar; while( m_pReferenceDevice->GetTextWidth( aStrikeout ) < nWidth ) -@@ -8285,7 +8288,27 @@ void PDFWriterImpl::drawStrikeoutChar( const Point& rPos, long nWidth, FontStrik +@@ -8244,7 +8247,28 @@ // strikeout string is left aligned non-CTL text - sal_uLong nOrigTLM = m_pReferenceDevice->GetLayoutMode(); + ULONG nOrigTLM = m_pReferenceDevice->GetLayoutMode(); m_pReferenceDevice->SetLayoutMode( TEXT_LAYOUT_BIDI_STRONG|TEXT_LAYOUT_COMPLEX_DISABLED ); + + push( PUSH_CLIPREGION ); @@ -131,6 +117,7 @@ index 442a25d..485dad3 100644 + } + + intersectClipRegion( aRect ); ++ drawText( rPos, aStrikeout, 0, aStrikeout.Len(), false ); + pop(); +