summaryrefslogtreecommitdiff
path: root/vcl/source
diff options
context:
space:
mode:
authorChris Sherlock <chris.sherlock79@gmail.com>2016-01-15 03:06:18 +1100
committerChris Sherlock <chris.sherlock79@gmail.com>2016-01-14 18:09:47 +0000
commit659db7d705835b8676065fb4fe3babe39d938977 (patch)
treef426e3f089449a855f51ac589865212eaef241ba /vcl/source
parentc5c47412d16b5bbdc79886ae9bf93d0158405d14 (diff)
vcl: change ImplFontMetricData to be reference counted via intrusive_ptr
Change-Id: Ie9f5fbd21a6223520cbea3af6436beb407d7a88c Reviewed-on: https://gerrit.libreoffice.org/21477 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Chris Sherlock <chris.sherlock79@gmail.com>
Diffstat (limited to 'vcl/source')
-rw-r--r--vcl/source/font/fontinstance.cxx3
-rw-r--r--vcl/source/font/fontmetric.cxx1
-rw-r--r--vcl/source/gdi/pdfwriter_impl.cxx84
-rw-r--r--vcl/source/gdi/print.cxx2
-rw-r--r--vcl/source/gdi/virdev.cxx5
-rw-r--r--vcl/source/outdev/font.cxx77
-rw-r--r--vcl/source/outdev/text.cxx8
-rw-r--r--vcl/source/outdev/textline.cxx62
8 files changed, 119 insertions, 123 deletions
diff --git a/vcl/source/font/fontinstance.cxx b/vcl/source/font/fontinstance.cxx
index 22fde5e09056..8415dd0390e3 100644
--- a/vcl/source/font/fontinstance.cxx
+++ b/vcl/source/font/fontinstance.cxx
@@ -82,7 +82,7 @@ namespace std
LogicalFontInstance::LogicalFontInstance( const FontSelectPattern& rFontSelData )
: mpFontCache(nullptr)
, maFontSelData( rFontSelData )
- , maFontMetric( rFontSelData )
+ , mxFontMetric( new ImplFontMetricData( rFontSelData ))
, mpConversion( nullptr )
, mnLineHeight( 0 )
, mnRefCount( 1 )
@@ -99,6 +99,7 @@ LogicalFontInstance::~LogicalFontInstance()
{
delete mpUnicodeFallbackList;
mpFontCache = nullptr;
+ mxFontMetric = nullptr;
}
void LogicalFontInstance::AddFallbackForUnicode( sal_UCS4 cChar, FontWeight eWeight, const OUString& rFontName )
diff --git a/vcl/source/font/fontmetric.cxx b/vcl/source/font/fontmetric.cxx
index 6cd5c31fce8e..3f27d62be13f 100644
--- a/vcl/source/font/fontmetric.cxx
+++ b/vcl/source/font/fontmetric.cxx
@@ -66,6 +66,7 @@ using namespace ::utl;
ImplFontMetricData::ImplFontMetricData( const FontSelectPattern& rFontSelData )
: FontAttributes( rFontSelData )
+ , mnRefCount ( 0 )
, mnWidth ( rFontSelData.mnWidth )
, mnOrientation( (short)(rFontSelData.mnOrientation) )
, mnAscent( 0 )
diff --git a/vcl/source/gdi/pdfwriter_impl.cxx b/vcl/source/gdi/pdfwriter_impl.cxx
index 05cc9bc31f09..69d8b50720f3 100644
--- a/vcl/source/gdi/pdfwriter_impl.cxx
+++ b/vcl/source/gdi/pdfwriter_impl.cxx
@@ -9168,18 +9168,18 @@ void PDFWriterImpl::drawLayout( SalLayout& rLayout, const OUString& rText, bool
Point aOffset = Point(0,0);
if ( nEmphMark & EMPHASISMARK_POS_BELOW )
- aOffset.Y() += m_pReferenceDevice->mpFontInstance->maFontMetric.GetDescent() + nEmphYOff;
+ aOffset.Y() += m_pReferenceDevice->mpFontInstance->mxFontMetric->GetDescent() + nEmphYOff;
else
- aOffset.Y() -= m_pReferenceDevice->mpFontInstance->maFontMetric.GetAscent() + nEmphYOff;
+ aOffset.Y() -= m_pReferenceDevice->mpFontInstance->mxFontMetric->GetAscent() + nEmphYOff;
long nEmphWidth2 = nEmphWidth / 2;
long nEmphHeight2 = nEmphHeight / 2;
aOffset += Point( nEmphWidth2, nEmphHeight2 );
if ( eAlign == ALIGN_BOTTOM )
- aOffset.Y() -= m_pReferenceDevice->mpFontInstance->maFontMetric.GetDescent();
+ aOffset.Y() -= m_pReferenceDevice->mpFontInstance->mxFontMetric->GetDescent();
else if ( eAlign == ALIGN_TOP )
- aOffset.Y() += m_pReferenceDevice->mpFontInstance->maFontMetric.GetAscent();
+ aOffset.Y() += m_pReferenceDevice->mpFontInstance->mxFontMetric->GetAscent();
for( int nStart = 0;;)
{
@@ -9497,17 +9497,17 @@ void PDFWriterImpl::drawWaveTextLine( OStringBuffer& aLine, long nWidth, FontUnd
if ( bIsAbove )
{
- if ( !pFontInstance->maFontMetric.GetAboveWavelineUnderlineSize() )
+ if ( !pFontInstance->mxFontMetric->GetAboveWavelineUnderlineSize() )
m_pReferenceDevice->ImplInitAboveTextLineSize();
- nLineHeight = HCONV( pFontInstance->maFontMetric.GetAboveWavelineUnderlineSize() );
- nLinePos = HCONV( pFontInstance->maFontMetric.GetAboveWavelineUnderlineOffset() );
+ nLineHeight = HCONV( pFontInstance->mxFontMetric->GetAboveWavelineUnderlineSize() );
+ nLinePos = HCONV( pFontInstance->mxFontMetric->GetAboveWavelineUnderlineOffset() );
}
else
{
- if ( !pFontInstance->maFontMetric.GetWavelineUnderlineSize() )
+ if ( !pFontInstance->mxFontMetric->GetWavelineUnderlineSize() )
m_pReferenceDevice->ImplInitTextLineSize();
- nLineHeight = HCONV( pFontInstance->maFontMetric.GetWavelineUnderlineSize() );
- nLinePos = HCONV( pFontInstance->maFontMetric.GetWavelineUnderlineOffset() );
+ nLineHeight = HCONV( pFontInstance->mxFontMetric->GetWavelineUnderlineSize() );
+ nLinePos = HCONV( pFontInstance->mxFontMetric->GetWavelineUnderlineOffset() );
}
if ( (eTextLine == UNDERLINE_SMALLWAVE) && (nLineHeight > 3) )
nLineHeight = 3;
@@ -9576,17 +9576,17 @@ void PDFWriterImpl::drawStraightTextLine( OStringBuffer& aLine, long nWidth, Fon
case UNDERLINE_DASHDOTDOT:
if ( bIsAbove )
{
- if ( !pFontInstance->maFontMetric.GetAboveUnderlineSize() )
+ if ( !pFontInstance->mxFontMetric->GetAboveUnderlineSize() )
m_pReferenceDevice->ImplInitAboveTextLineSize();
- nLineHeight = HCONV( pFontInstance->maFontMetric.GetAboveUnderlineSize() );
- nLinePos = HCONV( pFontInstance->maFontMetric.GetAboveUnderlineOffset() );
+ nLineHeight = HCONV( pFontInstance->mxFontMetric->GetAboveUnderlineSize() );
+ nLinePos = HCONV( pFontInstance->mxFontMetric->GetAboveUnderlineOffset() );
}
else
{
- if ( !pFontInstance->maFontMetric.GetUnderlineSize() )
+ if ( !pFontInstance->mxFontMetric->GetUnderlineSize() )
m_pReferenceDevice->ImplInitTextLineSize();
- nLineHeight = HCONV( pFontInstance->maFontMetric.GetUnderlineSize() );
- nLinePos = HCONV( pFontInstance->maFontMetric.GetUnderlineOffset() );
+ nLineHeight = HCONV( pFontInstance->mxFontMetric->GetUnderlineSize() );
+ nLinePos = HCONV( pFontInstance->mxFontMetric->GetUnderlineOffset() );
}
break;
case UNDERLINE_BOLD:
@@ -9597,36 +9597,36 @@ void PDFWriterImpl::drawStraightTextLine( OStringBuffer& aLine, long nWidth, Fon
case UNDERLINE_BOLDDASHDOTDOT:
if ( bIsAbove )
{
- if ( !pFontInstance->maFontMetric.GetAboveBoldUnderlineSize() )
+ if ( !pFontInstance->mxFontMetric->GetAboveBoldUnderlineSize() )
m_pReferenceDevice->ImplInitAboveTextLineSize();
- nLineHeight = HCONV( pFontInstance->maFontMetric.GetAboveBoldUnderlineSize() );
- nLinePos = HCONV( pFontInstance->maFontMetric.GetAboveBoldUnderlineOffset() );
+ nLineHeight = HCONV( pFontInstance->mxFontMetric->GetAboveBoldUnderlineSize() );
+ nLinePos = HCONV( pFontInstance->mxFontMetric->GetAboveBoldUnderlineOffset() );
}
else
{
- if ( !pFontInstance->maFontMetric.GetBoldUnderlineSize() )
+ if ( !pFontInstance->mxFontMetric->GetBoldUnderlineSize() )
m_pReferenceDevice->ImplInitTextLineSize();
- nLineHeight = HCONV( pFontInstance->maFontMetric.GetBoldUnderlineSize() );
- nLinePos = HCONV( pFontInstance->maFontMetric.GetBoldUnderlineOffset() );
+ nLineHeight = HCONV( pFontInstance->mxFontMetric->GetBoldUnderlineSize() );
+ nLinePos = HCONV( pFontInstance->mxFontMetric->GetBoldUnderlineOffset() );
nLinePos += nLineHeight/2;
}
break;
case UNDERLINE_DOUBLE:
if ( bIsAbove )
{
- if ( !pFontInstance->maFontMetric.GetAboveDoubleUnderlineSize() )
+ if ( !pFontInstance->mxFontMetric->GetAboveDoubleUnderlineSize() )
m_pReferenceDevice->ImplInitAboveTextLineSize();
- nLineHeight = HCONV( pFontInstance->maFontMetric.GetAboveDoubleUnderlineSize() );
- nLinePos = HCONV( pFontInstance->maFontMetric.GetAboveDoubleUnderlineOffset1() );
- nLinePos2 = HCONV( pFontInstance->maFontMetric.GetAboveDoubleUnderlineOffset2() );
+ nLineHeight = HCONV( pFontInstance->mxFontMetric->GetAboveDoubleUnderlineSize() );
+ nLinePos = HCONV( pFontInstance->mxFontMetric->GetAboveDoubleUnderlineOffset1() );
+ nLinePos2 = HCONV( pFontInstance->mxFontMetric->GetAboveDoubleUnderlineOffset2() );
}
else
{
- if ( !pFontInstance->maFontMetric.GetDoubleUnderlineSize() )
+ if ( !pFontInstance->mxFontMetric->GetDoubleUnderlineSize() )
m_pReferenceDevice->ImplInitTextLineSize();
- nLineHeight = HCONV( pFontInstance->maFontMetric.GetDoubleUnderlineSize() );
- nLinePos = HCONV( pFontInstance->maFontMetric.GetDoubleUnderlineOffset1() );
- nLinePos2 = HCONV( pFontInstance->maFontMetric.GetDoubleUnderlineOffset2() );
+ nLineHeight = HCONV( pFontInstance->mxFontMetric->GetDoubleUnderlineSize() );
+ nLinePos = HCONV( pFontInstance->mxFontMetric->GetDoubleUnderlineOffset1() );
+ nLinePos2 = HCONV( pFontInstance->mxFontMetric->GetDoubleUnderlineOffset2() );
}
break;
default:
@@ -9739,23 +9739,23 @@ void PDFWriterImpl::drawStrikeoutLine( OStringBuffer& aLine, long nWidth, FontSt
switch ( eStrikeout )
{
case STRIKEOUT_SINGLE:
- if ( !pFontInstance->maFontMetric.GetStrikeoutSize() )
+ if ( !pFontInstance->mxFontMetric->GetStrikeoutSize() )
m_pReferenceDevice->ImplInitTextLineSize();
- nLineHeight = HCONV( pFontInstance->maFontMetric.GetStrikeoutSize() );
- nLinePos = HCONV( pFontInstance->maFontMetric.GetStrikeoutOffset() );
+ nLineHeight = HCONV( pFontInstance->mxFontMetric->GetStrikeoutSize() );
+ nLinePos = HCONV( pFontInstance->mxFontMetric->GetStrikeoutOffset() );
break;
case STRIKEOUT_BOLD:
- if ( !pFontInstance->maFontMetric.GetBoldStrikeoutSize() )
+ if ( !pFontInstance->mxFontMetric->GetBoldStrikeoutSize() )
m_pReferenceDevice->ImplInitTextLineSize();
- nLineHeight = HCONV( pFontInstance->maFontMetric.GetBoldStrikeoutSize() );
- nLinePos = HCONV( pFontInstance->maFontMetric.GetBoldStrikeoutOffset() );
+ nLineHeight = HCONV( pFontInstance->mxFontMetric->GetBoldStrikeoutSize() );
+ nLinePos = HCONV( pFontInstance->mxFontMetric->GetBoldStrikeoutOffset() );
break;
case STRIKEOUT_DOUBLE:
- if ( !pFontInstance->maFontMetric.GetDoubleStrikeoutSize() )
+ if ( !pFontInstance->mxFontMetric->GetDoubleStrikeoutSize() )
m_pReferenceDevice->ImplInitTextLineSize();
- nLineHeight = HCONV( pFontInstance->maFontMetric.GetDoubleStrikeoutSize() );
- nLinePos = HCONV( pFontInstance->maFontMetric.GetDoubleStrikeoutOffset1() );
- nLinePos2 = HCONV( pFontInstance->maFontMetric.GetDoubleStrikeoutOffset2() );
+ nLineHeight = HCONV( pFontInstance->mxFontMetric->GetDoubleStrikeoutSize() );
+ nLinePos = HCONV( pFontInstance->mxFontMetric->GetDoubleStrikeoutOffset1() );
+ nLinePos2 = HCONV( pFontInstance->mxFontMetric->GetDoubleStrikeoutOffset2() );
break;
default:
break;
@@ -9876,9 +9876,9 @@ void PDFWriterImpl::drawTextLine( const Point& rPos, long nWidth, FontStrikeout
Point aPos( rPos );
TextAlign eAlign = m_aCurrentPDFState.m_aFont.GetAlign();
if( eAlign == ALIGN_TOP )
- aPos.Y() += HCONV( pFontInstance->maFontMetric.GetAscent() );
+ aPos.Y() += HCONV( pFontInstance->mxFontMetric->GetAscent() );
else if( eAlign == ALIGN_BOTTOM )
- aPos.Y() -= HCONV( pFontInstance->maFontMetric.GetDescent() );
+ aPos.Y() -= HCONV( pFontInstance->mxFontMetric->GetDescent() );
OStringBuffer aLine( 512 );
// save GS
diff --git a/vcl/source/gdi/print.cxx b/vcl/source/gdi/print.cxx
index fcb25d5f4f25..9ce0c72e3dba 100644
--- a/vcl/source/gdi/print.cxx
+++ b/vcl/source/gdi/print.cxx
@@ -1817,7 +1817,7 @@ void Printer::InitFont() const
void Printer::SetFontOrientation( LogicalFontInstance* const pFontEntry ) const
{
- pFontEntry->mnOrientation = pFontEntry->maFontMetric.GetOrientation();
+ pFontEntry->mnOrientation = pFontEntry->mxFontMetric->GetOrientation();
}
void Printer::DrawImage( const Point&, const Image&, DrawImageFlags )
diff --git a/vcl/source/gdi/virdev.cxx b/vcl/source/gdi/virdev.cxx
index 8e426ea988e9..a83f88f1df63 100644
--- a/vcl/source/gdi/virdev.cxx
+++ b/vcl/source/gdi/virdev.cxx
@@ -564,10 +564,7 @@ long VirtualDevice::GetFontExtLeading() const
return 0;
#endif
- LogicalFontInstance* pFontInstance = mpFontInstance;
- ImplFontMetricData* pFontMetric = &(pFontInstance->maFontMetric);
-
- return pFontMetric->GetExternalLeading();
+ return mpFontInstance->mxFontMetric->GetExternalLeading();
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/source/outdev/font.cxx b/vcl/source/outdev/font.cxx
index f85fcc89d8ee..ce87da9b6244 100644
--- a/vcl/source/outdev/font.cxx
+++ b/vcl/source/outdev/font.cxx
@@ -189,43 +189,45 @@ FontMetric OutputDevice::GetFontMetric() const
return aMetric;
LogicalFontInstance* pFontInstance = mpFontInstance;
- ImplFontMetricData* pFontMetric = &(pFontInstance->maFontMetric);
+ ImplFontMetricDataPtr xFontMetric = pFontInstance->mxFontMetric;
// prepare metric
aMetric.Font::operator=( maFont );
// set aMetric with info from font
aMetric.SetName( maFont.GetName() );
- aMetric.SetStyleName( pFontMetric->GetStyleName() );
- aMetric.SetSize( PixelToLogic( Size( pFontMetric->GetWidth(), pFontMetric->GetAscent() + pFontMetric->GetDescent() - pFontMetric->GetInternalLeading() ) ) );
- aMetric.SetCharSet( pFontMetric->IsSymbolFont() ? RTL_TEXTENCODING_SYMBOL : RTL_TEXTENCODING_UNICODE );
- aMetric.SetFamily( pFontMetric->GetFamilyType() );
- aMetric.SetPitch( pFontMetric->GetPitch() );
- aMetric.SetWeight( pFontMetric->GetWeight() );
- aMetric.SetItalic( pFontMetric->GetSlantType() );
- aMetric.SetWidthType( pFontMetric->GetWidthType() );
+ aMetric.SetStyleName( xFontMetric->GetStyleName() );
+ aMetric.SetSize( PixelToLogic( Size( xFontMetric->GetWidth(), xFontMetric->GetAscent() + xFontMetric->GetDescent() - xFontMetric->GetInternalLeading() ) ) );
+ aMetric.SetCharSet( xFontMetric->IsSymbolFont() ? RTL_TEXTENCODING_SYMBOL : RTL_TEXTENCODING_UNICODE );
+ aMetric.SetFamily( xFontMetric->GetFamilyType() );
+ aMetric.SetPitch( xFontMetric->GetPitch() );
+ aMetric.SetWeight( xFontMetric->GetWeight() );
+ aMetric.SetItalic( xFontMetric->GetSlantType() );
+ aMetric.SetWidthType( xFontMetric->GetWidthType() );
if ( pFontInstance->mnOwnOrientation )
aMetric.SetOrientation( pFontInstance->mnOwnOrientation );
else
- aMetric.SetOrientation( pFontMetric->GetOrientation() );
- if( !pFontInstance->maFontMetric.IsKernable() )
+ aMetric.SetOrientation( xFontMetric->GetOrientation() );
+ if( !pFontInstance->mxFontMetric->IsKernable() )
aMetric.SetKerning( maFont.GetKerning() & ~FontKerning::FontSpecific );
// set remaining metric fields
- aMetric.SetBuiltInFontFlag( pFontMetric->IsBuiltInFont() );
- aMetric.SetScalableFlag( pFontMetric->IsScalable() );
- aMetric.SetFullstopCenteredFlag( pFontMetric->IsFullstopCentered() );
- aMetric.SetBulletOffset( pFontMetric->GetBulletOffset() );
- aMetric.SetAscent( ImplDevicePixelToLogicHeight( pFontMetric->GetAscent() + mnEmphasisAscent ) );
- aMetric.SetDescent( ImplDevicePixelToLogicHeight( pFontMetric->GetDescent() + mnEmphasisDescent ) );
- aMetric.SetInternalLeading( ImplDevicePixelToLogicHeight( pFontMetric->GetInternalLeading() + mnEmphasisAscent ) );
+ aMetric.SetBuiltInFontFlag( xFontMetric->IsBuiltInFont() );
+ aMetric.SetScalableFlag( xFontMetric->IsScalable() );
+ aMetric.SetFullstopCenteredFlag( xFontMetric->IsFullstopCentered() );
+ aMetric.SetBulletOffset( xFontMetric->GetBulletOffset() );
+ aMetric.SetAscent( ImplDevicePixelToLogicHeight( xFontMetric->GetAscent() + mnEmphasisAscent ) );
+ aMetric.SetDescent( ImplDevicePixelToLogicHeight( xFontMetric->GetDescent() + mnEmphasisDescent ) );
+ aMetric.SetInternalLeading( ImplDevicePixelToLogicHeight( xFontMetric->GetInternalLeading() + mnEmphasisAscent ) );
// OutputDevice has its own external leading function due to #i60945#
aMetric.SetExternalLeading( ImplDevicePixelToLogicHeight( GetFontExtLeading() ) );
- aMetric.SetLineHeight( ImplDevicePixelToLogicHeight( pFontMetric->GetAscent() + pFontMetric->GetDescent() + mnEmphasisAscent + mnEmphasisDescent ) );
- aMetric.SetSlant( ImplDevicePixelToLogicHeight( pFontMetric->GetSlant() ) );
+ aMetric.SetLineHeight( ImplDevicePixelToLogicHeight( xFontMetric->GetAscent() + xFontMetric->GetDescent() + mnEmphasisAscent + mnEmphasisDescent ) );
+ aMetric.SetSlant( ImplDevicePixelToLogicHeight( xFontMetric->GetSlant() ) );
SAL_INFO("vcl.gdi.fontmetric", "OutputDevice::GetFontMetric:" << aMetric);
+ xFontMetric = nullptr;
+
return aMetric;
}
@@ -481,10 +483,7 @@ FontEmphasisMark OutputDevice::ImplGetEmphasisMarkStyle( const vcl::Font& rFont
long OutputDevice::GetFontExtLeading() const
{
- LogicalFontInstance* pFontInstance = mpFontInstance;
- ImplFontMetricData* pFontMetric = &(pFontInstance->maFontMetric);
-
- return pFontMetric->GetExternalLeading();
+ return mpFontInstance->mxFontMetric->GetExternalLeading();
}
void OutputDevice::ImplClearFontData( const bool bNewFontLists )
@@ -1099,13 +1098,13 @@ bool OutputDevice::ImplNewFont() const
{
pFontInstance->mbInit = true;
- pFontInstance->maFontMetric.SetOrientation( sal::static_int_cast<short>(pFontInstance->maFontSelData.mnOrientation) );
- pGraphics->GetFontMetric( &(pFontInstance->maFontMetric) );
+ pFontInstance->mxFontMetric->SetOrientation( sal::static_int_cast<short>(pFontInstance->maFontSelData.mnOrientation) );
+ pGraphics->GetFontMetric( pFontInstance->mxFontMetric );
- pFontInstance->maFontMetric.ImplInitTextLineSize( this );
- pFontInstance->maFontMetric.ImplInitAboveTextLineSize();
+ pFontInstance->mxFontMetric->ImplInitTextLineSize( this );
+ pFontInstance->mxFontMetric->ImplInitAboveTextLineSize();
- pFontInstance->mnLineHeight = pFontInstance->maFontMetric.GetAscent() + pFontInstance->maFontMetric.GetDescent();
+ pFontInstance->mnLineHeight = pFontInstance->mxFontMetric->GetAscent() + pFontInstance->mxFontMetric->GetDescent();
SetFontOrientation( pFontInstance );
}
@@ -1115,7 +1114,7 @@ bool OutputDevice::ImplNewFont() const
if ( maFont.GetKerning() & FontKerning::FontSpecific )
{
// TODO: test if physical font supports kerning and disable if not
- if( pFontInstance->maFontMetric.IsKernable() )
+ if( pFontInstance->mxFontMetric->IsKernable() )
mbKerning = true;
}
else
@@ -1151,7 +1150,7 @@ bool OutputDevice::ImplNewFont() const
else if ( eAlign == ALIGN_TOP )
{
mnTextOffX = 0;
- mnTextOffY = +pFontInstance->maFontMetric.GetAscent() + mnEmphasisAscent;
+ mnTextOffY = +pFontInstance->mxFontMetric->GetAscent() + mnEmphasisAscent;
if ( pFontInstance->mnOrientation )
{
Point aOriginPt(0, 0);
@@ -1161,7 +1160,7 @@ bool OutputDevice::ImplNewFont() const
else // eAlign == ALIGN_BOTTOM
{
mnTextOffX = 0;
- mnTextOffY = -pFontInstance->maFontMetric.GetDescent() + mnEmphasisDescent;
+ mnTextOffY = -pFontInstance->mxFontMetric->GetDescent() + mnEmphasisDescent;
if ( pFontInstance->mnOrientation )
{
Point aOriginPt(0, 0);
@@ -1179,7 +1178,7 @@ bool OutputDevice::ImplNewFont() const
// #95414# fix for OLE objects which use scale factors very creatively
if( mbMap && !aSize.Width() )
{
- int nOrigWidth = pFontInstance->maFontMetric.GetWidth();
+ int nOrigWidth = pFontInstance->mxFontMetric->GetWidth();
float fStretch = (float)maMapRes.mnMapScNumX * maMapRes.mnMapScDenomY;
fStretch /= (float)maMapRes.mnMapScNumY * maMapRes.mnMapScDenomX;
int nNewWidth = (int)(nOrigWidth * fStretch + 0.5);
@@ -1200,14 +1199,14 @@ bool OutputDevice::ImplNewFont() const
void OutputDevice::SetFontOrientation( LogicalFontInstance* const pFontInstance ) const
{
- if( pFontInstance->maFontSelData.mnOrientation && !pFontInstance->maFontMetric.GetOrientation() )
+ if( pFontInstance->maFontSelData.mnOrientation && !pFontInstance->mxFontMetric->GetOrientation() )
{
pFontInstance->mnOwnOrientation = sal::static_int_cast<short>(pFontInstance->maFontSelData.mnOrientation);
pFontInstance->mnOrientation = pFontInstance->mnOwnOrientation;
}
else
{
- pFontInstance->mnOrientation = pFontInstance->maFontMetric.GetOrientation();
+ pFontInstance->mnOrientation = pFontInstance->mxFontMetric->GetOrientation();
}
}
@@ -1297,9 +1296,9 @@ void OutputDevice::ImplDrawEmphasisMarks( SalLayout& rSalLayout )
Point aOffset = Point(0,0);
if ( nEmphasisMark & EMPHASISMARK_POS_BELOW )
- aOffset.Y() += mpFontInstance->maFontMetric.GetDescent() + nEmphasisYOff;
+ aOffset.Y() += mpFontInstance->mxFontMetric->GetDescent() + nEmphasisYOff;
else
- aOffset.Y() -= mpFontInstance->maFontMetric.GetAscent() + nEmphasisYOff;
+ aOffset.Y() -= mpFontInstance->mxFontMetric->GetAscent() + nEmphasisYOff;
long nEmphasisWidth2 = nEmphasisWidth / 2;
long nEmphasisHeight2 = nEmphasisHeight / 2;
@@ -1460,9 +1459,7 @@ long OutputDevice::GetMinKashida() const
if( mbNewFont && !ImplNewFont() )
return 0;
- LogicalFontInstance* pFontInstance = mpFontInstance;
- ImplFontMetricData* pFontMetric = &(pFontInstance->maFontMetric);
- return ImplDevicePixelToLogicWidth( pFontMetric->GetMinKashida() );
+ return ImplDevicePixelToLogicWidth( mpFontInstance->mxFontMetric->GetMinKashida() );
}
sal_Int32 OutputDevice::ValidateKashidas ( const OUString& rTxt,
diff --git a/vcl/source/outdev/text.cxx b/vcl/source/outdev/text.cxx
index 912249a0eee8..1696ae2c3033 100644
--- a/vcl/source/outdev/text.cxx
+++ b/vcl/source/outdev/text.cxx
@@ -177,7 +177,7 @@ void OutputDevice::ImplDrawTextBackground( const SalLayout& rSalLayout )
mpGraphics->SetFillColor( ImplColorToSal( GetTextFillColor() ) );
mbInitFillColor = true;
- ImplDrawTextRect( nX, nY, 0, -(mpFontInstance->maFontMetric.GetAscent() + mnEmphasisAscent),
+ ImplDrawTextRect( nX, nY, 0, -(mpFontInstance->mxFontMetric->GetAscent() + mnEmphasisAscent),
nWidth,
mpFontInstance->mnLineHeight+mnEmphasisAscent+mnEmphasisDescent );
}
@@ -191,7 +191,7 @@ Rectangle OutputDevice::ImplGetTextBoundRect( const SalLayout& rSalLayout )
long nWidth = rSalLayout.GetTextWidth();
long nHeight = mpFontInstance->mnLineHeight + mnEmphasisAscent + mnEmphasisDescent;
- nY -= mpFontInstance->maFontMetric.GetAscent() + mnEmphasisAscent;
+ nY -= mpFontInstance->mxFontMetric->GetAscent() + mnEmphasisAscent;
if ( mpFontInstance->mnOrientation )
{
@@ -232,7 +232,7 @@ bool OutputDevice::ImplDrawRotateText( SalLayout& rSalLayout )
{
// guess vertical text extents if GetBoundRect failed
int nRight = rSalLayout.GetTextWidth();
- int nTop = mpFontInstance->maFontMetric.GetAscent() + mnEmphasisAscent;
+ int nTop = mpFontInstance->mxFontMetric->GetAscent() + mnEmphasisAscent;
long nHeight = mpFontInstance->mnLineHeight + mnEmphasisAscent + mnEmphasisDescent;
aBoundRect = Rectangle( 0, -nTop, nRight, nHeight - nTop );
}
@@ -2621,7 +2621,7 @@ bool OutputDevice::GetTextBoundRect( Rectangle& rRect,
Point aTopLeft( nLeft, nTop );
aTopLeft -= aOffset;
// adjust to text alignment
- aTopLeft.Y()+= mnTextOffY - (mpFontInstance->maFontMetric.GetAscent() + mnEmphasisAscent);
+ aTopLeft.Y()+= mnTextOffY - (mpFontInstance->mxFontMetric->GetAscent() + mnEmphasisAscent);
// convert to logical coordinates
aSize = PixelToLogic( aSize );
aTopLeft.X() = ImplDevicePixelToLogicWidth( aTopLeft.X() );
diff --git a/vcl/source/outdev/textline.cxx b/vcl/source/outdev/textline.cxx
index 7e147d85e134..556004447776 100644
--- a/vcl/source/outdev/textline.cxx
+++ b/vcl/source/outdev/textline.cxx
@@ -56,12 +56,12 @@ bool OutputDevice::ImplIsUnderlineAbove( const vcl::Font& rFont )
void OutputDevice::ImplInitTextLineSize()
{
- mpFontInstance->maFontMetric.ImplInitTextLineSize( this );
+ mpFontInstance->mxFontMetric->ImplInitTextLineSize( this );
}
void OutputDevice::ImplInitAboveTextLineSize()
{
- mpFontInstance->maFontMetric.ImplInitAboveTextLineSize();
+ mpFontInstance->mxFontMetric->ImplInitAboveTextLineSize();
}
void OutputDevice::ImplDrawWavePixel( long nOriginX, long nOriginY,
@@ -221,13 +221,13 @@ void OutputDevice::ImplDrawWaveTextLine( long nBaseX, long nBaseY,
if ( bIsAbove )
{
- nLineHeight = pFontInstance->maFontMetric.GetAboveWavelineUnderlineSize();
- nLinePos = pFontInstance->maFontMetric.GetAboveWavelineUnderlineOffset();
+ nLineHeight = pFontInstance->mxFontMetric->GetAboveWavelineUnderlineSize();
+ nLinePos = pFontInstance->mxFontMetric->GetAboveWavelineUnderlineOffset();
}
else
{
- nLineHeight = pFontInstance->maFontMetric.GetWavelineUnderlineSize();
- nLinePos = pFontInstance->maFontMetric.GetWavelineUnderlineOffset();
+ nLineHeight = pFontInstance->mxFontMetric->GetWavelineUnderlineSize();
+ nLinePos = pFontInstance->mxFontMetric->GetWavelineUnderlineOffset();
}
if ( (eTextLine == UNDERLINE_SMALLWAVE) && (nLineHeight > 3) )
nLineHeight = 3;
@@ -303,13 +303,13 @@ void OutputDevice::ImplDrawStraightTextLine( long nBaseX, long nBaseY,
case UNDERLINE_DASHDOTDOT:
if ( bIsAbove )
{
- nLineHeight = pFontInstance->maFontMetric.GetAboveUnderlineSize();
- nLinePos = nY + pFontInstance->maFontMetric.GetAboveUnderlineOffset();
+ nLineHeight = pFontInstance->mxFontMetric->GetAboveUnderlineSize();
+ nLinePos = nY + pFontInstance->mxFontMetric->GetAboveUnderlineOffset();
}
else
{
- nLineHeight = pFontInstance->maFontMetric.GetUnderlineSize();
- nLinePos = nY + pFontInstance->maFontMetric.GetUnderlineOffset();
+ nLineHeight = pFontInstance->mxFontMetric->GetUnderlineSize();
+ nLinePos = nY + pFontInstance->mxFontMetric->GetUnderlineOffset();
}
break;
case UNDERLINE_BOLD:
@@ -320,27 +320,27 @@ void OutputDevice::ImplDrawStraightTextLine( long nBaseX, long nBaseY,
case UNDERLINE_BOLDDASHDOTDOT:
if ( bIsAbove )
{
- nLineHeight = pFontInstance->maFontMetric.GetAboveBoldUnderlineSize();
- nLinePos = nY + pFontInstance->maFontMetric.GetAboveBoldUnderlineOffset();
+ nLineHeight = pFontInstance->mxFontMetric->GetAboveBoldUnderlineSize();
+ nLinePos = nY + pFontInstance->mxFontMetric->GetAboveBoldUnderlineOffset();
}
else
{
- nLineHeight = pFontInstance->maFontMetric.GetBoldUnderlineSize();
- nLinePos = nY + pFontInstance->maFontMetric.GetBoldUnderlineOffset();
+ nLineHeight = pFontInstance->mxFontMetric->GetBoldUnderlineSize();
+ nLinePos = nY + pFontInstance->mxFontMetric->GetBoldUnderlineOffset();
}
break;
case UNDERLINE_DOUBLE:
if ( bIsAbove )
{
- nLineHeight = pFontInstance->maFontMetric.GetAboveDoubleUnderlineSize();
- nLinePos = nY + pFontInstance->maFontMetric.GetAboveDoubleUnderlineOffset1();
- nLinePos2 = nY + pFontInstance->maFontMetric.GetAboveDoubleUnderlineOffset2();
+ nLineHeight = pFontInstance->mxFontMetric->GetAboveDoubleUnderlineSize();
+ nLinePos = nY + pFontInstance->mxFontMetric->GetAboveDoubleUnderlineOffset1();
+ nLinePos2 = nY + pFontInstance->mxFontMetric->GetAboveDoubleUnderlineOffset2();
}
else
{
- nLineHeight = pFontInstance->maFontMetric.GetDoubleUnderlineSize();
- nLinePos = nY + pFontInstance->maFontMetric.GetDoubleUnderlineOffset1();
- nLinePos2 = nY + pFontInstance->maFontMetric.GetDoubleUnderlineOffset2();
+ nLineHeight = pFontInstance->mxFontMetric->GetDoubleUnderlineSize();
+ nLinePos = nY + pFontInstance->mxFontMetric->GetDoubleUnderlineOffset1();
+ nLinePos2 = nY + pFontInstance->mxFontMetric->GetDoubleUnderlineOffset2();
}
break;
default:
@@ -538,17 +538,17 @@ void OutputDevice::ImplDrawStrikeoutLine( long nBaseX, long nBaseY,
switch ( eStrikeout )
{
case STRIKEOUT_SINGLE:
- nLineHeight = pFontInstance->maFontMetric.GetStrikeoutSize();
- nLinePos = nY + pFontInstance->maFontMetric.GetStrikeoutOffset();
+ nLineHeight = pFontInstance->mxFontMetric->GetStrikeoutSize();
+ nLinePos = nY + pFontInstance->mxFontMetric->GetStrikeoutOffset();
break;
case STRIKEOUT_BOLD:
- nLineHeight = pFontInstance->maFontMetric.GetBoldStrikeoutSize();
- nLinePos = nY + pFontInstance->maFontMetric.GetBoldStrikeoutOffset();
+ nLineHeight = pFontInstance->mxFontMetric->GetBoldStrikeoutSize();
+ nLinePos = nY + pFontInstance->mxFontMetric->GetBoldStrikeoutOffset();
break;
case STRIKEOUT_DOUBLE:
- nLineHeight = pFontInstance->maFontMetric.GetDoubleStrikeoutSize();
- nLinePos = nY + pFontInstance->maFontMetric.GetDoubleStrikeoutOffset1();
- nLinePos2 = nY + pFontInstance->maFontMetric.GetDoubleStrikeoutOffset2();
+ nLineHeight = pFontInstance->mxFontMetric->GetDoubleStrikeoutSize();
+ nLinePos = nY + pFontInstance->mxFontMetric->GetDoubleStrikeoutOffset1();
+ nLinePos2 = nY + pFontInstance->mxFontMetric->GetDoubleStrikeoutOffset2();
break;
default:
break;
@@ -652,8 +652,8 @@ void OutputDevice::ImplDrawStrikeoutChar( long nBaseX, long nBaseY,
Rectangle aPixelRect;
aPixelRect.Left() = nBaseX+mnTextOffX;
aPixelRect.Right() = aPixelRect.Left()+nWidth;
- aPixelRect.Bottom() = nBaseY+mpFontInstance->maFontMetric.GetDescent();
- aPixelRect.Top() = nBaseY-mpFontInstance->maFontMetric.GetAscent();
+ aPixelRect.Bottom() = nBaseY+mpFontInstance->mxFontMetric->GetDescent();
+ aPixelRect.Top() = nBaseY-mpFontInstance->mxFontMetric->GetAscent();
if (mpFontInstance->mnOrientation)
{
@@ -1043,9 +1043,9 @@ void OutputDevice::DrawWaveLine( const Point& rStartPos, const Point& rEndPos )
// #109280# make sure the waveline does not exceed the descent to avoid paint problems
LogicalFontInstance* pFontInstance = mpFontInstance;
- if( nWaveHeight > pFontInstance->maFontMetric.GetWavelineUnderlineSize() )
+ if( nWaveHeight > pFontInstance->mxFontMetric->GetWavelineUnderlineSize() )
{
- nWaveHeight = pFontInstance->maFontMetric.GetWavelineUnderlineSize();
+ nWaveHeight = pFontInstance->mxFontMetric->GetWavelineUnderlineSize();
}
ImplDrawWaveLine(nStartX, nStartY, 0, 0,
nEndX-nStartX, nWaveHeight,