diff options
author | Chris Sherlock <chris.sherlock79@gmail.com> | 2014-04-20 11:47:58 +1000 |
---|---|---|
committer | Chris Sherlock <chris.sherlock79@gmail.com> | 2014-04-20 12:17:50 +1000 |
commit | 588bb542bebdee5a67bd4695253c70646fb8a303 (patch) | |
tree | 1c91b0e9dc31f745a7b00d874df27525065fa789 | |
parent | 7f62b44458fb27f8aca652436aeafb5e033264bd (diff) |
fdo#74702 Only VirtualDevice should handle the Word ext lead bug
In #i60945# it was discovered that Unix's leading external font spacing
causes problems with the display of documents. Therefore, the reference
device implemented a workaround, which was to set the spacing to zero.
However, the reference device is a VirtualDevice, so it should really be
handled there, not in OutputDevice. I have added a new protected function
to OutputDevice, GetFontExtLead() that handles this.
Change-Id: I1b84ee7d9f7ae96841b441b52705e67c8115ae5c
-rw-r--r-- | include/vcl/outdev.hxx | 2 | ||||
-rw-r--r-- | include/vcl/virdev.hxx | 4 | ||||
-rw-r--r-- | vcl/source/gdi/virdev.cxx | 14 | ||||
-rw-r--r-- | vcl/source/outdev/font.cxx | 18 |
4 files changed, 27 insertions, 11 deletions
diff --git a/include/vcl/outdev.hxx b/include/vcl/outdev.hxx index 480e1a8d705f..cd7e5a553f11 100644 --- a/include/vcl/outdev.hxx +++ b/include/vcl/outdev.hxx @@ -390,10 +390,10 @@ private: mutable bool mbRefPoint : 1; mutable bool mbEnableRTL : 1; - protected: virtual void ImplReleaseFonts(); virtual void SetFontOrientation( ImplFontEntry* const pFontEntry ) const; + virtual long GetFontExtLeading() const; public: /** @name Initialization and accessor functions diff --git a/include/vcl/virdev.hxx b/include/vcl/virdev.hxx index b2a29be735bb..072b94d55352 100644 --- a/include/vcl/virdev.hxx +++ b/include/vcl/virdev.hxx @@ -141,7 +141,9 @@ private: SAL_DLLPRIVATE void ImplSetReferenceDevice( RefDevMode, sal_Int32 i_nDPIX, sal_Int32 i_nDPIY ); protected: - virtual bool UsePolyPolygonForComplexGradient() SAL_OVERRIDE; + virtual bool UsePolyPolygonForComplexGradient() SAL_OVERRIDE; + + virtual long GetFontExtLeading() const SAL_OVERRIDE; }; diff --git a/vcl/source/gdi/virdev.cxx b/vcl/source/gdi/virdev.cxx index 856a35893dd5..be348ec25fd9 100644 --- a/vcl/source/gdi/virdev.cxx +++ b/vcl/source/gdi/virdev.cxx @@ -548,4 +548,18 @@ void VirtualDevice::Compat_ZeroExtleadBug() meRefDevMode = (sal_uInt8)meRefDevMode | REFDEV_FORCE_ZERO_EXTLEAD; } +long VirtualDevice::GetFontExtLeading() const +{ +#ifdef UNX + // backwards compatible line metrics after fixing #i60945# + if ( ForceZeroExtleadBug() ) + return 0; +#endif + + ImplFontEntry* pEntry = mpFontEntry; + ImplFontMetricData* pMetric = &(pEntry->maMetric); + + return pMetric->mnExtLeading; +} + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/source/outdev/font.cxx b/vcl/source/outdev/font.cxx index c5973d3814bb..225dac3a2811 100644 --- a/vcl/source/outdev/font.cxx +++ b/vcl/source/outdev/font.cxx @@ -2137,14 +2137,12 @@ Size OutputDevice::GetDevFontSize( const Font& rFont, int nSizeIndex ) const bool OutputDevice::IsFontAvailable( const OUString& rFontName ) const { - PhysicalFontFamily* pFound = mpFontCollection->FindFontFamily( rFontName ); return (pFound != NULL); } FontMetric OutputDevice::GetFontMetric() const { - FontMetric aMetric; if( mbNewFont && !ImplNewFont() ) return aMetric; @@ -2181,20 +2179,22 @@ FontMetric OutputDevice::GetFontMetric() const aMetric.mpImplMetric->mnAscent = ImplDevicePixelToLogicHeight( pMetric->mnAscent+mnEmphasisAscent ); aMetric.mpImplMetric->mnDescent = ImplDevicePixelToLogicHeight( pMetric->mnDescent+mnEmphasisDescent ); aMetric.mpImplMetric->mnIntLeading = ImplDevicePixelToLogicHeight( pMetric->mnIntLeading+mnEmphasisAscent ); + aMetric.mpImplMetric->mnExtLeading = ImplDevicePixelToLogicHeight( GetFontExtLeading() ); aMetric.mpImplMetric->mnExtLeading = ImplDevicePixelToLogicHeight( pMetric->mnExtLeading ); aMetric.mpImplMetric->mnLineHeight = ImplDevicePixelToLogicHeight( pMetric->mnAscent+pMetric->mnDescent+mnEmphasisAscent+mnEmphasisDescent ); aMetric.mpImplMetric->mnSlant = ImplDevicePixelToLogicHeight( pMetric->mnSlant ); -#ifdef UNX - // backwards compatible line metrics after fixing #i60945# - if( (meOutDevType == OUTDEV_VIRDEV) - && static_cast<const VirtualDevice*>(this)->ForceZeroExtleadBug() ) - aMetric.mpImplMetric->mnExtLeading = 0; -#endif - return aMetric; } +long OutputDevice::GetFontExtLeading() const +{ + ImplFontEntry* pEntry = mpFontEntry; + ImplFontMetricData* pMetric = &(pEntry->maMetric); + + return pMetric->mnExtLeading; +} + FontMetric OutputDevice::GetFontMetric( const Font& rFont ) const { // select font, query metrics, select original font again |