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

Chris Sherlock chris.sherlock79 at gmail.com
Fri Apr 18 03:59:29 PDT 2014


 include/vcl/outdev.hxx     |    5 ++++-
 include/vcl/print.hxx      |    2 ++
 vcl/source/gdi/print.cxx   |   22 ++++++++++++++++++++++
 vcl/source/outdev/font.cxx |   18 ++++--------------
 vcl/source/outdev/text.cxx |    8 ++++----
 5 files changed, 36 insertions(+), 19 deletions(-)

New commits:
commit f4e8bca336ad8b26cc9ba9e6d5ef9d665cc164d6
Author: Chris Sherlock <chris.sherlock79 at gmail.com>
Date:   Fri Apr 18 20:55:59 2014 +1000

    fdo#74702 Allow Printer to handle ImplInitFont and rename
    
    Renamed ImplInitFont() to InitFont, made it protected. Moved printer
    handling to Printer class.
    
    Change-Id: I42ebf6188d075993b5d2e14f55a7e530201acdd6

diff --git a/include/vcl/outdev.hxx b/include/vcl/outdev.hxx
index c98ff3a..c2e9686 100644
--- a/include/vcl/outdev.hxx
+++ b/include/vcl/outdev.hxx
@@ -653,9 +653,12 @@ public:
      */
     ///@{
     SAL_DLLPRIVATE bool         ImplNewFont() const;
-    SAL_DLLPRIVATE void         ImplInitFont() const;
     SAL_DLLPRIVATE void         ImplInitTextColor();
 
+protected:
+    virtual void                InitFont() const;
+
+public:
     static
     SAL_DLLPRIVATE void         ImplDrawText( OutputDevice& rTargetDevice, const Rectangle& rRect,
                                               const OUString& rOrigStr, sal_uInt16 nStyle,
diff --git a/include/vcl/print.hxx b/include/vcl/print.hxx
index 23c656d..ef4bec7 100644
--- a/include/vcl/print.hxx
+++ b/include/vcl/print.hxx
@@ -303,6 +303,8 @@ protected:
 
     virtual void                EmulateDrawTransparent( const PolyPolygon& rPolyPoly, sal_uInt16 nTransparencePercent ) SAL_OVERRIDE;
 
+    virtual void                InitFont() const SAL_OVERRIDE;
+
 public:
                                 Printer();
                                 Printer( const JobSetup& rJobSetup );
diff --git a/vcl/source/gdi/print.cxx b/vcl/source/gdi/print.cxx
index d25a28e..b741faa 100644
--- a/vcl/source/gdi/print.cxx
+++ b/vcl/source/gdi/print.cxx
@@ -33,6 +33,7 @@
 #include <vcl/gdimtf.hxx>
 #include <vcl/metaact.hxx>
 #include <vcl/print.hxx>
+#include <vcl/settings.hxx>
 
 #include <salinst.hxx>
 #include <salvd.hxx>
@@ -1812,4 +1813,25 @@ bool Printer::UsePolyPolygonForComplexGradient()
     return true;
 }
 
+void Printer::InitFont() const
+{
+    DBG_TESTSOLARMUTEX();
+
+    if (!mpFontEntry)
+        return;
+
+    if ( mbInitFont )
+    {
+        // decide if antialiasing is appropriate
+        bool bNonAntialiased = (GetAntialiasing() & ANTIALIASING_DISABLE_TEXT) != 0;
+        const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings();
+        bNonAntialiased |= ((rStyleSettings.GetDisplayOptions() & DISPLAY_OPTION_AA_DISABLE) != 0);
+        bNonAntialiased |= (int(rStyleSettings.GetAntialiasingMinPixelHeight()) > mpFontEntry->maFontSelData.mnHeight);
+        mpFontEntry->maFontSelData.mbNonAntialiased = bNonAntialiased;
+
+        // select font in the device layers
+        mpFontEntry->mnSetFontFlags = mpGraphics->SetFont( &(mpFontEntry->maFontSelData), 0 );
+        mbInitFont = false;
+    }
+}
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/source/outdev/font.cxx b/vcl/source/outdev/font.cxx
index 7123f35..7b4db77 100644
--- a/vcl/source/outdev/font.cxx
+++ b/vcl/source/outdev/font.cxx
@@ -1153,7 +1153,7 @@ void OutputDevice::ImplInitFontList() const
     }
 }
 
-void OutputDevice::ImplInitFont() const
+void OutputDevice::InitFont() const
 {
     DBG_TESTSOLARMUTEX();
 
@@ -1162,16 +1162,6 @@ void OutputDevice::ImplInitFont() const
 
     if ( mbInitFont )
     {
-        if ( meOutDevType != OUTDEV_PRINTER )
-        {
-            // decide if antialiasing is appropriate
-            bool bNonAntialiased = (GetAntialiasing() & ANTIALIASING_DISABLE_TEXT) != 0;
-            const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings();
-            bNonAntialiased |= ((rStyleSettings.GetDisplayOptions() & DISPLAY_OPTION_AA_DISABLE) != 0);
-            bNonAntialiased |= (int(rStyleSettings.GetAntialiasingMinPixelHeight()) > mpFontEntry->maFontSelData.mnHeight);
-            mpFontEntry->maFontSelData.mbNonAntialiased = bNonAntialiased;
-        }
-
         // select font in the device layers
         mpFontEntry->mnSetFontFlags = mpGraphics->SetFont( &(mpFontEntry->maFontSelData), 0 );
         mbInitFont = false;
@@ -1237,7 +1227,7 @@ bool OutputDevice::ImplNewFont() const
     // select font when it has not been initialized yet
     if ( !pFontEntry->mbInit )
     {
-        ImplInitFont();
+        InitFont();
 
         // get metric data from device layers
         if ( pGraphics )
@@ -2303,7 +2293,7 @@ bool OutputDevice::GetFontCapabilities( FontCapabilities& rFontCapabilities ) co
     if( mbNewFont )
         ImplNewFont();
     if( mbInitFont )
-        ImplInitFont();
+        InitFont();
     if( !mpFontEntry )
         return false;
 
@@ -2321,7 +2311,7 @@ bool OutputDevice::GetFontCharMap( FontCharMap& rFontCharMap ) const
     if( mbNewFont )
         ImplNewFont();
     if( mbInitFont )
-        ImplInitFont();
+        InitFont();
     if( !mpFontEntry )
         return false;
 
diff --git a/vcl/source/outdev/text.cxx b/vcl/source/outdev/text.cxx
index 3bf4e3e..7063c32 100644
--- a/vcl/source/outdev/text.cxx
+++ b/vcl/source/outdev/text.cxx
@@ -1047,7 +1047,7 @@ bool OutputDevice::ImplDrawRotateText( SalLayout& rSalLayout )
     pVDev->SetTextColor( Color( COL_BLACK ) );
     pVDev->SetTextFillColor();
     pVDev->ImplNewFont();
-    pVDev->ImplInitFont();
+    pVDev->InitFont();
     pVDev->ImplInitTextColor();
 
     // draw text into upper left corner
@@ -1791,7 +1791,7 @@ void OutputDevice::DrawTextLine( const Point& rPos, long nWidth,
         if( !ImplNewFont() )
             return;
     if( mbInitFont )
-        ImplInitFont();
+        InitFont();
 
     Point aPos = ImplLogicToDevicePixel( rPos );
     nWidth = ImplLogicWidthToDevicePixel( nWidth );
@@ -2302,7 +2302,7 @@ SalLayout* OutputDevice::ImplLayout(const OUString& rOrigStr,
         if( !ImplNewFont() )
             return NULL;
     if( mbInitFont )
-        ImplInitFont();
+        InitFont();
 
     // check string index and length
     if( -1 == nLen || nMinIndex + nLen > rOrigStr.getLength() )
@@ -3559,7 +3559,7 @@ bool OutputDevice::GetTextOutlines( ::basegfx::B2DPolyPolygonVector& rVector,
     if( mbNewFont )
         ImplNewFont();
     if( mbInitFont )
-        ImplInitFont();
+        InitFont();
     if( !mpFontEntry )
         return false;
 


More information about the Libreoffice-commits mailing list