From 17714047583c7b55c9951846eadffdca98b1680f Mon Sep 17 00:00:00 2001 From: Frank Meies Date: Wed, 22 May 2002 06:40:48 +0000 Subject: [PATCH] #99282# CTL - Replaced GetGlyphBoundRect by GetTextBoundRect for drop caps --- sw/source/core/text/txtdrop.cxx | 60 +++++---------------------------- 1 file changed, 9 insertions(+), 51 deletions(-) diff --git a/sw/source/core/text/txtdrop.cxx b/sw/source/core/text/txtdrop.cxx index 921bf6e595a9..4c4417d35677 100644 --- a/sw/source/core/text/txtdrop.cxx +++ b/sw/source/core/text/txtdrop.cxx @@ -2,9 +2,9 @@ * * $RCSfile: txtdrop.cxx,v $ * - * $Revision: 1.10 $ + * $Revision: 1.11 $ * - * last change: $Author: os $ $Date: 2002-04-25 13:57:38 $ + * last change: $Author: fme $ $Date: 2002-05-22 07:40:48 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -853,12 +853,10 @@ void SwDropCapCache::CalcFontSize( SwDropPortion* pDrop, SwTxtFormatInfo &rInf ) pCurrPart = pDrop->GetPart(); sal_Bool bFirstGlyphRect = sal_True; sal_Bool bHaveGlyphRect = sal_False; - Rectangle aCommonRect, aTmp, aRect; + Rectangle aCommonRect, aRect; while ( pCurrPart ) { - XubString aTmpStr( rInf.GetTxt(), nIdx, pCurrPart->GetLen() ); - // current font SwFont& rFnt = pCurrPart->GetFont(); @@ -878,21 +876,9 @@ void SwDropCapCache::CalcFontSize( SwDropPortion* pDrop, SwTxtFormatInfo &rInf ) rFnt.GetLeading( rInf.GetVsh(), pOut ); // Wir besorgen uns das alle Buchstaben umfassende Rechteck: - bHaveGlyphRect = sal_False; - for ( xub_StrLen i = 0; i < pCurrPart->GetLen(); i++ ) - { - if( pOut->GetGlyphBoundRect( aTmpStr.GetChar(i), aTmp, sal_False ) - && !aTmp.IsEmpty() ) - { - if ( bHaveGlyphRect ) - aRect.Union( aTmp ); - else - { - aRect = aTmp; - bHaveGlyphRect = sal_True; - } - } - } + bHaveGlyphRect = pOut->GetTextBoundRect( aRect, rInf.GetTxt(), 0, + nIdx, pCurrPart->GetLen() ) && + ! aRect.IsEmpty(); if ( ! bHaveGlyphRect ) { @@ -909,20 +895,9 @@ void SwDropCapCache::CalcFontSize( SwDropPortion* pDrop, SwTxtFormatInfo &rInf ) } pWin->SetFont( rFnt.GetActualFont() ); - for ( xub_StrLen i = 0; i < pCurrPart->GetLen(); i++ ) - { - if( pWin->GetGlyphBoundRect( aTmpStr.GetChar(i), aTmp, sal_False ) - && !aTmp.IsEmpty() ) - { - if ( bHaveGlyphRect ) - aRect.Union( aTmp ); - else - { - aRect = aTmp; - bHaveGlyphRect = sal_True; - } - } - } + bHaveGlyphRect = pWin->GetTextBoundRect( aRect, rInf.GetTxt(), 0, + nIdx, pCurrPart->GetLen() ) && + ! aRect.IsEmpty(); } if ( bHaveGlyphRect ) { @@ -943,23 +918,6 @@ void SwDropCapCache::CalcFontSize( SwDropPortion* pDrop, SwTxtFormatInfo &rInf ) rFnt.SetSize( aOldSize, rFnt.GetActual() ); rFnt.SetProportion( nOldProp ); - // shift aRect to have baseline 0 -#ifdef VERTICAL_LAYOUT - if ( rInf.GetTxtFrm()->IsVertical() ) - { - aRect.Right() += nAscent; - aRect.Left() += nAscent; - } - else - { - aRect.Top() -= nAscent; - aRect.Bottom() -= nAscent; - } -#else - aRect.Top() -= nAscent; - aRect.Bottom() -= nAscent; -#endif - if ( bFirstGlyphRect ) { aCommonRect = aRect;