diff options
-rw-r--r-- | include/vcl/metric.hxx | 1 | ||||
-rw-r--r-- | sw/source/core/txtnode/fntcache.cxx | 22 | ||||
-rw-r--r-- | vcl/inc/impfont.hxx | 2 | ||||
-rw-r--r-- | vcl/inc/outfont.hxx | 1 | ||||
-rw-r--r-- | vcl/source/gdi/metric.cxx | 6 | ||||
-rw-r--r-- | vcl/source/outdev/font.cxx | 5 |
6 files changed, 37 insertions, 0 deletions
diff --git a/include/vcl/metric.hxx b/include/vcl/metric.hxx index ddf27eb85455..fd3759a76eba 100644 --- a/include/vcl/metric.hxx +++ b/include/vcl/metric.hxx @@ -73,6 +73,7 @@ public: long GetLineHeight() const; long GetSlant() const; bool IsFullstopCentered() const; + long GetBulletOffset() const; FontMetric& operator=( const FontMetric& rMetric ); bool operator==( const FontMetric& rMetric ) const; diff --git a/sw/source/core/txtnode/fntcache.cxx b/sw/source/core/txtnode/fntcache.cxx index f8189328cff6..1b5ebbde0ade 100644 --- a/sw/source/core/txtnode/fntcache.cxx +++ b/sw/source/core/txtnode/fntcache.cxx @@ -1781,6 +1781,28 @@ void SwFntObj::DrawText( SwDrawTextInfo &rInf ) pTmpFont->SetOverline(UNDERLINE_NONE); pTmpFont->SetStrikeout(STRIKEOUT_NONE); rInf.GetOut().SetFont( *pTmpFont ); + long nShift = rInf.GetOut( ).GetFontMetric( ).GetBulletOffset( ); + if ( nShift ) + { + long nAdd = 0; + + if (aBulletOverlay.getLength() > nTmpIdx && + aBulletOverlay[ nTmpIdx ] == CH_BULLET ) + { + if (bSwitchH2V) + aTextOriginPos.Y() += nShift ; + else + aTextOriginPos.X() += nShift ; + nAdd = nShift ; + } + for( sal_Int32 i = 1 ; i < nLen ; ++i ) + { + if ( aBulletOverlay[ i + nTmpIdx ] == CH_BULLET ) + pKernArray [ i - 1 ] += nShift ; + if ( nAdd ) + pKernArray [ i - 1 ] -= nAdd; + } + } rInf.GetOut().DrawTextArray( aTextOriginPos, aBulletOverlay, pKernArray + nOffs, nTmpIdx + nOffs , nLen - nOffs ); pTmpFont->SetColor( aPreviousColor ); diff --git a/vcl/inc/impfont.hxx b/vcl/inc/impfont.hxx index ab2bd21ffe0d..1ed1e41560c9 100644 --- a/vcl/inc/impfont.hxx +++ b/vcl/inc/impfont.hxx @@ -100,6 +100,7 @@ private: long mnExtLeading; // External Leading long mnLineHeight; // Ascent+Descent+EmphasisMark long mnSlant; // Slant + long mnBulletOffset;// Offset for non-priting character sal_uInt16 mnMiscFlags; // Misc Flags sal_uInt32 mnRefCount; // Reference Counter @@ -118,6 +119,7 @@ public: long GetSlant() const { return mnSlant; } bool IsFullstopCentered() const { return ((mnMiscFlags & FULLSTOP_CENTERED_FLAG ) != 0); } + long GetBulletOffset() const { return mnBulletOffset; } bool IsScalable() const { return ((mnMiscFlags & SCALABLE_FLAG) != 0); } bool operator==( const ImplFontMetric& ) const; diff --git a/vcl/inc/outfont.hxx b/vcl/inc/outfont.hxx index 8eef436fa757..d34473b9cc21 100644 --- a/vcl/inc/outfont.hxx +++ b/vcl/inc/outfont.hxx @@ -176,6 +176,7 @@ public: // TODO: hide members behind accessor methods bool mbTrueTypeFont; bool mbKernableFont; bool mbFullstopCentered; + long mnBulletOffset; // Offset to position non-print character // font metrics that are usually derived from the measurements long mnUnderlineSize; // Lineheight of Underline diff --git a/vcl/source/gdi/metric.cxx b/vcl/source/gdi/metric.cxx index 05630c63f895..bf671af3321a 100644 --- a/vcl/source/gdi/metric.cxx +++ b/vcl/source/gdi/metric.cxx @@ -32,6 +32,7 @@ ImplFontMetric::ImplFontMetric() mnExtLeading( 0 ), mnLineHeight( 0 ), mnSlant( 0 ), + mnBulletOffset( 0 ), mnMiscFlags( 0 ), mnRefCount( 1 ) {} @@ -156,6 +157,11 @@ bool FontMetric::IsFullstopCentered() const return mpImplMetric->IsFullstopCentered(); } +long FontMetric::GetBulletOffset() const +{ + return mpImplMetric->GetBulletOffset(); +} + FontMetric& FontMetric::operator =( const FontMetric& rMetric ) { vcl::FontInfo::operator=( rMetric ); diff --git a/vcl/source/outdev/font.cxx b/vcl/source/outdev/font.cxx index f2885f0813e8..d8c9ce2074ec 100644 --- a/vcl/source/outdev/font.cxx +++ b/vcl/source/outdev/font.cxx @@ -218,6 +218,7 @@ FontMetric OutputDevice::GetFontMetric() const aMetric.mpImplMetric->mnMiscFlags |= ImplFontMetric::SCALABLE_FLAG; if ( pMetric->mbFullstopCentered) aMetric.mpImplMetric->mnMiscFlags |= ImplFontMetric::FULLSTOP_CENTERED_FLAG; + aMetric.mpImplMetric->mnBulletOffset= pMetric->mnBulletOffset; aMetric.mpImplMetric->mnAscent = ImplDevicePixelToLogicHeight( pMetric->mnAscent+mnEmphasisAscent ); aMetric.mpImplMetric->mnDescent = ImplDevicePixelToLogicHeight( pMetric->mnDescent+mnEmphasisDescent ); aMetric.mpImplMetric->mnIntLeading = ImplDevicePixelToLogicHeight( pMetric->mnIntLeading+mnEmphasisAscent ); @@ -1752,6 +1753,7 @@ ImplFontMetricData::ImplFontMetricData( const FontSelectPattern& rFontSelData ) , mbScalableFont(false) , mbTrueTypeFont(false) , mbFullstopCentered(false) + , mnBulletOffset( 0 ) , mnUnderlineSize( 0 ) , mnUnderlineOffset( 0 ) , mnBUnderlineSize( 0 ) @@ -1894,6 +1896,9 @@ void ImplFontMetricData::ImplInitTextLineSize( const OutputDevice* pDev ) bCentered = nB > (((nH >> 1)+nH)>>3); } mbFullstopCentered = bCentered ; + + mnBulletOffset = ( pDev->GetTextWidth( OUString( sal_Unicode( 0x20 ) ) ) - pDev->GetTextWidth( OUString( sal_Unicode( 0xb7 ) ) ) ) >> 1 ; + } void ImplFontMetricData::ImplInitAboveTextLineSize() |