[Libreoffice-commits] core.git: include/vcl vcl/source

Chris Sherlock chris.sherlock79 at gmail.com
Sat Apr 19 19:24:25 PDT 2014


 include/vcl/outdev.hxx     |    2 +-
 include/vcl/virdev.hxx     |    4 +++-
 vcl/source/gdi/virdev.cxx  |   14 ++++++++++++++
 vcl/source/outdev/font.cxx |   18 +++++++++---------
 4 files changed, 27 insertions(+), 11 deletions(-)

New commits:
commit 588bb542bebdee5a67bd4695253c70646fb8a303
Author: Chris Sherlock <chris.sherlock79 at gmail.com>
Date:   Sun Apr 20 11:47:58 2014 +1000

    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

diff --git a/include/vcl/outdev.hxx b/include/vcl/outdev.hxx
index 480e1a8..cd7e5a5 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 b2a29be..072b94d 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 856a358..be348ec 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 c5973d3..225dac3 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


More information about the Libreoffice-commits mailing list