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

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Mon Oct 22 22:20:49 UTC 2018


 vcl/inc/fontselect.hxx           |    4 ++--
 vcl/inc/impfontcache.hxx         |    4 ++--
 vcl/source/font/fontcache.cxx    |    4 ++--
 vcl/source/font/fontinstance.cxx |    5 -----
 vcl/source/font/fontselect.cxx   |    4 ++--
 vcl/source/outdev/font.cxx       |   32 +++++++++++++++-----------------
 6 files changed, 23 insertions(+), 30 deletions(-)

New commits:
commit c766a05ae0354f1bc9763b725f91069975b37bd3
Author:     Jan-Marek Glogowski <glogow at fbihome.de>
AuthorDate: Mon Oct 22 18:38:44 2018 +0000
Commit:     Jan-Marek Glogowski <glogow at fbihome.de>
CommitDate: Tue Oct 23 00:20:25 2018 +0200

    Antialias drawing is part of the font selection
    
    At least on Windows antialias-drawing has to be selected via
    LOGFONTW.lfQuality passed to CreateFont, so InitFont is too late.
    
    Change-Id: Ie81c5f0074fdbcf1f0e74fbff31a5df663a67884
    Reviewed-on: https://gerrit.libreoffice.org/62200
    Tested-by: Jenkins
    Reviewed-by: Jan-Marek Glogowski <glogow at fbihome.de>

diff --git a/vcl/inc/fontselect.hxx b/vcl/inc/fontselect.hxx
index 51f70997ac53..e021f7a0c775 100644
--- a/vcl/inc/fontselect.hxx
+++ b/vcl/inc/fontselect.hxx
@@ -37,8 +37,8 @@ class Size;
 class VCL_DLLPUBLIC FontSelectPattern : public FontAttributes
 {
 public:
-                    FontSelectPattern( const vcl::Font&, const OUString& rSearchName,
-                                                 const Size&, float fExactHeight );
+    FontSelectPattern(const vcl::Font&, const OUString& rSearchName,
+                      const Size&, float fExactHeight, bool bNonAntialias = false);
 #ifdef _WIN32
                     FontSelectPattern( const PhysicalFontFace&, const Size&,
                                                  float fExactHeight, int nOrientation, bool bVertical );
diff --git a/vcl/inc/impfontcache.hxx b/vcl/inc/impfontcache.hxx
index ee39883f2199..25bc970c97a9 100644
--- a/vcl/inc/impfontcache.hxx
+++ b/vcl/inc/impfontcache.hxx
@@ -82,8 +82,8 @@ public:
     ImplFontCache();
     ~ImplFontCache();
 
-    rtl::Reference<LogicalFontInstance> GetFontInstance( PhysicalFontCollection const *,
-                             const vcl::Font&, const Size& rPixelSize, float fExactHeight);
+    rtl::Reference<LogicalFontInstance> GetFontInstance(PhysicalFontCollection const *,
+                             const vcl::Font&, const Size& rPixelSize, float fExactHeight, bool bNonAntialias = false);
     rtl::Reference<LogicalFontInstance> GetGlyphFallbackFont( PhysicalFontCollection const *, FontSelectPattern&,
                             LogicalFontInstance* pLogicalFont,
                             int nFallbackLevel, OUString& rMissingCodes );
diff --git a/vcl/source/font/fontcache.cxx b/vcl/source/font/fontcache.cxx
index b8e4bec2b5ce..51a04a34b769 100644
--- a/vcl/source/font/fontcache.cxx
+++ b/vcl/source/font/fontcache.cxx
@@ -97,10 +97,10 @@ ImplFontCache::~ImplFontCache()
 }
 
 rtl::Reference<LogicalFontInstance> ImplFontCache::GetFontInstance( PhysicalFontCollection const * pFontList,
-    const vcl::Font& rFont, const Size& rSize, float fExactHeight )
+    const vcl::Font& rFont, const Size& rSize, float fExactHeight, bool bNonAntialias )
 {
     // initialize internal font request object
-    FontSelectPattern aFontSelData(rFont, rFont.GetFamilyName(), rSize, fExactHeight);
+    FontSelectPattern aFontSelData(rFont, rFont.GetFamilyName(), rSize, fExactHeight, bNonAntialias);
     return GetFontInstance( pFontList, aFontSelData );
 }
 
diff --git a/vcl/source/font/fontinstance.cxx b/vcl/source/font/fontinstance.cxx
index 7a889fa65a7c..0a7bc91c57af 100644
--- a/vcl/source/font/fontinstance.cxx
+++ b/vcl/source/font/fontinstance.cxx
@@ -55,11 +55,6 @@ LogicalFontInstance::LogicalFontInstance(const PhysicalFontFace& rFontFace, cons
 {
 }
 
-void LogicalFontInstance::SetNonAntialiased(bool bNonAntialiased)
-{
-    const_cast<FontSelectPattern*>(&m_aFontSelData)->mbNonAntialiased = bNonAntialiased;
-}
-
 LogicalFontInstance::~LogicalFontInstance()
 {
     mpUnicodeFallbackList.reset();
diff --git a/vcl/source/font/fontselect.cxx b/vcl/source/font/fontselect.cxx
index f879f9c5a7ac..e5b35bb24560 100644
--- a/vcl/source/font/fontselect.cxx
+++ b/vcl/source/font/fontselect.cxx
@@ -31,7 +31,7 @@ const char FontSelectPattern::FEAT_PREFIX = ':';
 const char FontSelectPattern::FEAT_SEPARATOR = '&';
 
 FontSelectPattern::FontSelectPattern( const vcl::Font& rFont,
-    const OUString& rSearchName, const Size& rSize, float fExactHeight )
+    const OUString& rSearchName, const Size& rSize, float fExactHeight, bool bNonAntialias)
     : maSearchName( rSearchName )
     , mnWidth( rSize.Width() )
     , mnHeight( rSize.Height() )
@@ -39,7 +39,7 @@ FontSelectPattern::FontSelectPattern( const vcl::Font& rFont,
     , mnOrientation( rFont.GetOrientation() )
     , meLanguage( rFont.GetLanguage() )
     , mbVertical( rFont.IsVertical() )
-    , mbNonAntialiased( false )
+    , mbNonAntialiased(bNonAntialias)
     , mbEmbolden( false )
 {
     maTargetName = GetFamilyName();
diff --git a/vcl/source/outdev/font.cxx b/vcl/source/outdev/font.cxx
index 9904ecf304d4..e3b7f1a2acaa 100644
--- a/vcl/source/outdev/font.cxx
+++ b/vcl/source/outdev/font.cxx
@@ -998,22 +998,11 @@ void OutputDevice::InitFont() const
 
     if (!mpFontInstance)
         return;
+    if (!mbInitFont)
+        return;
 
-    if ( mbInitFont )
-    {
-        // decide if antialiasing is appropriate
-        bool bNonAntialiased(GetAntialiasing() & AntialiasingFlags::DisableText);
-        if (!utl::ConfigManager::IsFuzzing())
-        {
-            const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings();
-            bNonAntialiased |= bool(rStyleSettings.GetDisplayOptions() & DisplayOptions::AADisable);
-            bNonAntialiased |= (int(rStyleSettings.GetAntialiasingMinPixelHeight()) > mpFontInstance->GetFontSelectPattern().mnHeight);
-        }
-        mpFontInstance->SetNonAntialiased(bNonAntialiased);
-        // select font in the device layers
-        mpGraphics->SetFont(mpFontInstance.get(), 0);
-        mbInitFont = false;
-    }
+    mpGraphics->SetFont(mpFontInstance.get(), 0);
+    mbInitFont = false;
 }
 
 bool OutputDevice::ImplNewFont() const
@@ -1059,10 +1048,19 @@ bool OutputDevice::ImplNewFont() const
     if( (0 == aSize.Width()) && (0 != maFont.GetFontSize().Width()) )
         aSize.setWidth( 1 );
 
+    // decide if antialiasing is appropriate
+    bool bNonAntialiased(GetAntialiasing() & AntialiasingFlags::DisableText);
+    if (!utl::ConfigManager::IsFuzzing())
+    {
+        const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings();
+        bNonAntialiased |= bool(rStyleSettings.GetDisplayOptions() & DisplayOptions::AADisable);
+        bNonAntialiased |= (int(rStyleSettings.GetAntialiasingMinPixelHeight()) > maFont.GetFontSize().Height());
+    }
+
     // get font entry
     rtl::Reference<LogicalFontInstance> pOldFontInstance = mpFontInstance;
-    mpFontInstance = mxFontCache->GetFontInstance( mxFontCollection.get(), maFont, aSize, fExactHeight );
-    bool bNewFontInstance = pOldFontInstance.get() != mpFontInstance.get();
+    mpFontInstance = mxFontCache->GetFontInstance(mxFontCollection.get(), maFont, aSize, fExactHeight, bNonAntialiased);
+    const bool bNewFontInstance = pOldFontInstance.get() != mpFontInstance.get();
     pOldFontInstance.clear();
 
     LogicalFontInstance* pFontInstance = mpFontInstance.get();


More information about the Libreoffice-commits mailing list