diff options
-rw-r--r-- | canvas/source/cairo/cairo_textlayout.cxx | 2 | ||||
-rw-r--r-- | canvas/source/directx/dx_textlayout_drawhelper.cxx | 2 | ||||
-rw-r--r-- | canvas/source/vcl/canvasfont.cxx | 4 | ||||
-rw-r--r-- | cppcanvas/source/mtfrenderer/mtftools.cxx | 8 | ||||
-rw-r--r-- | drawinglayer/source/primitive2d/textlayoutdevice.cxx | 6 | ||||
-rw-r--r-- | editeng/source/editeng/impedit3.cxx | 4 | ||||
-rw-r--r-- | include/vcl/metric.hxx | 11 | ||||
-rw-r--r-- | sc/source/ui/view/output2.cxx | 4 | ||||
-rw-r--r-- | starmath/source/rect.cxx | 4 | ||||
-rw-r--r-- | sw/source/core/inc/fntcache.hxx | 2 | ||||
-rw-r--r-- | sw/source/core/txtnode/fntcache.cxx | 14 | ||||
-rw-r--r-- | toolkit/source/helper/vclunohelper.cxx | 2 | ||||
-rw-r--r-- | vcl/inc/impfont.hxx | 7 | ||||
-rw-r--r-- | vcl/qa/cppunit/fontmetric.cxx | 21 | ||||
-rw-r--r-- | vcl/source/gdi/metric.cxx | 19 | ||||
-rw-r--r-- | vcl/source/outdev/font.cxx | 5 |
16 files changed, 74 insertions, 41 deletions
diff --git a/canvas/source/cairo/cairo_textlayout.cxx b/canvas/source/cairo/cairo_textlayout.cxx index 6c25dd8697de..735ebdf24b33 100644 --- a/canvas/source/cairo/cairo_textlayout.cxx +++ b/canvas/source/cairo/cairo_textlayout.cxx @@ -168,7 +168,7 @@ namespace cairocanvas setupLayoutMode( *pVDev.get(), mnTextDirection ); - const sal_Int32 nAboveBaseline( -aMetric.GetIntLeading() - aMetric.GetAscent() ); + const sal_Int32 nAboveBaseline( -aMetric.GetInternalLeading() - aMetric.GetAscent() ); const sal_Int32 nBelowBaseline( aMetric.GetDescent() ); if( maLogicalAdvancements.getLength() ) diff --git a/canvas/source/directx/dx_textlayout_drawhelper.cxx b/canvas/source/directx/dx_textlayout_drawhelper.cxx index 0d63181a175d..f96066787c6c 100644 --- a/canvas/source/directx/dx_textlayout_drawhelper.cxx +++ b/canvas/source/directx/dx_textlayout_drawhelper.cxx @@ -278,7 +278,7 @@ namespace dxcanvas // relative to baseline const ::FontMetric& aMetric( xVirtualDevice->GetFontMetric() ); - const sal_Int32 nAboveBaseline( -aMetric.GetIntLeading() - aMetric.GetAscent() ); + const sal_Int32 nAboveBaseline( -aMetric.GetInternalLeading() - aMetric.GetAscent() ); const sal_Int32 nBelowBaseline( aMetric.GetDescent() ); if( rLogicalAdvancements.getLength() ) diff --git a/canvas/source/vcl/canvasfont.cxx b/canvas/source/vcl/canvasfont.cxx index efb880945014..7a196b751468 100644 --- a/canvas/source/vcl/canvasfont.cxx +++ b/canvas/source/vcl/canvasfont.cxx @@ -126,8 +126,8 @@ namespace vclcanvas return rendering::FontMetrics( aMetric.GetAscent(), aMetric.GetDescent(), - aMetric.GetIntLeading(), - aMetric.GetExtLeading(), + aMetric.GetInternalLeading(), + aMetric.GetExternalLeading(), 0, aMetric.GetDescent() / 2.0, aMetric.GetAscent() / 2.0); diff --git a/cppcanvas/source/mtfrenderer/mtftools.cxx b/cppcanvas/source/mtfrenderer/mtftools.cxx index 43913529778e..b148e763e765 100644 --- a/cppcanvas/source/mtfrenderer/mtftools.cxx +++ b/cppcanvas/source/mtfrenderer/mtftools.cxx @@ -66,7 +66,7 @@ namespace cppcanvas { case ALIGN_TOP: return ::Size( 0, - aMetric.GetIntLeading() + aMetric.GetAscent() ); + aMetric.GetInternalLeading() + aMetric.GetAscent() ); default: ENSURE_OR_THROW( false, @@ -243,10 +243,10 @@ namespace cppcanvas TextLineInfo aTextInfo( (aMetric.GetDescent() + 2) / 4.0, - ((aMetric.GetIntLeading() + 1.5) / 3.0), - (aMetric.GetIntLeading() / 2.0) - aMetric.GetAscent(), + ((aMetric.GetInternalLeading() + 1.5) / 3.0), + (aMetric.GetInternalLeading() / 2.0) - aMetric.GetAscent(), aMetric.GetDescent() / 2.0, - (aMetric.GetIntLeading() - aMetric.GetAscent()) / 3.0, + (aMetric.GetInternalLeading() - aMetric.GetAscent()) / 3.0, rState.textOverlineStyle, rState.textUnderlineStyle, rState.textStrikeoutStyle ); diff --git a/drawinglayer/source/primitive2d/textlayoutdevice.cxx b/drawinglayer/source/primitive2d/textlayoutdevice.cxx index 5356785fc4dd..ee7df1f3c161 100644 --- a/drawinglayer/source/primitive2d/textlayoutdevice.cxx +++ b/drawinglayer/source/primitive2d/textlayoutdevice.cxx @@ -183,7 +183,7 @@ namespace drawinglayer double TextLayouterDevice::getOverlineOffset() const { const ::FontMetric& rMetric = mrDevice.GetFontMetric(); - double fRet = (rMetric.GetIntLeading() / 2.0) - rMetric.GetAscent(); + double fRet = (rMetric.GetInternalLeading() / 2.0) - rMetric.GetAscent(); return fRet; } @@ -197,14 +197,14 @@ namespace drawinglayer double TextLayouterDevice::getStrikeoutOffset() const { const ::FontMetric& rMetric = mrDevice.GetFontMetric(); - double fRet = (rMetric.GetAscent() - rMetric.GetIntLeading()) / 3.0; + double fRet = (rMetric.GetAscent() - rMetric.GetInternalLeading()) / 3.0; return fRet; } double TextLayouterDevice::getOverlineHeight() const { const ::FontMetric& rMetric = mrDevice.GetFontMetric(); - double fRet = rMetric.GetIntLeading() / 2.5; + double fRet = rMetric.GetInternalLeading() / 2.5; return fRet; } diff --git a/editeng/source/editeng/impedit3.cxx b/editeng/source/editeng/impedit3.cxx index 5c1ab994d74c..fac9787daa03 100644 --- a/editeng/source/editeng/impedit3.cxx +++ b/editeng/source/editeng/impedit3.cxx @@ -2827,7 +2827,7 @@ void ImpEditEngine::RecalcFormatterFontMetrics( FormatterFontMetric& rCurMetrics nAscent = (sal_uInt16)aMetric.GetAscent(); if ( IsAddExtLeading() ) nAscent = sal::static_int_cast< sal_uInt16 >( - nAscent + aMetric.GetExtLeading() ); + nAscent + aMetric.GetExternalLeading() ); nDescent = (sal_uInt16)aMetric.GetDescent(); if ( IsFixedCellHeight() ) @@ -2837,7 +2837,7 @@ void ImpEditEngine::RecalcFormatterFontMetrics( FormatterFontMetric& rCurMetrics } else { - sal_uInt16 nIntLeading = ( aMetric.GetIntLeading() > 0 ) ? (sal_uInt16)aMetric.GetIntLeading() : 0; + sal_uInt16 nIntLeading = ( aMetric.GetInternalLeading() > 0 ) ? (sal_uInt16)aMetric.GetInternalLeading() : 0; // Fonts without leading cause problems if ( ( nIntLeading == 0 ) && ( pRefDev->GetOutDevType() == OUTDEV_PRINTER ) ) { diff --git a/include/vcl/metric.hxx b/include/vcl/metric.hxx index 7b3694d54cd5..2c8d9f24b3af 100644 --- a/include/vcl/metric.hxx +++ b/include/vcl/metric.hxx @@ -48,12 +48,15 @@ public: long GetAscent() const; long GetDescent() const; - long GetIntLeading() const; - long GetExtLeading() const; + long GetInternalLeading() const; + long GetExternalLeading() const; long GetLineHeight() const; long GetSlant() const; long GetBulletOffset() const; + void SetExternalLeading(long); + void SetInternalLeading(long); + bool IsScalable() const; bool IsFullstopCentered() const; bool IsBuiltInFont() const; @@ -79,8 +82,8 @@ inline std::basic_ostream<charT, traits> & operator <<( << ",size=(" << rMetric.GetSize().Width() << "," << rMetric.GetSize().Height() << ")" << ",ascent=" << rMetric.GetAscent() << ",descent=" << rMetric.GetDescent() - << ",intLeading=" << rMetric.GetIntLeading() - << ",extLeading=" << rMetric.GetExtLeading() + << ",intLeading=" << rMetric.GetInternalLeading() + << ",extLeading=" << rMetric.GetExternalLeading() << ",lineHeight=" << rMetric.GetLineHeight() << ",slant=" << rMetric.GetSlant() << "}"; diff --git a/sc/source/ui/view/output2.cxx b/sc/source/ui/view/output2.cxx index f7b9801b850c..39577bbeb92b 100644 --- a/sc/source/ui/view/output2.cxx +++ b/sc/source/ui/view/output2.cxx @@ -246,7 +246,7 @@ void ScDrawStringsVars::SetShrinkScale( long nScale, SvtScriptType nScript ) pFmtDevice->SetFont( aFont ); aMetric = pFmtDevice->GetFontMetric(); - if ( pFmtDevice->GetOutDevType() == OUTDEV_PRINTER && aMetric.GetIntLeading() == 0 ) + if ( pFmtDevice->GetOutDevType() == OUTDEV_PRINTER && aMetric.GetInternalLeading() == 0 ) { OutputDevice* pDefaultDev = Application::GetDefaultDevice(); MapMode aOld = pDefaultDev->GetMapMode(); @@ -392,7 +392,7 @@ void ScDrawStringsVars::SetPattern( // if there is the leading 0 on a printer device, we have problems // -> take metric from the screen (as for EditEngine!) - if ( pFmtDevice->GetOutDevType() == OUTDEV_PRINTER && aMetric.GetIntLeading() == 0 ) + if ( pFmtDevice->GetOutDevType() == OUTDEV_PRINTER && aMetric.GetInternalLeading() == 0 ) { OutputDevice* pDefaultDev = Application::GetDefaultDevice(); MapMode aOld = pDefaultDev->GetMapMode(); diff --git a/starmath/source/rect.cxx b/starmath/source/rect.cxx index a0c8c67058f6..7e430252a14f 100644 --- a/starmath/source/rect.cxx +++ b/starmath/source/rect.cxx @@ -150,7 +150,7 @@ void SmRect::BuildRect(const OutputDevice &rDev, const SmFormat *pFormat, // workaround for printer fonts with very small (possible 0 or even // negative(!)) leading - if (aFM.GetIntLeading() < 5 && rDev.GetOutDevType() == OUTDEV_PRINTER) + if (aFM.GetInternalLeading() < 5 && rDev.GetOutDevType() == OUTDEV_PRINTER) { OutputDevice *pWindow = Application::GetDefaultDevice(); @@ -159,7 +159,7 @@ void SmRect::BuildRect(const OutputDevice &rDev, const SmFormat *pFormat, pWindow->SetMapMode(rDev.GetMapMode()); pWindow->SetFont(rDev.GetFontMetric()); - long nDelta = pWindow->GetFontMetric().GetIntLeading(); + long nDelta = pWindow->GetFontMetric().GetInternalLeading(); if (nDelta == 0) { // this value approx. fits a Leading of 80 at a // Fontheight of 422 (12pt) diff --git a/sw/source/core/inc/fntcache.hxx b/sw/source/core/inc/fntcache.hxx index ed634e5d43b7..7d5dc0aa16e9 100644 --- a/sw/source/core/inc/fntcache.hxx +++ b/sw/source/core/inc/fntcache.hxx @@ -93,7 +93,7 @@ public: inline const vcl::Font& GetFont() const { return aFont; } inline sal_uInt16 GetGuessedLeading() const { return nGuessedLeading; } - inline sal_uInt16 GetExtLeading() const { return nExtLeading; } + inline sal_uInt16 GetExternalLeading() const { return nExtLeading; } sal_uInt16 GetFontAscent( const SwViewShell *pSh, const OutputDevice& rOut ); sal_uInt16 GetFontHeight( const SwViewShell *pSh, const OutputDevice& rOut ); diff --git a/sw/source/core/txtnode/fntcache.cxx b/sw/source/core/txtnode/fntcache.cxx index 0fe25b3f53c2..abd97f7ed2a4 100644 --- a/sw/source/core/txtnode/fntcache.cxx +++ b/sw/source/core/txtnode/fntcache.cxx @@ -360,7 +360,7 @@ sal_uInt16 SwFntObj::GetFontLeading( const SwViewShell *pSh, const OutputDevice& ((OutputDevice&)rOut).SetFont( aOldFnt ); bSymbol = RTL_TEXTENCODING_SYMBOL == aMet.GetCharSet(); GuessLeading( *pSh, aMet ); - nExtLeading = static_cast<sal_uInt16>(aMet.GetExtLeading()); + nExtLeading = static_cast<sal_uInt16>(aMet.GetExternalLeading()); /* HACK: There is something wrong with Writer's bullet rendering, causing lines with bullets to be higher than they should be. I think this is because Writer uses font's external leading incorrect, as the vertical distance @@ -444,7 +444,7 @@ void SwFntObj::CreateScrFont( const SwViewShell& rSh, const OutputDevice& rOut ) GuessLeading( rSh, aMet ); if ( USHRT_MAX == nExtLeading ) - nExtLeading = static_cast<sal_uInt16>(aMet.GetExtLeading()); + nExtLeading = static_cast<sal_uInt16>(aMet.GetExternalLeading()); // reset the original reference device font pPrt->SetFont( aOldPrtFnt ); @@ -497,7 +497,7 @@ void SwFntObj::GuessLeading( const SwViewShell& { // If leading >= 5, this seems to be enough leading. // Nothing has to be done. - if ( rMet.GetIntLeading() >= 5 ) + if ( rMet.GetInternalLeading() >= 5 ) { nGuessedLeading = 0; return; @@ -520,11 +520,11 @@ void SwFntObj::GuessLeading( const SwViewShell& { // If the Leading on the Window is also 0, then it has to stay // that way (see also StarMath). - long nTmpLeading = (long)aWinMet.GetIntLeading(); + long nTmpLeading = (long)aWinMet.GetInternalLeading(); if( nTmpLeading <= 0 ) { pWin->SetFont( rMet ); - nTmpLeading = (long)pWin->GetFontMetric().GetIntLeading(); + nTmpLeading = (long)pWin->GetFontMetric().GetInternalLeading(); if( nTmpLeading < 0 ) nGuessedLeading = 0; else @@ -1857,7 +1857,7 @@ Size SwFntObj::GetTextSize( SwDrawTextInfo& rInf ) pOutDev->GetTextWidth( rInf.GetText(), rInf.GetIdx(), nLn ); OSL_ENSURE( !rInf.GetShell() || - ( USHRT_MAX != GetGuessedLeading() && USHRT_MAX != GetExtLeading() ), + ( USHRT_MAX != GetGuessedLeading() && USHRT_MAX != GetExternalLeading() ), "Leading values should be already calculated" ); aTextSize.Height() = pOutDev->GetTextHeight() + GetFontLeading( rInf.GetShell(), rInf.GetOut() ); @@ -2014,7 +2014,7 @@ Size SwFntObj::GetTextSize( SwDrawTextInfo& rInf ) aTextSize.Width() += ( nLn - 1 ) * long( rInf.GetKern() ); OSL_ENSURE( !rInf.GetShell() || - ( USHRT_MAX != GetGuessedLeading() && USHRT_MAX != GetExtLeading() ), + ( USHRT_MAX != GetGuessedLeading() && USHRT_MAX != GetExternalLeading() ), "Leading values should be already calculated" ); aTextSize.Height() += GetFontLeading( rInf.GetShell(), rInf.GetOut() ); return aTextSize; diff --git a/toolkit/source/helper/vclunohelper.cxx b/toolkit/source/helper/vclunohelper.cxx index f657be072c44..20043e6614f3 100644 --- a/toolkit/source/helper/vclunohelper.cxx +++ b/toolkit/source/helper/vclunohelper.cxx @@ -434,7 +434,7 @@ css::awt::SimpleFontMetric VCLUnoHelper::CreateFontMetric( const FontMetric& rFo css::awt::SimpleFontMetric aFM; aFM.Ascent = (sal_Int16)rFontMetric.GetAscent(); aFM.Descent = (sal_Int16)rFontMetric.GetDescent(); - aFM.Leading = (sal_Int16)rFontMetric.GetIntLeading(); + aFM.Leading = (sal_Int16)rFontMetric.GetInternalLeading(); aFM.Slant = (sal_Int16)rFontMetric.GetSlant(); aFM.FirstChar = 0x0020; aFM.LastChar = 0xFFFD; diff --git a/vcl/inc/impfont.hxx b/vcl/inc/impfont.hxx index 2988f4cc77c0..0b9577a2b801 100644 --- a/vcl/inc/impfont.hxx +++ b/vcl/inc/impfont.hxx @@ -117,12 +117,15 @@ public: long GetAscent() const { return mnAscent; } long GetDescent() const { return mnDescent; } - long GetIntLeading() const { return mnIntLeading; } - long GetExtLeading() const { return mnExtLeading; } + long GetInternalLeading() const { return mnIntLeading; } + long GetExternalLeading() const { return mnExtLeading; } long GetLineHeight() const { return mnLineHeight; } long GetSlant() const { return mnSlant; } long GetBulletOffset() const { return mnBulletOffset; } + void SetInternalLeading( long nIntLeading ) { mnIntLeading = nIntLeading; } + void SetExternalLeading( long nExtLeading ) { mnExtLeading = nExtLeading; } + bool IsScalable() const { return mbScalableFont; } bool IsFullstopCentered() const { return mbFullstopCentered; } bool IsBuiltInFont() const { return mbDevice; } diff --git a/vcl/qa/cppunit/fontmetric.cxx b/vcl/qa/cppunit/fontmetric.cxx index f434ae04487c..316e03d3a8a4 100644 --- a/vcl/qa/cppunit/fontmetric.cxx +++ b/vcl/qa/cppunit/fontmetric.cxx @@ -78,17 +78,32 @@ void VclFontMetricTest::testEqualityOperator() aLhs.SetScalableFlag(true); aRhs.SetScalableFlag(true); - CPPUNIT_ASSERT_MESSAGE( "Scalable flag set same", aLhs == aRhs ); + CPPUNIT_ASSERT_MESSAGE( "Scalable flag set same, aLhs == aRhs failed", aLhs == aRhs ); + CPPUNIT_ASSERT_MESSAGE( "Scalable flag set same, aLhs != aRhs succeeded", !(aLhs != aRhs) ); aLhs.SetFullstopCenteredFlag(true); aRhs.SetFullstopCenteredFlag(true); - CPPUNIT_ASSERT_MESSAGE( "Scalable font flag set same", aLhs == aRhs ); + CPPUNIT_ASSERT_MESSAGE( "Fullstop centered flag set same, aLhs == aRhs failed", aLhs == aRhs ); + CPPUNIT_ASSERT_MESSAGE( "Fullstop centered flag set same, aLhs != aRhs succeeded", !(aLhs != aRhs) ); aLhs.SetBuiltInFontFlag(true); aRhs.SetBuiltInFontFlag(true); - CPPUNIT_ASSERT_MESSAGE( "Scalable font flag set same", aLhs == aRhs ); + CPPUNIT_ASSERT_MESSAGE( "Builtin font flag set same, aLHS == aRhs failed", aLhs == aRhs ); + CPPUNIT_ASSERT_MESSAGE( "Builtin font flag set same, aLHS != aRhs succeeded", !(aLhs != aRhs) ); + + aLhs.SetExternalLeading(10); + aRhs.SetExternalLeading(10); + + CPPUNIT_ASSERT_MESSAGE( "External leading set same, aLHS == aRhs failed", aLhs == aRhs ); + CPPUNIT_ASSERT_MESSAGE( "External leading set same, aLHS != aRhs succeeded", !(aLhs != aRhs) ); + + aLhs.SetInternalLeading(10); + aRhs.SetInternalLeading(10); + + CPPUNIT_ASSERT_MESSAGE( "Internal leading set same, aLHS == aRhs failed", aLhs == aRhs ); + CPPUNIT_ASSERT_MESSAGE( "Internal leading set same, aLHS != aRhs succeeded", !(aLhs != aRhs) ); } diff --git a/vcl/source/gdi/metric.cxx b/vcl/source/gdi/metric.cxx index dd867d8cdaaf..1227a4aed19c 100644 --- a/vcl/source/gdi/metric.cxx +++ b/vcl/source/gdi/metric.cxx @@ -128,14 +128,24 @@ long FontMetric::GetDescent() const return mpImplMetric->GetDescent(); } -long FontMetric::GetIntLeading() const +long FontMetric::GetInternalLeading() const { - return mpImplMetric->GetIntLeading(); + return mpImplMetric->GetInternalLeading(); } -long FontMetric::GetExtLeading() const +void FontMetric::SetInternalLeading( long nLeading ) { - return mpImplMetric->GetExtLeading(); + mpImplMetric->SetInternalLeading( nLeading ); +} + +long FontMetric::GetExternalLeading() const +{ + return mpImplMetric->GetExternalLeading(); +} + +void FontMetric::SetExternalLeading( long nLeading ) +{ + mpImplMetric->SetExternalLeading( nLeading ); } long FontMetric::GetLineHeight() const @@ -182,4 +192,5 @@ void FontMetric::SetBuiltInFontFlag( bool bIsBuiltInFont ) { mpImplMetric->SetBuiltInFontFlag( bIsBuiltInFont ); } + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/source/outdev/font.cxx b/vcl/source/outdev/font.cxx index 39ff77457415..0fbf52e4880a 100644 --- a/vcl/source/outdev/font.cxx +++ b/vcl/source/outdev/font.cxx @@ -218,8 +218,9 @@ FontMetric OutputDevice::GetFontMetric() const aMetric.mpImplMetric->mnBulletOffset = pFontAttributes->GetBulletOffset(); aMetric.mpImplMetric->mnAscent = ImplDevicePixelToLogicHeight( pFontAttributes->GetAscent() + mnEmphasisAscent ); aMetric.mpImplMetric->mnDescent = ImplDevicePixelToLogicHeight( pFontAttributes->GetDescent() + mnEmphasisDescent ); - aMetric.mpImplMetric->mnIntLeading = ImplDevicePixelToLogicHeight( pFontAttributes->GetInternalLeading() + mnEmphasisAscent ); - aMetric.mpImplMetric->mnExtLeading = ImplDevicePixelToLogicHeight( GetFontExtLeading() ); + aMetric.SetInternalLeading( ImplDevicePixelToLogicHeight( pFontAttributes->GetInternalLeading() + mnEmphasisAscent ) ); + // OutputDevice has its own external leading function due to #i60945# + aMetric.SetExternalLeading( ImplDevicePixelToLogicHeight( GetFontExtLeading() ) ); aMetric.mpImplMetric->mnLineHeight = ImplDevicePixelToLogicHeight( pFontAttributes->GetAscent() + pFontAttributes->GetDescent() + mnEmphasisAscent + mnEmphasisDescent ); aMetric.mpImplMetric->mnSlant = ImplDevicePixelToLogicHeight( pFontAttributes->GetSlant() ); |