summaryrefslogtreecommitdiff
path: root/vcl
diff options
context:
space:
mode:
authorChris Sherlock <chris.sherlock79@gmail.com>2014-04-18 20:55:59 +1000
committerChris Sherlock <chris.sherlock79@gmail.com>2014-04-18 20:58:42 +1000
commitf4e8bca336ad8b26cc9ba9e6d5ef9d665cc164d6 (patch)
tree1563384225e6271e2f7680d0140cd64c21dd699f /vcl
parent62fd63050c355b06b449e58134fa482866102134 (diff)
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
Diffstat (limited to 'vcl')
-rw-r--r--vcl/source/gdi/print.cxx22
-rw-r--r--vcl/source/outdev/font.cxx18
-rw-r--r--vcl/source/outdev/text.cxx8
3 files changed, 30 insertions, 18 deletions
diff --git a/vcl/source/gdi/print.cxx b/vcl/source/gdi/print.cxx
index d25a28e5dde4..b741faab3c7e 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 7123f353a8d3..7b4db77dc268 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 3bf4e3e88bbf..7063c32075b1 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;