Kaydet (Commit) 17714047 authored tarafından Frank Meies's avatar Frank Meies

#99282# CTL - Replaced GetGlyphBoundRect by GetTextBoundRect for drop caps

üst 46862b54
...@@ -2,9 +2,9 @@ ...@@ -2,9 +2,9 @@
* *
* $RCSfile: txtdrop.cxx,v $ * $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 * The Contents of this file are made available subject to the terms of
* either of the following licenses * either of the following licenses
...@@ -853,12 +853,10 @@ void SwDropCapCache::CalcFontSize( SwDropPortion* pDrop, SwTxtFormatInfo &rInf ) ...@@ -853,12 +853,10 @@ void SwDropCapCache::CalcFontSize( SwDropPortion* pDrop, SwTxtFormatInfo &rInf )
pCurrPart = pDrop->GetPart(); pCurrPart = pDrop->GetPart();
sal_Bool bFirstGlyphRect = sal_True; sal_Bool bFirstGlyphRect = sal_True;
sal_Bool bHaveGlyphRect = sal_False; sal_Bool bHaveGlyphRect = sal_False;
Rectangle aCommonRect, aTmp, aRect; Rectangle aCommonRect, aRect;
while ( pCurrPart ) while ( pCurrPart )
{ {
XubString aTmpStr( rInf.GetTxt(), nIdx, pCurrPart->GetLen() );
// current font // current font
SwFont& rFnt = pCurrPart->GetFont(); SwFont& rFnt = pCurrPart->GetFont();
...@@ -878,21 +876,9 @@ void SwDropCapCache::CalcFontSize( SwDropPortion* pDrop, SwTxtFormatInfo &rInf ) ...@@ -878,21 +876,9 @@ void SwDropCapCache::CalcFontSize( SwDropPortion* pDrop, SwTxtFormatInfo &rInf )
rFnt.GetLeading( rInf.GetVsh(), pOut ); rFnt.GetLeading( rInf.GetVsh(), pOut );
// Wir besorgen uns das alle Buchstaben umfassende Rechteck: // Wir besorgen uns das alle Buchstaben umfassende Rechteck:
bHaveGlyphRect = sal_False; bHaveGlyphRect = pOut->GetTextBoundRect( aRect, rInf.GetTxt(), 0,
for ( xub_StrLen i = 0; i < pCurrPart->GetLen(); i++ ) nIdx, pCurrPart->GetLen() ) &&
{ ! aRect.IsEmpty();
if( pOut->GetGlyphBoundRect( aTmpStr.GetChar(i), aTmp, sal_False )
&& !aTmp.IsEmpty() )
{
if ( bHaveGlyphRect )
aRect.Union( aTmp );
else
{
aRect = aTmp;
bHaveGlyphRect = sal_True;
}
}
}
if ( ! bHaveGlyphRect ) if ( ! bHaveGlyphRect )
{ {
...@@ -909,20 +895,9 @@ void SwDropCapCache::CalcFontSize( SwDropPortion* pDrop, SwTxtFormatInfo &rInf ) ...@@ -909,20 +895,9 @@ void SwDropCapCache::CalcFontSize( SwDropPortion* pDrop, SwTxtFormatInfo &rInf )
} }
pWin->SetFont( rFnt.GetActualFont() ); pWin->SetFont( rFnt.GetActualFont() );
for ( xub_StrLen i = 0; i < pCurrPart->GetLen(); i++ ) bHaveGlyphRect = pWin->GetTextBoundRect( aRect, rInf.GetTxt(), 0,
{ nIdx, pCurrPart->GetLen() ) &&
if( pWin->GetGlyphBoundRect( aTmpStr.GetChar(i), aTmp, sal_False ) ! aRect.IsEmpty();
&& !aTmp.IsEmpty() )
{
if ( bHaveGlyphRect )
aRect.Union( aTmp );
else
{
aRect = aTmp;
bHaveGlyphRect = sal_True;
}
}
}
} }
if ( bHaveGlyphRect ) if ( bHaveGlyphRect )
{ {
...@@ -943,23 +918,6 @@ void SwDropCapCache::CalcFontSize( SwDropPortion* pDrop, SwTxtFormatInfo &rInf ) ...@@ -943,23 +918,6 @@ void SwDropCapCache::CalcFontSize( SwDropPortion* pDrop, SwTxtFormatInfo &rInf )
rFnt.SetSize( aOldSize, rFnt.GetActual() ); rFnt.SetSize( aOldSize, rFnt.GetActual() );
rFnt.SetProportion( nOldProp ); 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 ) if ( bFirstGlyphRect )
{ {
aCommonRect = aRect; aCommonRect = aRect;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment