[Libreoffice-commits] core.git: include/vcl vcl/headless vcl/inc vcl/qt5 vcl/quartz vcl/source vcl/unx vcl/win

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Tue Aug 21 19:28:24 UTC 2018


 include/vcl/outdev.hxx                   |    2 +-
 vcl/headless/svptext.cxx                 |    2 +-
 vcl/inc/fontinstance.hxx                 |    1 +
 vcl/inc/headless/svpgdi.hxx              |    2 +-
 vcl/inc/qt5/Qt5FontFace.hxx              |    2 +-
 vcl/inc/qt5/Qt5Graphics.hxx              |    2 +-
 vcl/inc/quartz/salgdi.h                  |    2 +-
 vcl/inc/salgdi.hxx                       |    2 +-
 vcl/inc/textrender.hxx                   |    2 +-
 vcl/inc/unx/cairotextrender.hxx          |    4 ++--
 vcl/inc/unx/genpspgraphics.h             |    2 +-
 vcl/inc/unx/salgdi.h                     |    2 +-
 vcl/inc/win/salgdi.h                     |    4 ++--
 vcl/qt5/Qt5Graphics_Text.cxx             |    7 ++-----
 vcl/quartz/salgdi.cxx                    |   21 ++-------------------
 vcl/source/font/fontinstance.cxx         |    5 +++++
 vcl/source/gdi/print.cxx                 |    2 +-
 vcl/source/outdev/font.cxx               |   17 +++++++----------
 vcl/unx/generic/gdi/cairotextrender.cxx  |    6 +++---
 vcl/unx/generic/gdi/font.cxx             |    3 +--
 vcl/unx/generic/print/genpspgraphics.cxx |   26 +++++++++++++++-----------
 vcl/win/gdi/salfont.cxx                  |   16 ++++++++--------
 22 files changed, 59 insertions(+), 73 deletions(-)

New commits:
commit 2f97ae5def2e51cfec3240fa625ffd495288360e
Author:     Caolán McNamara <caolanm at redhat.com>
AuthorDate: Mon Aug 20 15:41:17 2018 +0100
Commit:     Caolán McNamara <caolanm at redhat.com>
CommitDate: Tue Aug 21 21:28:01 2018 +0200

    use LogicalFontInstance with SalGraphics
    
    Change-Id: I66fb1ff4b2fdcc211e0a9d5831f6dcc5e564e789
    Reviewed-on: https://gerrit.libreoffice.org/59372
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>
    Tested-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/include/vcl/outdev.hxx b/include/vcl/outdev.hxx
index ff37b971b344..54c22e6cc7fd 100644
--- a/include/vcl/outdev.hxx
+++ b/include/vcl/outdev.hxx
@@ -1341,7 +1341,7 @@ public:
     // tells whether this output device is RTL in an LTR UI or LTR in a RTL UI
     SAL_DLLPRIVATE std::unique_ptr<SalLayout>
                                 getFallbackFont(
-                                    FontSelectPattern &rFontSelData, int nFallbackLevel,
+                                    LogicalFontInstance* pLogicalFont, int nFallbackLevel,
                                     ImplLayoutArgs& rLayoutArgs) const;
 
 
diff --git a/vcl/headless/svptext.cxx b/vcl/headless/svptext.cxx
index 747fffe104f1..aab960a576a7 100644
--- a/vcl/headless/svptext.cxx
+++ b/vcl/headless/svptext.cxx
@@ -26,7 +26,7 @@
 #include <impfontmetricdata.hxx>
 #include <sallayout.hxx>
 
-void SvpSalGraphics::SetFont( const FontSelectPattern* pIFSD, int nFallbackLevel )
+void SvpSalGraphics::SetFont(LogicalFontInstance* pIFSD, int nFallbackLevel)
 {
     m_aTextRenderImpl.SetFont(pIFSD, nFallbackLevel);
 }
diff --git a/vcl/inc/fontinstance.hxx b/vcl/inc/fontinstance.hxx
index 149bb553c3eb..597c747553ac 100644
--- a/vcl/inc/fontinstance.hxx
+++ b/vcl/inc/fontinstance.hxx
@@ -60,6 +60,7 @@ public: // TODO: make data members private
 
     inline hb_font_t* GetHbFont();
     void SetAverageWidthFactor(double nFactor) { m_nAveWidthFactor = nFactor; }
+    void SetNonAntialiased(bool bNonAntialiased);
     double GetAverageWidthFactor() const { return m_nAveWidthFactor; }
     const FontSelectPattern& GetFontSelectPattern() const { return m_aFontSelData; }
 
diff --git a/vcl/inc/headless/svpgdi.hxx b/vcl/inc/headless/svpgdi.hxx
index 6571d21cf89d..a85193ea6521 100644
--- a/vcl/inc/headless/svpgdi.hxx
+++ b/vcl/inc/headless/svpgdi.hxx
@@ -161,7 +161,7 @@ public:
     virtual void            SetROPFillColor( SalROPColor nROPColor ) override;
 
     virtual void            SetTextColor( Color nColor ) override;
-    virtual void            SetFont( const FontSelectPattern*, int nFallbackLevel ) override;
+    virtual void            SetFont( LogicalFontInstance*, int nFallbackLevel ) override;
     virtual void            GetFontMetric( ImplFontMetricDataRef&, int nFallbackLevel ) override;
     virtual const FontCharMapRef GetFontCharMap() const override;
     virtual bool GetFontCapabilities(vcl::FontCapabilities &rFontCapabilities) const override;
diff --git a/vcl/inc/qt5/Qt5FontFace.hxx b/vcl/inc/qt5/Qt5FontFace.hxx
index c653b4be6f6e..70522f67e0d6 100644
--- a/vcl/inc/qt5/Qt5FontFace.hxx
+++ b/vcl/inc/qt5/Qt5FontFace.hxx
@@ -28,7 +28,7 @@
 #include <QtCore/QString>
 
 class FontAttributes;
-class FontSelectPattern;
+class FontSelectPatternAttributes;
 class QFont;
 
 class Qt5FontFace : public PhysicalFontFace
diff --git a/vcl/inc/qt5/Qt5Graphics.hxx b/vcl/inc/qt5/Qt5Graphics.hxx
index 88382a0c11f3..fa9823b0e789 100644
--- a/vcl/inc/qt5/Qt5Graphics.hxx
+++ b/vcl/inc/qt5/Qt5Graphics.hxx
@@ -172,7 +172,7 @@ public:
     // Text rendering + font support
 
     virtual void SetTextColor(Color nColor) override;
-    virtual void SetFont(const FontSelectPattern*, int nFallbackLevel) override;
+    virtual void SetFont(LogicalFontInstance*, int nFallbackLevel) override;
     virtual void GetFontMetric(ImplFontMetricDataRef&, int nFallbackLevel) override;
     virtual const FontCharMapRef GetFontCharMap() const override;
     virtual bool GetFontCapabilities(vcl::FontCapabilities& rFontCapabilities) const override;
diff --git a/vcl/inc/quartz/salgdi.h b/vcl/inc/quartz/salgdi.h
index a8341c65692e..31a8353a17ed 100644
--- a/vcl/inc/quartz/salgdi.h
+++ b/vcl/inc/quartz/salgdi.h
@@ -323,7 +323,7 @@ public:
     // set the text color to a specific color
     virtual void            SetTextColor( Color nColor ) override;
     // set the font
-    virtual void            SetFont( const FontSelectPattern*, int nFallbackLevel ) override;
+    virtual void            SetFont( LogicalFontInstance*, int nFallbackLevel ) override;
     // get the current font's metrics
     virtual void            GetFontMetric( ImplFontMetricDataRef&, int nFallbackLevel ) override;
     // get the repertoire of the current font
diff --git a/vcl/inc/salgdi.hxx b/vcl/inc/salgdi.hxx
index cacbfc71336b..84f0551a6d2d 100644
--- a/vcl/inc/salgdi.hxx
+++ b/vcl/inc/salgdi.hxx
@@ -123,7 +123,7 @@ public:
     virtual void                SetTextColor( Color nColor ) = 0;
 
     // set the font
-    virtual void                SetFont( const FontSelectPattern*, int nFallbackLevel ) = 0;
+    virtual void                SetFont( LogicalFontInstance*, int nFallbackLevel ) = 0;
 
     // release the fonts
     void                        ReleaseFonts() { SetFont( nullptr, 0 ); }
diff --git a/vcl/inc/textrender.hxx b/vcl/inc/textrender.hxx
index eb86e3b2bcf4..0dbf0bdd56bb 100644
--- a/vcl/inc/textrender.hxx
+++ b/vcl/inc/textrender.hxx
@@ -35,7 +35,7 @@ public:
     virtual ~TextRenderImpl() {}
 
     virtual void                    SetTextColor( Color nColor ) = 0;
-    virtual void                    SetFont( const FontSelectPattern*, int nFallbackLevel ) = 0;
+    virtual void                    SetFont( LogicalFontInstance*, int nFallbackLevel ) = 0;
     virtual void                    GetFontMetric( ImplFontMetricDataRef&, int nFallbackLevel ) = 0;
     virtual const FontCharMapRef    GetFontCharMap() const = 0;
     virtual bool                    GetFontCapabilities(vcl::FontCapabilities &rFontCapabilities) const = 0;
diff --git a/vcl/inc/unx/cairotextrender.hxx b/vcl/inc/unx/cairotextrender.hxx
index 65d2bed2918e..707bec9a0bf7 100644
--- a/vcl/inc/unx/cairotextrender.hxx
+++ b/vcl/inc/unx/cairotextrender.hxx
@@ -42,7 +42,7 @@ protected:
     virtual void                getSurfaceOffset(double& nDX, double& nDY) = 0;
     virtual void                releaseCairoContext(cairo_t* cr) = 0;
 
-    void                        setFont( const FontSelectPattern *pEntry, int nFallbackLevel );
+    void                        setFont( LogicalFontInstance *pEntry, int nFallbackLevel );
 
     virtual void                clipRegion(cairo_t* cr) = 0;
 
@@ -51,7 +51,7 @@ public:
 
 
     virtual void                SetTextColor( Color nColor ) override;
-    virtual void                SetFont( const FontSelectPattern*, int nFallbackLevel ) override;
+    virtual void                SetFont( LogicalFontInstance*, int nFallbackLevel ) override;
     virtual void                GetFontMetric( ImplFontMetricDataRef&, int nFallbackLevel ) override;
     virtual const FontCharMapRef GetFontCharMap() const override;
     virtual bool                GetFontCapabilities(vcl::FontCapabilities &rFontCapabilities) const override;
diff --git a/vcl/inc/unx/genpspgraphics.h b/vcl/inc/unx/genpspgraphics.h
index a4a9885d8cb7..ecd4ce9a11d9 100644
--- a/vcl/inc/unx/genpspgraphics.h
+++ b/vcl/inc/unx/genpspgraphics.h
@@ -83,7 +83,7 @@ public:
     virtual void            SetROPFillColor( SalROPColor nROPColor ) override;
 
     virtual void            SetTextColor( Color nColor ) override;
-    virtual void            SetFont( const FontSelectPattern*, int nFallbackLevel ) override;
+    virtual void            SetFont( LogicalFontInstance*, int nFallbackLevel ) override;
     virtual void            GetFontMetric( ImplFontMetricDataRef&, int nFallbackLevel ) override;
     virtual const FontCharMapRef GetFontCharMap() const override;
     virtual bool            GetFontCapabilities(vcl::FontCapabilities &rFontCapabilities) const override;
diff --git a/vcl/inc/unx/salgdi.h b/vcl/inc/unx/salgdi.h
index 9b656ac30223..5bca1ae938c7 100644
--- a/vcl/inc/unx/salgdi.h
+++ b/vcl/inc/unx/salgdi.h
@@ -115,7 +115,7 @@ public:
     virtual void                    SetROPFillColor( SalROPColor nROPColor ) override;
 
     virtual void                    SetTextColor( Color nColor ) override;
-    virtual void                    SetFont( const FontSelectPattern*, int nFallbackLevel ) override;
+    virtual void                    SetFont( LogicalFontInstance*, int nFallbackLevel ) override;
     virtual void                    GetFontMetric( ImplFontMetricDataRef&, int nFallbackLevel ) override;
     virtual const FontCharMapRef    GetFontCharMap() const override;
     virtual bool                    GetFontCapabilities(vcl::FontCapabilities &rFontCapabilities) const override;
diff --git a/vcl/inc/win/salgdi.h b/vcl/inc/win/salgdi.h
index 85b92946226e..c55193e255e9 100644
--- a/vcl/inc/win/salgdi.h
+++ b/vcl/inc/win/salgdi.h
@@ -185,7 +185,7 @@ private:
 
     bool CacheGlyphs(const GenericSalLayout& rLayout);
     bool DrawCachedGlyphs(const GenericSalLayout& rLayout);
-    HFONT ImplDoSetFont(FontSelectPattern const * i_pFont, const PhysicalFontFace * i_pFontFace, float& o_rFontScale, HFONT& o_rOldFont);
+    HFONT ImplDoSetFont(FontSelectPattern const & i_rFont, const PhysicalFontFace * i_pFontFace, float& o_rFontScale, HFONT& o_rOldFont);
 
 public:
     HDC getHDC() const { return mhLocalDC; }
@@ -337,7 +337,7 @@ public:
     // set the text color to a specific color
     virtual void            SetTextColor( Color nColor ) override;
     // set the font
-    virtual void            SetFont( const FontSelectPattern*, int nFallbackLevel ) override;
+    virtual void            SetFont( LogicalFontInstance*, int nFallbackLevel ) override;
     // get the current font's metrics
     virtual void            GetFontMetric( ImplFontMetricDataRef&, int nFallbackLevel ) override;
     // get the repertoire of the current font
diff --git a/vcl/qt5/Qt5Graphics_Text.cxx b/vcl/qt5/Qt5Graphics_Text.cxx
index 37a0879b0044..94aa069db0c1 100644
--- a/vcl/qt5/Qt5Graphics_Text.cxx
+++ b/vcl/qt5/Qt5Graphics_Text.cxx
@@ -36,7 +36,7 @@
 
 void Qt5Graphics::SetTextColor(Color nColor) { m_aTextColor = nColor; }
 
-void Qt5Graphics::SetFont(const FontSelectPattern* pReqFont, int nFallbackLevel)
+void Qt5Graphics::SetFont(LogicalFontInstance* pReqFont, int nFallbackLevel)
 {
     // release the text styles
     for (int i = nFallbackLevel; i < MAX_FALLBACK; ++i)
@@ -48,11 +48,8 @@ void Qt5Graphics::SetFont(const FontSelectPattern* pReqFont, int nFallbackLevel)
 
     if (!pReqFont)
         return;
-    assert(pReqFont->mpFontInstance);
-    if (!pReqFont->mpFontInstance)
-        return;
 
-    m_pTextStyle[nFallbackLevel] = static_cast<Qt5Font*>(pReqFont->mpFontInstance.get());
+    m_pTextStyle[nFallbackLevel] = static_cast<Qt5Font*>(pReqFont);
 }
 
 void Qt5Graphics::GetFontMetric(ImplFontMetricDataRef& rFMD, int nFallbackLevel)
diff --git a/vcl/quartz/salgdi.cxx b/vcl/quartz/salgdi.cxx
index e586ccb6c19f..3f74e05f5910 100644
--- a/vcl/quartz/salgdi.cxx
+++ b/vcl/quartz/salgdi.cxx
@@ -474,7 +474,7 @@ void AquaSalGraphics::DrawTextLayout(const GenericSalLayout& rLayout)
     CGContextRestoreGState(mrContext);
 }
 
-void AquaSalGraphics::SetFont(const FontSelectPattern* pReqFont, int nFallbackLevel)
+void AquaSalGraphics::SetFont(LogicalFontInstance* pReqFont, int nFallbackLevel)
 {
     // release the text style
     for (int i = nFallbackLevel; i < MAX_FALLBACK; ++i)
@@ -486,26 +486,9 @@ void AquaSalGraphics::SetFont(const FontSelectPattern* pReqFont, int nFallbackLe
 
     if (!pReqFont)
         return;
-    assert(pReqFont->mpFontInstance);
-    if (!pReqFont->mpFontInstance)
-        return;
 
     // update the text style
-    mpTextStyle[nFallbackLevel] = static_cast<CoreTextStyle*>(pReqFont->mpFontInstance.get());
-
-    SAL_INFO("vcl.ct",
-            "SetFont"
-               " to "     << mpTextStyle[nFallbackLevel]->GetFontFace()->GetFamilyName()
-            << ", "       << mpTextStyle[nFallbackLevel]->GetFontFace()->GetStyleName()
-            << " fontid=" << mpTextStyle[nFallbackLevel]->GetFontFace()->GetFontId()
-            << " for "    << pReqFont->GetFamilyName()
-            << ", "       << pReqFont->GetStyleName()
-            << " weight=" << pReqFont->GetWeight()
-            << " slant="  << pReqFont->GetItalic()
-            << " size="   << pReqFont->mnHeight << "x" << pReqFont->mnWidth
-            << " orientation=" << pReqFont->mnOrientation
-            << " fallback level " << nFallbackLevel
-            );
+    mpTextStyle[nFallbackLevel] = static_cast<CoreTextStyle*>(pReqFont);
 }
 
 std::unique_ptr<SalLayout> AquaSalGraphics::GetTextLayout(ImplLayoutArgs& /*rArgs*/, int nFallbackLevel)
diff --git a/vcl/source/font/fontinstance.cxx b/vcl/source/font/fontinstance.cxx
index e5fac6c6a67b..25c637706ca6 100644
--- a/vcl/source/font/fontinstance.cxx
+++ b/vcl/source/font/fontinstance.cxx
@@ -56,6 +56,11 @@ LogicalFontInstance::LogicalFontInstance(const PhysicalFontFace& rFontFace, cons
     const_cast<FontSelectPattern*>(&m_aFontSelData)->mpFontInstance = this;
 }
 
+void LogicalFontInstance::SetNonAntialiased(bool bNonAntialiased)
+{
+    const_cast<FontSelectPattern*>(&m_aFontSelData)->mbNonAntialiased = bNonAntialiased;
+}
+
 LogicalFontInstance::~LogicalFontInstance()
 {
     mpUnicodeFallbackList.reset();
diff --git a/vcl/source/gdi/print.cxx b/vcl/source/gdi/print.cxx
index 4f62d062f8a2..90396200063e 100644
--- a/vcl/source/gdi/print.cxx
+++ b/vcl/source/gdi/print.cxx
@@ -1688,7 +1688,7 @@ void Printer::InitFont() const
     if ( mbInitFont )
     {
         // select font in the device layers
-        mpGraphics->SetFont(&mpFontInstance->GetFontSelectPattern(), 0);
+        mpGraphics->SetFont(mpFontInstance.get(), 0);
         mbInitFont = false;
     }
 }
diff --git a/vcl/source/outdev/font.cxx b/vcl/source/outdev/font.cxx
index 72338d32bac1..9b9479b25444 100644
--- a/vcl/source/outdev/font.cxx
+++ b/vcl/source/outdev/font.cxx
@@ -1003,17 +1003,15 @@ void OutputDevice::InitFont() const
     {
         // decide if antialiasing is appropriate
         bool bNonAntialiased(GetAntialiasing() & AntialiasingFlags::DisableText);
-        FontSelectPattern aPattern(mpFontInstance->GetFontSelectPattern());
         if (!utl::ConfigManager::IsFuzzing())
         {
             const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings();
             bNonAntialiased |= bool(rStyleSettings.GetDisplayOptions() & DisplayOptions::AADisable);
-            bNonAntialiased |= (int(rStyleSettings.GetAntialiasingMinPixelHeight()) > aPattern.mnHeight);
+            bNonAntialiased |= (int(rStyleSettings.GetAntialiasingMinPixelHeight()) > mpFontInstance->GetFontSelectPattern().mnHeight);
         }
-        aPattern.mbNonAntialiased = bNonAntialiased;
-
+        mpFontInstance->SetNonAntialiased(bNonAntialiased);
         // select font in the device layers
-        mpGraphics->SetFont(&aPattern, 0);
+        mpGraphics->SetFont(mpFontInstance.get(), 0);
         mbInitFont = false;
     }
 }
@@ -1314,7 +1312,7 @@ void OutputDevice::ImplDrawEmphasisMarks( SalLayout& rSalLayout )
 }
 
 std::unique_ptr<SalLayout> OutputDevice::getFallbackFont(
-    FontSelectPattern &rFontSelData, int nFallbackLevel,
+    LogicalFontInstance* pLogicalFont, int nFallbackLevel,
     ImplLayoutArgs& rLayoutArgs) const
 {
     // we need a graphics
@@ -1322,7 +1320,7 @@ std::unique_ptr<SalLayout> OutputDevice::getFallbackFont(
         return nullptr;
 
     assert(mpGraphics != nullptr);
-    mpGraphics->SetFont( &rFontSelData, nFallbackLevel );
+    mpGraphics->SetFont( pLogicalFont, nFallbackLevel );
 
     rLayoutArgs.ResetPos();
     std::unique_ptr<SalLayout> pFallback = mpGraphics->GetTextLayout( rLayoutArgs, nFallbackLevel );
@@ -1383,7 +1381,6 @@ std::unique_ptr<SalLayout> OutputDevice::ImplGlyphFallbackLayout( std::unique_pt
         if( !pFallbackFont )
             break;
 
-        aFontSelData.mpFontInstance = pFallbackFont;
         if( nFallbackLevel < MAX_FALLBACK-1)
         {
             // ignore fallback font if it is the same as the original font
@@ -1397,14 +1394,14 @@ std::unique_ptr<SalLayout> OutputDevice::ImplGlyphFallbackLayout( std::unique_pt
         }
 
         // create and add glyph fallback layout to multilayout
-        std::unique_ptr<SalLayout> pFallback = getFallbackFont(aFontSelData,
+        std::unique_ptr<SalLayout> pFallback = getFallbackFont(pFallbackFont.get(),
             nFallbackLevel, rLayoutArgs);
         if (pFallback)
         {
             if( !pMultiSalLayout )
                 pMultiSalLayout.reset( new MultiSalLayout( std::move(pSalLayout) ) );
             pMultiSalLayout->AddFallback( std::move(pFallback),
-                rLayoutArgs.maRuns, aFontSelData.mpFontInstance->GetFontFace() );
+                rLayoutArgs.maRuns, pFallbackFont->GetFontFace() );
             if (nFallbackLevel == MAX_FALLBACK-1)
                 pMultiSalLayout->SetIncomplete(true);
         }
diff --git a/vcl/unx/generic/gdi/cairotextrender.cxx b/vcl/unx/generic/gdi/cairotextrender.cxx
index 4711f7084ab9..600a1eaafa81 100644
--- a/vcl/unx/generic/gdi/cairotextrender.cxx
+++ b/vcl/unx/generic/gdi/cairotextrender.cxx
@@ -84,7 +84,7 @@ CairoTextRender::CairoTextRender()
         rp = nullptr;
 }
 
-void CairoTextRender::setFont( const FontSelectPattern *pEntry, int nFallbackLevel )
+void CairoTextRender::setFont( LogicalFontInstance *pEntry, int nFallbackLevel )
 {
     // release all no longer needed font resources
     for( int i = nFallbackLevel; i < MAX_FALLBACK; ++i )
@@ -102,7 +102,7 @@ void CairoTextRender::setFont( const FontSelectPattern *pEntry, int nFallbackLev
         return;
 
     // handle the request for a non-native X11-font => use the GlyphCache
-    FreetypeFont* pFreetypeFont = GlyphCache::GetInstance().CacheFont( *pEntry );
+    FreetypeFont* pFreetypeFont = GlyphCache::GetInstance().CacheFont(pEntry->GetFontSelectPattern());
     if( pFreetypeFont != nullptr )
     {
         // ignore fonts with e.g. corrupted font files
@@ -364,7 +364,7 @@ bool CairoTextRender::GetFontCapabilities(vcl::FontCapabilities &rGetImplFontCap
 
 // SalGraphics
 
-void CairoTextRender::SetFont( const FontSelectPattern *pEntry, int nFallbackLevel )
+void CairoTextRender::SetFont( LogicalFontInstance *pEntry, int nFallbackLevel )
 {
     setFont(pEntry, nFallbackLevel);
 }
diff --git a/vcl/unx/generic/gdi/font.cxx b/vcl/unx/generic/gdi/font.cxx
index 9cdbff3ea69d..381e79373953 100644
--- a/vcl/unx/generic/gdi/font.cxx
+++ b/vcl/unx/generic/gdi/font.cxx
@@ -69,8 +69,7 @@ bool X11SalGraphics::GetFontCapabilities(vcl::FontCapabilities &rGetImplFontCapa
 }
 
 // SalGraphics
-
-void X11SalGraphics::SetFont( const FontSelectPattern *pEntry, int nFallbackLevel )
+void X11SalGraphics::SetFont(LogicalFontInstance* pEntry, int nFallbackLevel)
 {
     mxTextRenderImpl->SetFont(pEntry, nFallbackLevel);
 }
diff --git a/vcl/unx/generic/print/genpspgraphics.cxx b/vcl/unx/generic/print/genpspgraphics.cxx
index b73fc595daea..7bd9490899ad 100644
--- a/vcl/unx/generic/print/genpspgraphics.cxx
+++ b/vcl/unx/generic/print/genpspgraphics.cxx
@@ -592,7 +592,7 @@ bool GenPspGraphics::GetFontCapabilities(vcl::FontCapabilities &rFontCapabilitie
     return m_pFreetypeFont[0]->GetFontCapabilities(rFontCapabilities);
 }
 
-void GenPspGraphics::SetFont( const FontSelectPattern *pEntry, int nFallbackLevel )
+void GenPspGraphics::SetFont( LogicalFontInstance *pFontInstance, int nFallbackLevel )
 {
     // release all fonts that are to be overridden
     for( int i = nFallbackLevel; i < MAX_FALLBACK; ++i )
@@ -606,32 +606,36 @@ void GenPspGraphics::SetFont( const FontSelectPattern *pEntry, int nFallbackLeve
     }
 
     // return early if there is no new font
-    if( !pEntry )
+    if (!pFontInstance)
         return;
 
-    sal_IntPtr nID = pEntry->mpFontInstance ? pEntry->mpFontInstance->GetFontFace()->GetFontId() : 0;
+    sal_IntPtr nID = pFontInstance->GetFontFace()->GetFontId();
+
+    const FontSelectPattern& rEntry = pFontInstance->GetFontSelectPattern();
 
     // determine which font attributes need to be emulated
     bool bArtItalic = false;
     bool bArtBold = false;
-    if( pEntry->GetItalic() == ITALIC_OBLIQUE || pEntry->GetItalic() == ITALIC_NORMAL )
+    if( rEntry.GetItalic() == ITALIC_OBLIQUE || rEntry.GetItalic() == ITALIC_NORMAL )
     {
         FontItalic eItalic = m_pPrinterGfx->GetFontMgr().getFontItalic( nID );
         if( eItalic != ITALIC_NORMAL && eItalic != ITALIC_OBLIQUE )
             bArtItalic = true;
     }
-    int nWeight = static_cast<int>(pEntry->GetWeight());
+    int nWeight = static_cast<int>(rEntry.GetWeight());
     int nRealWeight = static_cast<int>(m_pPrinterGfx->GetFontMgr().getFontWeight( nID ));
     if( nRealWeight <= int(WEIGHT_MEDIUM) && nWeight > int(WEIGHT_MEDIUM) )
     {
         bArtBold = true;
     }
 
+    assert(rEntry.mpFontInstance == pFontInstance);
+
     // also set the serverside font for layouting
-    if( pEntry->mpFontInstance )
+    if( rEntry.mpFontInstance )
     {
         // requesting a font provided by builtin rasterizer
-        FreetypeFont* pFreetypeFont = GlyphCache::GetInstance().CacheFont( *pEntry );
+        FreetypeFont* pFreetypeFont = GlyphCache::GetInstance().CacheFont( rEntry );
         if( pFreetypeFont != nullptr )
         {
             if( pFreetypeFont->TestFont() )
@@ -643,10 +647,10 @@ void GenPspGraphics::SetFont( const FontSelectPattern *pEntry, int nFallbackLeve
 
     // set the printer font
     m_pPrinterGfx->SetFont( nID,
-                            pEntry->mnHeight,
-                            pEntry->mnWidth,
-                            pEntry->mnOrientation,
-                            pEntry->mbVertical,
+                            rEntry.mnHeight,
+                            rEntry.mnWidth,
+                            rEntry.mnOrientation,
+                            rEntry.mbVertical,
                             bArtItalic,
                             bArtBold
                             );
diff --git a/vcl/win/gdi/salfont.cxx b/vcl/win/gdi/salfont.cxx
index c471c0c3be1f..c4970b0ce9b4 100644
--- a/vcl/win/gdi/salfont.cxx
+++ b/vcl/win/gdi/salfont.cxx
@@ -845,7 +845,7 @@ void ImplGetLogFontFromFontSelect( HDC hDC,
     }
 }
 
-HFONT WinSalGraphics::ImplDoSetFont(FontSelectPattern const * i_pFont,
+HFONT WinSalGraphics::ImplDoSetFont(FontSelectPattern const & i_rFont,
                                     const PhysicalFontFace * i_pFontFace,
                                     float& o_rFontScale,
                                     HFONT& o_rOldFont)
@@ -860,7 +860,7 @@ HFONT WinSalGraphics::ImplDoSetFont(FontSelectPattern const * i_pFont,
         hdcScreen = GetDC(nullptr);
 
     LOGFONTW aLogFont;
-    ImplGetLogFontFromFontSelect( getHDC(), i_pFont, i_pFontFace, aLogFont );
+    ImplGetLogFontFromFontSelect( getHDC(), &i_rFont, i_pFontFace, aLogFont );
 
     // #i47675# limit font requests to MAXFONTHEIGHT
     // TODO: share MAXFONTHEIGHT font instance
@@ -912,7 +912,7 @@ HFONT WinSalGraphics::ImplDoSetFont(FontSelectPattern const * i_pFont,
     return hNewFont;
 }
 
-void WinSalGraphics::SetFont( const FontSelectPattern* pFont, int nFallbackLevel )
+void WinSalGraphics::SetFont(LogicalFontInstance* pFont, int nFallbackLevel)
 {
     // return early if there is no new font
     if( !pFont )
@@ -939,10 +939,10 @@ void WinSalGraphics::SetFont( const FontSelectPattern* pFont, int nFallbackLevel
 
     // WinSalGraphics::GetEmbedFontData does not set mpFontInstance
     // since it is interested in font file data only.
-    mpWinFontEntry[ nFallbackLevel ] = reinterpret_cast<WinFontInstance*>( pFont->mpFontInstance.get() );
+    mpWinFontEntry[ nFallbackLevel ] = reinterpret_cast<WinFontInstance*>(pFont);
 
     HFONT hOldFont = nullptr;
-    HFONT hNewFont = ImplDoSetFont(pFont, nullptr, mfFontScale[ nFallbackLevel ], hOldFont);
+    HFONT hNewFont = ImplDoSetFont(pFont->GetFontSelectPattern(), nullptr, mfFontScale[ nFallbackLevel ], hOldFont);
     mfCurrentFontScale = mfFontScale[nFallbackLevel];
 
     if( !mhDefFont )
@@ -1659,7 +1659,7 @@ bool WinSalGraphics::CreateFontSubset( const OUString& rToFile,
     ScopedFont aOldFont(*this);
     float fScale = 1.0;
     HFONT hOldFont = nullptr;
-    ImplDoSetFont(&aIFSD, pFont, fScale, hOldFont);
+    ImplDoSetFont(aIFSD, pFont, fScale, hOldFont);
 
     WinFontFace const * pWinFontData = static_cast<WinFontFace const *>(pFont);
 
@@ -1780,7 +1780,7 @@ const void* WinSalGraphics::GetEmbedFontData(const PhysicalFontFace* pFont, long
 
     float fScale = 0.0;
     HFONT hOldFont = nullptr;
-    ImplDoSetFont(&aIFSD, pFont, fScale, hOldFont);
+    ImplDoSetFont(aIFSD, pFont, fScale, hOldFont);
 
     // get the raw font file data
     RawFontData aRawFontData( getHDC() );
@@ -1811,7 +1811,7 @@ void WinSalGraphics::GetGlyphWidths( const PhysicalFontFace* pFont,
 
     float fScale = 0.0;
     HFONT hOldFont = nullptr;
-    ImplDoSetFont(&aIFSD, pFont, fScale, hOldFont);
+    ImplDoSetFont(aIFSD, pFont, fScale, hOldFont);
 
     // get raw font file data
     const RawFontData xRawFontData( getHDC() );


More information about the Libreoffice-commits mailing list