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

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


 vcl/inc/PhysicalFontCollection.hxx             |    2 -
 vcl/inc/PhysicalFontFace.hxx                   |    3 -
 vcl/inc/fontinstance.hxx                       |    8 ++---
 vcl/inc/headless/svpgdi.hxx                    |    2 -
 vcl/inc/impfontcache.hxx                       |    5 +--
 vcl/inc/qt5/Qt5Font.hxx                        |    4 +-
 vcl/inc/qt5/Qt5FontFace.hxx                    |    2 -
 vcl/inc/quartz/salgdi.h                        |    6 +--
 vcl/inc/salgdi.hxx                             |    4 +-
 vcl/inc/textrender.hxx                         |    2 -
 vcl/inc/unx/cairotextrender.hxx                |    4 +-
 vcl/inc/unx/fontmanager.hxx                    |    2 -
 vcl/inc/unx/freetype_glyphcache.hxx            |    6 +--
 vcl/inc/unx/genpspgraphics.h                   |    2 -
 vcl/inc/unx/glyphcache.hxx                     |    8 ++---
 vcl/inc/unx/salgdi.h                           |    4 +-
 vcl/inc/win/salgdi.h                           |    2 -
 vcl/inc/win/winlayout.hxx                      |    4 +-
 vcl/qt5/Qt5Font.cxx                            |    2 -
 vcl/qt5/Qt5FontFace.cxx                        |    2 -
 vcl/quartz/ctfonts.cxx                         |    5 +--
 vcl/source/font/PhysicalFontCollection.cxx     |    2 -
 vcl/source/font/PhysicalFontFace.cxx           |    2 -
 vcl/source/font/fontcache.cxx                  |    8 ++---
 vcl/source/font/fontinstance.cxx               |    5 +--
 vcl/source/gdi/pdfwriter_impl.hxx              |    2 -
 vcl/source/outdev/font.cxx                     |    8 +----
 vcl/unx/generic/gdi/cairotextrender.cxx        |    6 +--
 vcl/unx/generic/glyphs/freetype_glyphcache.cxx |    2 -
 vcl/unx/generic/glyphs/glyphcache.cxx          |   39 ++++++++++++++-----------
 vcl/unx/generic/print/genpspgraphics.cxx       |   23 +++++---------
 vcl/win/gdi/salfont.cxx                        |    2 -
 vcl/win/gdi/winlayout.cxx                      |    2 -
 33 files changed, 88 insertions(+), 92 deletions(-)

New commits:
commit b10c8f3fce37d72019f4767fdb9612b46845aecd
Author:     Caolán McNamara <caolanm at redhat.com>
AuthorDate: Tue Aug 21 08:38:57 2018 +0100
Commit:     Caolán McNamara <caolanm at redhat.com>
CommitDate: Wed Aug 22 00:24:15 2018 +0200

    turn the cache around to work on LogicalFontInstance
    
    instead of a FontSelectPattern with an associated LogicalFontInstance
    use a LogicalFontInstance with owned FontSelectPatternAttributes
    
    Change-Id: I939f84731fcb8db5ff6484dcfbd2f9199bb50d23
    Reviewed-on: https://gerrit.libreoffice.org/59388
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>
    Tested-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/vcl/inc/PhysicalFontCollection.hxx b/vcl/inc/PhysicalFontCollection.hxx
index d8b6006cd6bf..43423b72a37a 100644
--- a/vcl/inc/PhysicalFontCollection.hxx
+++ b/vcl/inc/PhysicalFontCollection.hxx
@@ -49,7 +49,7 @@ public:
     // find the device font family
     PhysicalFontFamily*     FindFontFamily( const OUString& rFontName ) const;
     PhysicalFontFamily*     FindOrCreateFontFamily( const OUString &rFamilyName );
-    PhysicalFontFamily*     FindFontFamily( FontSelectPattern& ) const;
+    PhysicalFontFamily*     FindFontFamily( FontSelectPatternAttributes& ) const;
     PhysicalFontFamily*     FindFontFamilyByTokenNames(const OUString& rTokenStr) const;
     PhysicalFontFamily*     FindFontFamilyByAttributes(ImplFontAttrs nSearchType, FontWeight, FontWidth,
                                              FontItalic, const OUString& rSearchFamily) const;
diff --git a/vcl/inc/PhysicalFontFace.hxx b/vcl/inc/PhysicalFontFace.hxx
index 7abde1e05aea..9947ac759cf2 100644
--- a/vcl/inc/PhysicalFontFace.hxx
+++ b/vcl/inc/PhysicalFontFace.hxx
@@ -28,7 +28,6 @@
 
 class LogicalFontInstance;
 struct FontMatchStatus;
-class FontSelectPattern;
 class FontSelectPatternAttributes;
 class PhysicalFontFamily;
 
@@ -55,7 +54,7 @@ public:
 class VCL_PLUGIN_PUBLIC PhysicalFontFace : public FontAttributes, public salhelper::SimpleReferenceObject
 {
 public:
-    virtual rtl::Reference<LogicalFontInstance> CreateFontInstance(const FontSelectPattern&) const;
+    virtual rtl::Reference<LogicalFontInstance> CreateFontInstance(const FontSelectPatternAttributes&) const;
 
     int                     GetHeight() const           { return mnHeight; }
     int                     GetWidth() const            { return mnWidth; }
diff --git a/vcl/inc/fontinstance.hxx b/vcl/inc/fontinstance.hxx
index 597c747553ac..e5b42e831ea6 100644
--- a/vcl/inc/fontinstance.hxx
+++ b/vcl/inc/fontinstance.hxx
@@ -39,7 +39,7 @@ class PhysicalFontFace;
 class VCL_PLUGIN_PUBLIC LogicalFontInstance : public salhelper::SimpleReferenceObject
 {
     // just declaring the factory function doesn't work AKA
-    // friend LogicalFontInstance* PhysicalFontFace::CreateFontInstance(const FontSelectPattern&) const;
+    // friend LogicalFontInstance* PhysicalFontFace::CreateFontInstance(const FontSelectPatternAttributes&) const;
     friend class PhysicalFontFace;
     friend class ImplFontCache;
 
@@ -62,7 +62,7 @@ public: // TODO: make data members private
     void SetAverageWidthFactor(double nFactor) { m_nAveWidthFactor = nFactor; }
     void SetNonAntialiased(bool bNonAntialiased);
     double GetAverageWidthFactor() const { return m_nAveWidthFactor; }
-    const FontSelectPattern& GetFontSelectPattern() const { return m_aFontSelData; }
+    const FontSelectPatternAttributes& GetFontSelectPattern() const { return m_aFontSelData; }
 
     const PhysicalFontFace* GetFontFace() const { return m_pFontFace.get(); }
     const ImplFontCache* GetFontCache() const { return mpFontCache; }
@@ -73,7 +73,7 @@ public: // TODO: make data members private
     static inline void DecodeOpenTypeTag(const uint32_t nTableTag, char* pTagName);
 
 protected:
-    explicit LogicalFontInstance(const PhysicalFontFace&, const FontSelectPattern&);
+    explicit LogicalFontInstance(const PhysicalFontFace&, const FontSelectPatternAttributes&);
 
     // Takes ownership of pHbFace.
     hb_font_t* InitHbFont(hb_face_t* pHbFace) const;
@@ -87,7 +87,7 @@ private:
     typedef ::std::unordered_map< ::std::pair<sal_UCS4,FontWeight>, OUString > UnicodeFallbackList;
     std::unique_ptr<UnicodeFallbackList> mpUnicodeFallbackList;
     ImplFontCache * mpFontCache;
-    const FontSelectPattern m_aFontSelData;
+    const FontSelectPatternAttributes m_aFontSelData;
     hb_font_t* m_pHbFont;
     double m_nAveWidthFactor;
     rtl::Reference<PhysicalFontFace> m_pFontFace;
diff --git a/vcl/inc/headless/svpgdi.hxx b/vcl/inc/headless/svpgdi.hxx
index a85193ea6521..58761d0fcb1a 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( LogicalFontInstance*, 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/impfontcache.hxx b/vcl/inc/impfontcache.hxx
index 47314d4ffeaf..e8b7b191137b 100644
--- a/vcl/inc/impfontcache.hxx
+++ b/vcl/inc/impfontcache.hxx
@@ -42,7 +42,7 @@ private:
     typedef std::unordered_map<FontSelectPatternAttributes, rtl::Reference<LogicalFontInstance>, IFSD_Hash, IFSD_Equal> FontInstanceList;
     FontInstanceList    maFontInstanceList;
 
-    rtl::Reference<LogicalFontInstance> GetFontInstance(PhysicalFontCollection const*, FontSelectPattern&);
+    rtl::Reference<LogicalFontInstance> GetFontInstance(PhysicalFontCollection const*, FontSelectPatternAttributes&);
 
 public:
                         ImplFontCache();
@@ -50,7 +50,8 @@ public:
 
     rtl::Reference<LogicalFontInstance> GetFontInstance( PhysicalFontCollection const *,
                              const vcl::Font&, const Size& rPixelSize, float fExactHeight);
-    rtl::Reference<LogicalFontInstance> GetGlyphFallbackFont( PhysicalFontCollection const *, FontSelectPattern&,
+    rtl::Reference<LogicalFontInstance> GetGlyphFallbackFont( PhysicalFontCollection const *, FontSelectPatternAttributes&,
+                            LogicalFontInstance* pLogicalFont,
                             int nFallbackLevel, OUString& rMissingCodes );
 
     void                Invalidate();
diff --git a/vcl/inc/qt5/Qt5Font.hxx b/vcl/inc/qt5/Qt5Font.hxx
index 034cda35c2d4..ca975502c920 100644
--- a/vcl/inc/qt5/Qt5Font.hxx
+++ b/vcl/inc/qt5/Qt5Font.hxx
@@ -28,11 +28,11 @@
 class Qt5Font final : public QFont, public LogicalFontInstance
 {
     friend rtl::Reference<LogicalFontInstance>
-    Qt5FontFace::CreateFontInstance(const FontSelectPattern&) const;
+    Qt5FontFace::CreateFontInstance(const FontSelectPatternAttributes&) const;
 
     virtual hb_font_t* ImplInitHbFont() override;
 
-    explicit Qt5Font(const PhysicalFontFace&, const FontSelectPattern&);
+    explicit Qt5Font(const PhysicalFontFace&, const FontSelectPatternAttributes&);
 
 public:
     virtual ~Qt5Font() override;
diff --git a/vcl/inc/qt5/Qt5FontFace.hxx b/vcl/inc/qt5/Qt5FontFace.hxx
index 70522f67e0d6..3fd6c1599b56 100644
--- a/vcl/inc/qt5/Qt5FontFace.hxx
+++ b/vcl/inc/qt5/Qt5FontFace.hxx
@@ -48,7 +48,7 @@ public:
     bool HasChar(sal_uInt32 cChar) const;
 
     rtl::Reference<LogicalFontInstance>
-    CreateFontInstance(const FontSelectPattern& rFSD) const override;
+    CreateFontInstance(const FontSelectPatternAttributes& rFSD) const override;
 
 protected:
     Qt5FontFace(const Qt5FontFace&);
diff --git a/vcl/inc/quartz/salgdi.h b/vcl/inc/quartz/salgdi.h
index 31a8353a17ed..87b3a028ab37 100644
--- a/vcl/inc/quartz/salgdi.h
+++ b/vcl/inc/quartz/salgdi.h
@@ -68,7 +68,7 @@ public:
     bool                            GetFontCapabilities(vcl::FontCapabilities &rFontCapabilities) const;
     bool                            HasChar( sal_uInt32 cChar ) const;
 
-    rtl::Reference<LogicalFontInstance> CreateFontInstance(const FontSelectPattern&) const override;
+    rtl::Reference<LogicalFontInstance> CreateFontInstance(const FontSelectPatternAttributes&) const override;
 
 private:
     const sal_IntPtr                mnFontId;
@@ -79,7 +79,7 @@ private:
 
 class CoreTextStyle : public LogicalFontInstance
 {
-    friend rtl::Reference<LogicalFontInstance> CoreTextFontFace::CreateFontInstance(const FontSelectPattern&) const;
+    friend rtl::Reference<LogicalFontInstance> CoreTextFontFace::CreateFontInstance(const FontSelectPatternAttributes&) const;
 
 public:
     ~CoreTextStyle() override;
@@ -96,7 +96,7 @@ public:
     float               mfFontRotation;
 
 private:
-    explicit CoreTextStyle(const PhysicalFontFace&, const FontSelectPattern&);
+    explicit CoreTextStyle(const PhysicalFontFace&, const FontSelectPatternAttributes&);
 
     virtual hb_font_t* ImplInitHbFont() override;
 
diff --git a/vcl/inc/salgdi.hxx b/vcl/inc/salgdi.hxx
index 84f0551a6d2d..f6c3aa2d3870 100644
--- a/vcl/inc/salgdi.hxx
+++ b/vcl/inc/salgdi.hxx
@@ -34,7 +34,7 @@
 
 class PhysicalFontCollection;
 class SalBitmap;
-class FontSelectPattern;
+class FontSelectPatternAttributes;
 class FontAttributes;
 class PhysicalFontFace;
 class SalLayout;
@@ -123,7 +123,7 @@ public:
     virtual void                SetTextColor( Color nColor ) = 0;
 
     // set the font
-    virtual void                SetFont( LogicalFontInstance*, 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 0dbf0bdd56bb..33c803dba82b 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( LogicalFontInstance*, 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 707bec9a0bf7..8d18836be91b 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( LogicalFontInstance *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( LogicalFontInstance*, 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/fontmanager.hxx b/vcl/inc/unx/fontmanager.hxx
index bdd2c9e1a850..bd05ec1b4ce9 100644
--- a/vcl/inc/unx/fontmanager.hxx
+++ b/vcl/inc/unx/fontmanager.hxx
@@ -44,7 +44,7 @@
 
 class FontSubsetInfo;
 class FontConfigFontOptions;
-class FontSelectPattern;
+class FontSelectPatternAttributes;
 class GenericUnixSalData;
 
 namespace psp {
diff --git a/vcl/inc/unx/freetype_glyphcache.hxx b/vcl/inc/unx/freetype_glyphcache.hxx
index b1db824ccdd3..2f09f3069465 100644
--- a/vcl/inc/unx/freetype_glyphcache.hxx
+++ b/vcl/inc/unx/freetype_glyphcache.hxx
@@ -114,21 +114,21 @@ private:
 public:
                             FreetypeFontFace( FreetypeFontInfo*, const FontAttributes& );
 
-    virtual rtl::Reference<LogicalFontInstance> CreateFontInstance( const FontSelectPattern& ) const override;
+    virtual rtl::Reference<LogicalFontInstance> CreateFontInstance( const FontSelectPatternAttributes& ) const override;
     virtual sal_IntPtr      GetFontId() const override { return mpFreetypeFontInfo->GetFontId(); }
 };
 
 // a class for cache entries for physical font instances that are based on serverfonts
 class VCL_DLLPUBLIC FreetypeFontInstance : public LogicalFontInstance
 {
-    friend rtl::Reference<LogicalFontInstance> FreetypeFontFace::CreateFontInstance(const FontSelectPattern&) const;
+    friend rtl::Reference<LogicalFontInstance> FreetypeFontFace::CreateFontInstance(const FontSelectPatternAttributes&) const;
 
     FreetypeFont* mpFreetypeFont;
 
     virtual hb_font_t* ImplInitHbFont() override;
 
 protected:
-    explicit FreetypeFontInstance(const PhysicalFontFace& rPFF, const FontSelectPattern& rFSP);
+    explicit FreetypeFontInstance(const PhysicalFontFace& rPFF, const FontSelectPatternAttributes& rFSP);
 
 public:
     virtual ~FreetypeFontInstance() override;
diff --git a/vcl/inc/unx/genpspgraphics.h b/vcl/inc/unx/genpspgraphics.h
index ecd4ce9a11d9..fd06248ff19f 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( LogicalFontInstance*, 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/glyphcache.hxx b/vcl/inc/unx/glyphcache.hxx
index a7c49797bc48..2d1caf537b9c 100644
--- a/vcl/inc/unx/glyphcache.hxx
+++ b/vcl/inc/unx/glyphcache.hxx
@@ -65,7 +65,7 @@ public:
 
     void                    AnnounceFonts( PhysicalFontCollection* ) const;
 
-    FreetypeFont*           CacheFont( const FontSelectPattern& );
+    FreetypeFont*           CacheFont(LogicalFontInstance* pFontInstance);
     void                    UncacheFont( FreetypeFont& );
     void                    ClearFontCache();
     void                    InvalidateAllGlyphs();
@@ -83,9 +83,9 @@ private:
 
     // the GlyphCache's FontList matches a font request to a serverfont instance
     // the FontList key's mpFontData member is reinterpreted as integer font id
-    struct IFSD_Equal{  bool operator()( const FontSelectPattern&, const FontSelectPattern& ) const; };
-    struct IFSD_Hash{ size_t operator()( const FontSelectPattern& ) const; };
-    typedef std::unordered_map<FontSelectPattern,std::unique_ptr<FreetypeFont>,IFSD_Hash,IFSD_Equal > FontList;
+    struct IFSD_Equal{  bool operator()( const rtl::Reference<LogicalFontInstance>&, const rtl::Reference<LogicalFontInstance>& ) const; };
+    struct IFSD_Hash{ size_t operator()( const rtl::Reference<LogicalFontInstance>& ) const; };
+    typedef std::unordered_map<rtl::Reference<LogicalFontInstance>,std::unique_ptr<FreetypeFont>,IFSD_Hash,IFSD_Equal > FontList;
 
     FontList                maFontList;
     sal_uLong               mnMaxSize;      // max overall cache size in bytes
diff --git a/vcl/inc/unx/salgdi.h b/vcl/inc/unx/salgdi.h
index 5bca1ae938c7..057d1953caab 100644
--- a/vcl/inc/unx/salgdi.h
+++ b/vcl/inc/unx/salgdi.h
@@ -43,7 +43,7 @@
 typedef unsigned long Pixel;
 
 class FontAttributes;
-class FontSelectPattern;
+class FontSelectPatternAttributes;
 class SalBitmap;
 class SalColormap;
 class SalDisplay;
@@ -115,7 +115,7 @@ public:
     virtual void                    SetROPFillColor( SalROPColor nROPColor ) override;
 
     virtual void                    SetTextColor( Color nColor ) override;
-    virtual void                    SetFont( LogicalFontInstance*, 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 ebb9fc8eac3d..27a5e8b46ebe 100644
--- a/vcl/inc/win/salgdi.h
+++ b/vcl/inc/win/salgdi.h
@@ -63,7 +63,7 @@ public:
                                 BYTE nPitchAndFamily  );
     virtual                 ~WinFontFace() override;
 
-    virtual rtl::Reference<LogicalFontInstance> CreateFontInstance( const FontSelectPattern& ) const override;
+    virtual rtl::Reference<LogicalFontInstance> CreateFontInstance( const FontSelectPatternAttributes& ) const override;
     virtual sal_IntPtr      GetFontId() const override;
     void                    SetFontId( sal_IntPtr nId ) { mnId = nId; }
     void                    UpdateFromHDC( HDC ) const;
diff --git a/vcl/inc/win/winlayout.hxx b/vcl/inc/win/winlayout.hxx
index 598d90c60588..4c4b7feab468 100644
--- a/vcl/inc/win/winlayout.hxx
+++ b/vcl/inc/win/winlayout.hxx
@@ -145,7 +145,7 @@ public:
 // win32 specific physical font instance
 class WinFontInstance : public LogicalFontInstance
 {
-    friend rtl::Reference<LogicalFontInstance> WinFontFace::CreateFontInstance(const FontSelectPattern&) const;
+    friend rtl::Reference<LogicalFontInstance> WinFontFace::CreateFontInstance(const FontSelectPatternAttributes&) const;
 
 public:
     virtual ~WinFontInstance() override;
@@ -162,7 +162,7 @@ public:
     void UnsetHFONT() { m_hFont = nullptr; }
 
 private:
-    explicit WinFontInstance(const PhysicalFontFace&, const FontSelectPattern&);
+    explicit WinFontInstance(const PhysicalFontFace&, const FontSelectPatternAttributes&);
 
     virtual hb_font_t* ImplInitHbFont() override;
 
diff --git a/vcl/qt5/Qt5Font.cxx b/vcl/qt5/Qt5Font.cxx
index dc393dd1cae8..a4d4d1d08a0b 100644
--- a/vcl/qt5/Qt5Font.cxx
+++ b/vcl/qt5/Qt5Font.cxx
@@ -55,7 +55,7 @@ static QFont::Weight GetQFontWeight(FontWeight eWeight)
     return QFont::Normal;
 }
 
-Qt5Font::Qt5Font(const PhysicalFontFace& rPFF, const FontSelectPattern& rFSP)
+Qt5Font::Qt5Font(const PhysicalFontFace& rPFF, const FontSelectPatternAttributes& rFSP)
     : LogicalFontInstance(rPFF, rFSP)
 {
     setFamily(toQString(rPFF.GetFamilyName()));
diff --git a/vcl/qt5/Qt5FontFace.cxx b/vcl/qt5/Qt5FontFace.cxx
index 10f79aa559bd..d122019307d2 100644
--- a/vcl/qt5/Qt5FontFace.cxx
+++ b/vcl/qt5/Qt5FontFace.cxx
@@ -117,7 +117,7 @@ Qt5FontFace::~Qt5FontFace() {}
 sal_IntPtr Qt5FontFace::GetFontId() const { return reinterpret_cast<sal_IntPtr>(&m_aFontId); }
 
 rtl::Reference<LogicalFontInstance>
-Qt5FontFace::CreateFontInstance(const FontSelectPattern& rFSD) const
+Qt5FontFace::CreateFontInstance(const FontSelectPatternAttributes& rFSD) const
 {
     return new Qt5Font(*this, rFSD);
 }
diff --git a/vcl/quartz/ctfonts.cxx b/vcl/quartz/ctfonts.cxx
index 869ece86732f..a3836f66123c 100644
--- a/vcl/quartz/ctfonts.cxx
+++ b/vcl/quartz/ctfonts.cxx
@@ -45,7 +45,7 @@ inline double toRadian(int nDegree)
     return nDegree * (M_PI / 1800.0);
 }
 
-CoreTextStyle::CoreTextStyle(const PhysicalFontFace& rPFF, const FontSelectPattern& rFSP)
+CoreTextStyle::CoreTextStyle(const PhysicalFontFace& rPFF, const FontSelectPatternAttributes& rFSP)
     : LogicalFontInstance(rPFF, rFSP)
     , mfFontStretch( 1.0 )
     , mfFontRotation( 0.0 )
@@ -284,8 +284,7 @@ hb_font_t* CoreTextStyle::ImplInitHbFont()
     return InitHbFont(pHbFace);
 }
 
-
-rtl::Reference<LogicalFontInstance> CoreTextFontFace::CreateFontInstance(const FontSelectPattern& rFSD) const
+rtl::Reference<LogicalFontInstance> CoreTextFontFace::CreateFontInstance(const FontSelectPatternAttributes& rFSD) const
 {
     return new CoreTextStyle(*this, rFSD);
 }
diff --git a/vcl/source/font/PhysicalFontCollection.cxx b/vcl/source/font/PhysicalFontCollection.cxx
index fc5a08ca8feb..821da5cdf937 100644
--- a/vcl/source/font/PhysicalFontCollection.cxx
+++ b/vcl/source/font/PhysicalFontCollection.cxx
@@ -943,7 +943,7 @@ static bool FindMetricCompatibleFont(FontSelectPatternAttributes& rFontSelData)
     return false;
 }
 
-PhysicalFontFamily* PhysicalFontCollection::FindFontFamily( FontSelectPattern& rFSD ) const
+PhysicalFontFamily* PhysicalFontCollection::FindFontFamily( FontSelectPatternAttributes& rFSD ) const
 {
     // give up if no fonts are available
     if( !Count() )
diff --git a/vcl/source/font/PhysicalFontFace.cxx b/vcl/source/font/PhysicalFontFace.cxx
index a244e7966eb6..5aa39e677dcb 100644
--- a/vcl/source/font/PhysicalFontFace.cxx
+++ b/vcl/source/font/PhysicalFontFace.cxx
@@ -37,7 +37,7 @@ PhysicalFontFace::PhysicalFontFace( const FontAttributes& rDFA )
             SetSymbolFlag( true );
 }
 
-rtl::Reference<LogicalFontInstance> PhysicalFontFace::CreateFontInstance(const FontSelectPattern& rFSD) const
+rtl::Reference<LogicalFontInstance> PhysicalFontFace::CreateFontInstance(const FontSelectPatternAttributes& rFSD) const
 {
     return new LogicalFontInstance(*this, rFSD);
 }
diff --git a/vcl/source/font/fontcache.cxx b/vcl/source/font/fontcache.cxx
index 5ab66052e9c1..4272fd1ef113 100644
--- a/vcl/source/font/fontcache.cxx
+++ b/vcl/source/font/fontcache.cxx
@@ -95,12 +95,12 @@ rtl::Reference<LogicalFontInstance> ImplFontCache::GetFontInstance( PhysicalFont
     const vcl::Font& rFont, const Size& rSize, float fExactHeight )
 {
     // initialize internal font request object
-    FontSelectPattern aFontSelData(rFont, rFont.GetFamilyName(), rSize, fExactHeight);
+    FontSelectPatternAttributes aFontSelData(rFont, rFont.GetFamilyName(), rSize, fExactHeight);
     return GetFontInstance( pFontList, aFontSelData );
 }
 
 rtl::Reference<LogicalFontInstance> ImplFontCache::GetFontInstance( PhysicalFontCollection const * pFontList,
-    FontSelectPattern& aFontSelData )
+    FontSelectPatternAttributes& aFontSelData )
 {
     rtl::Reference<LogicalFontInstance> pFontInstance;
     PhysicalFontFamily* pFontFamily = nullptr;
@@ -192,7 +192,7 @@ rtl::Reference<LogicalFontInstance> ImplFontCache::GetFontInstance( PhysicalFont
 }
 
 rtl::Reference<LogicalFontInstance> ImplFontCache::GetGlyphFallbackFont( PhysicalFontCollection const * pFontCollection,
-    FontSelectPattern& rFontSelData, int nFallbackLevel, OUString& rMissingCodes )
+    FontSelectPatternAttributes& rFontSelData, LogicalFontInstance* pFontInstance, int nFallbackLevel, OUString& rMissingCodes )
 {
     // get a candidate font for glyph fallback
     // unless the previously selected font got a device specific substitution
@@ -212,7 +212,7 @@ rtl::Reference<LogicalFontInstance> ImplFontCache::GetGlyphFallbackFont( Physica
         if (nFallbackLevel == 1)
             pFallbackData = pFontCollection->FindFontFamily("EUDC");
         if (!pFallbackData)
-            pFallbackData = pFontCollection->GetGlyphFallbackFont(rFontSelData, rFontSelData.mpFontInstance.get(), rMissingCodes, nFallbackLevel-1);
+            pFallbackData = pFontCollection->GetGlyphFallbackFont(rFontSelData, pFontInstance, rMissingCodes, nFallbackLevel-1);
         // escape when there are no font candidates
         if( !pFallbackData  )
             return nullptr;
diff --git a/vcl/source/font/fontinstance.cxx b/vcl/source/font/fontinstance.cxx
index 25c637706ca6..218787280228 100644
--- a/vcl/source/font/fontinstance.cxx
+++ b/vcl/source/font/fontinstance.cxx
@@ -40,7 +40,7 @@ namespace std
 }
 
 
-LogicalFontInstance::LogicalFontInstance(const PhysicalFontFace& rFontFace, const FontSelectPattern& rFontSelData )
+LogicalFontInstance::LogicalFontInstance(const PhysicalFontFace& rFontFace, const FontSelectPatternAttributes& rFontSelData )
     : mxFontMetric( new ImplFontMetricData( rFontSelData ))
     , mpConversion( nullptr )
     , mnLineHeight( 0 )
@@ -53,12 +53,11 @@ LogicalFontInstance::LogicalFontInstance(const PhysicalFontFace& rFontFace, cons
     , m_nAveWidthFactor(1.0f)
     , m_pFontFace(&const_cast<PhysicalFontFace&>(rFontFace))
 {
-    const_cast<FontSelectPattern*>(&m_aFontSelData)->mpFontInstance = this;
 }
 
 void LogicalFontInstance::SetNonAntialiased(bool bNonAntialiased)
 {
-    const_cast<FontSelectPattern*>(&m_aFontSelData)->mbNonAntialiased = bNonAntialiased;
+    const_cast<FontSelectPatternAttributes*>(&m_aFontSelData)->mbNonAntialiased = bNonAntialiased;
 }
 
 LogicalFontInstance::~LogicalFontInstance()
diff --git a/vcl/source/gdi/pdfwriter_impl.hxx b/vcl/source/gdi/pdfwriter_impl.hxx
index acafb54f587e..941078a0589e 100644
--- a/vcl/source/gdi/pdfwriter_impl.hxx
+++ b/vcl/source/gdi/pdfwriter_impl.hxx
@@ -48,7 +48,7 @@
 #include <PhysicalFontFace.hxx>
 
 class StyleSettings;
-class FontSelectPattern;
+class FontSelectPatternAttributes;
 class FontSubsetInfo;
 class ZCodec;
 class EncHashTransporter;
diff --git a/vcl/source/outdev/font.cxx b/vcl/source/outdev/font.cxx
index 9b9479b25444..32e76283678b 100644
--- a/vcl/source/outdev/font.cxx
+++ b/vcl/source/outdev/font.cxx
@@ -1366,18 +1366,16 @@ std::unique_ptr<SalLayout> OutputDevice::ImplGlyphFallbackLayout( std::unique_pt
     rLayoutArgs.ResetPos();
     OUString aMissingCodes = aMissingCodeBuf.makeStringAndClear();
 
-    FontSelectPattern aFontSelData(mpFontInstance->GetFontSelectPattern());
+    FontSelectPatternAttributes aFontSelData(mpFontInstance->GetFontSelectPattern());
 
     // try if fallback fonts support the missing code units
     for( int nFallbackLevel = 1; nFallbackLevel < MAX_FALLBACK; ++nFallbackLevel )
     {
         // find a font family suited for glyph fallback
-        // GetGlyphFallbackFont() needs a valid aFontSelData.mpFontInstance
+        // GetGlyphFallbackFont() needs a valid FontInstance
         // if the system-specific glyph fallback is active
-        aFontSelData.mpFontInstance = mpFontInstance; // reset the fontinstance to base-level
-
         rtl::Reference<LogicalFontInstance> pFallbackFont = mxFontCache->GetGlyphFallbackFont( mxFontCollection.get(),
-            aFontSelData, nFallbackLevel, aMissingCodes );
+            aFontSelData, mpFontInstance.get(), nFallbackLevel, aMissingCodes );
         if( !pFallbackFont )
             break;
 
diff --git a/vcl/unx/generic/gdi/cairotextrender.cxx b/vcl/unx/generic/gdi/cairotextrender.cxx
index 600a1eaafa81..3b250838e785 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( LogicalFontInstance *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( LogicalFontInstance *pEntry, int nFallbackLevel )
         return;
 
     // handle the request for a non-native X11-font => use the GlyphCache
-    FreetypeFont* pFreetypeFont = GlyphCache::GetInstance().CacheFont(pEntry->GetFontSelectPattern());
+    FreetypeFont* pFreetypeFont = GlyphCache::GetInstance().CacheFont(pEntry);
     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( LogicalFontInstance *pEntry, int nFallbackLevel )
+void CairoTextRender::SetFont(LogicalFontInstance *pEntry, int nFallbackLevel)
 {
     setFont(pEntry, nFallbackLevel);
 }
diff --git a/vcl/unx/generic/glyphs/freetype_glyphcache.cxx b/vcl/unx/generic/glyphs/freetype_glyphcache.cxx
index da5d6e650ed6..0dd01d679ad0 100644
--- a/vcl/unx/generic/glyphs/freetype_glyphcache.cxx
+++ b/vcl/unx/generic/glyphs/freetype_glyphcache.cxx
@@ -353,7 +353,7 @@ FreetypeFontFace::FreetypeFontFace( FreetypeFontInfo* pFI, const FontAttributes&
 {
 }
 
-rtl::Reference<LogicalFontInstance> FreetypeFontFace::CreateFontInstance(const FontSelectPattern& rFSD) const
+rtl::Reference<LogicalFontInstance> FreetypeFontFace::CreateFontInstance(const FontSelectPatternAttributes& rFSD) const
 {
     return new FreetypeFontInstance(*this, rFSD);
 }
diff --git a/vcl/unx/generic/glyphs/glyphcache.cxx b/vcl/unx/generic/glyphs/glyphcache.cxx
index 321707a97535..b48e3178c35b 100644
--- a/vcl/unx/generic/glyphs/glyphcache.cxx
+++ b/vcl/unx/generic/glyphs/glyphcache.cxx
@@ -72,18 +72,20 @@ void GlyphCache::ClearFontOptions()
     }
 }
 
-static inline sal_IntPtr GetFontId(const FontSelectPattern& rFSP)
+static inline sal_IntPtr GetFontId(const LogicalFontInstance& rFontInstance)
 {
-    if (rFSP.mpFontInstance && rFSP.mpFontInstance->GetFontFace())
-        return rFSP.mpFontInstance->GetFontFace()->GetFontId();
+    if (rFontInstance.GetFontFace())
+        return rFontInstance.GetFontFace()->GetFontId();
     return 0;
 }
 
 inline
-size_t GlyphCache::IFSD_Hash::operator()( const FontSelectPattern& rFontSelData ) const
+size_t GlyphCache::IFSD_Hash::operator()(const rtl::Reference<LogicalFontInstance>& rFontInstance) const
 {
     // TODO: is it worth to improve this hash function?
-    sal_uIntPtr nFontId = GetFontId(rFontSelData);
+    sal_uIntPtr nFontId = GetFontId(*rFontInstance);
+
+    const FontSelectPatternAttributes& rFontSelData = rFontInstance->GetFontSelectPattern();
 
     if (rFontSelData.maTargetName.indexOf(FontSelectPatternAttributes::FEAT_PREFIX)
         != -1)
@@ -103,15 +105,19 @@ size_t GlyphCache::IFSD_Hash::operator()( const FontSelectPattern& rFontSelData
     return nHash;
 }
 
-bool GlyphCache::IFSD_Equal::operator()( const FontSelectPattern& rA, const FontSelectPattern& rB) const
+bool GlyphCache::IFSD_Equal::operator()(const rtl::Reference<LogicalFontInstance>& rAFontInstance,
+                                        const rtl::Reference<LogicalFontInstance>& rBFontInstance) const
 {
-    if (!rA.mpFontInstance->GetFontCache() || !rB.mpFontInstance->GetFontCache())
+    if (!rAFontInstance->GetFontCache() || !rBFontInstance->GetFontCache())
         return false;
 
     // check font ids
-    if (GetFontId(rA) != GetFontId(rB))
+    if (GetFontId(*rAFontInstance) != GetFontId(*rBFontInstance))
         return false;
 
+    const FontSelectPatternAttributes& rA = rAFontInstance->GetFontSelectPattern();
+    const FontSelectPatternAttributes& rB = rBFontInstance->GetFontSelectPattern();
+
     // compare with the requested metrics
     if( (rA.mnHeight         != rB.mnHeight)
     ||  (rA.mnOrientation    != rB.mnOrientation)
@@ -174,13 +180,13 @@ void GlyphCache::ClearFontCache()
         mpFtManager->ClearFontList();
 }
 
-FreetypeFont* GlyphCache::CacheFont( const FontSelectPattern& rFontSelData )
+FreetypeFont* GlyphCache::CacheFont(LogicalFontInstance* pFontInstance)
 {
     // a serverfont request has a fontid > 0
-    if (GetFontId(rFontSelData) <= 0)
+    if (GetFontId(*pFontInstance) <= 0)
         return nullptr;
 
-    FontList::iterator it = maFontList.find(rFontSelData);
+    FontList::iterator it = maFontList.find(pFontInstance);
     if( it != maFontList.end() )
     {
         FreetypeFont* pFound = it->second.get();
@@ -191,12 +197,12 @@ FreetypeFont* GlyphCache::CacheFont( const FontSelectPattern& rFontSelData )
 
     // font not cached yet => create new font item
     FreetypeFont* pNew = nullptr;
-    if( mpFtManager )
-        pNew = mpFtManager->CreateFont(rFontSelData.mpFontInstance.get());
+    if (mpFtManager)
+        pNew = mpFtManager->CreateFont(pFontInstance);
 
     if( pNew )
     {
-        maFontList[ rFontSelData ].reset(pNew);
+        maFontList[pFontInstance].reset(pNew);
         mnBytesUsed += pNew->GetByteCount();
 
         // enable garbage collection for new font
@@ -260,8 +266,7 @@ void GlyphCache::GarbageCollect()
         pFreetypeFont->GarbageCollect( mnLruIndex+0x10000000 );
         if( pFreetypeFont == mpCurrentGCFont )
             mpCurrentGCFont = nullptr;
-        const FontSelectPattern& rIFSD = pFreetypeFont->GetFontInstance()->GetFontSelectPattern();
-        maFontList.erase( rIFSD );
+        maFontList.erase(pFreetypeFont->GetFontInstance());
         mnBytesUsed -= pFreetypeFont->GetByteCount();
 
         // remove font from list of garbage collected fonts
@@ -349,7 +354,7 @@ void FreetypeFont::GarbageCollect( long nMinLruIndex )
     }
 }
 
-FreetypeFontInstance::FreetypeFontInstance(const PhysicalFontFace& rPFF, const FontSelectPattern& rFSP)
+FreetypeFontInstance::FreetypeFontInstance(const PhysicalFontFace& rPFF, const FontSelectPatternAttributes& rFSP)
     : LogicalFontInstance(rPFF, rFSP)
     , mpFreetypeFont(nullptr)
 {}
diff --git a/vcl/unx/generic/print/genpspgraphics.cxx b/vcl/unx/generic/print/genpspgraphics.cxx
index 7bd9490899ad..aa376c7629fe 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( LogicalFontInstance *pFontInstance, 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 )
@@ -611,7 +611,7 @@ void GenPspGraphics::SetFont( LogicalFontInstance *pFontInstance, int nFallbackL
 
     sal_IntPtr nID = pFontInstance->GetFontFace()->GetFontId();
 
-    const FontSelectPattern& rEntry = pFontInstance->GetFontSelectPattern();
+    const FontSelectPatternAttributes& rEntry = pFontInstance->GetFontSelectPattern();
 
     // determine which font attributes need to be emulated
     bool bArtItalic = false;
@@ -629,20 +629,15 @@ void GenPspGraphics::SetFont( LogicalFontInstance *pFontInstance, int nFallbackL
         bArtBold = true;
     }
 
-    assert(rEntry.mpFontInstance == pFontInstance);
-
     // also set the serverside font for layouting
-    if( rEntry.mpFontInstance )
+    // requesting a font provided by builtin rasterizer
+    FreetypeFont* pFreetypeFont = GlyphCache::GetInstance().CacheFont(pFontInstance);
+    if( pFreetypeFont != nullptr )
     {
-        // requesting a font provided by builtin rasterizer
-        FreetypeFont* pFreetypeFont = GlyphCache::GetInstance().CacheFont( rEntry );
-        if( pFreetypeFont != nullptr )
-        {
-            if( pFreetypeFont->TestFont() )
-                m_pFreetypeFont[ nFallbackLevel ] = pFreetypeFont;
-            else
-                GlyphCache::GetInstance().UncacheFont( *pFreetypeFont );
-        }
+        if( pFreetypeFont->TestFont() )
+            m_pFreetypeFont[ nFallbackLevel ] = pFreetypeFont;
+        else
+            GlyphCache::GetInstance().UncacheFont( *pFreetypeFont );
     }
 
     // set the printer font
diff --git a/vcl/win/gdi/salfont.cxx b/vcl/win/gdi/salfont.cxx
index 010142648a5b..b7069da8e28c 100644
--- a/vcl/win/gdi/salfont.cxx
+++ b/vcl/win/gdi/salfont.cxx
@@ -660,7 +660,7 @@ sal_IntPtr WinFontFace::GetFontId() const
     return mnId;
 }
 
-rtl::Reference<LogicalFontInstance> WinFontFace::CreateFontInstance(const FontSelectPattern& rFSD) const
+rtl::Reference<LogicalFontInstance> WinFontFace::CreateFontInstance(const FontSelectPatternAttributes& rFSD) const
 {
     return new WinFontInstance(*this, rFSD);
 }
diff --git a/vcl/win/gdi/winlayout.cxx b/vcl/win/gdi/winlayout.cxx
index 3411b54c8652..2fe463fbc1ef 100644
--- a/vcl/win/gdi/winlayout.cxx
+++ b/vcl/win/gdi/winlayout.cxx
@@ -311,7 +311,7 @@ std::unique_ptr<SalLayout> WinSalGraphics::GetTextLayout(ImplLayoutArgs& /*rArgs
     return std::unique_ptr<SalLayout>(aLayout);
 }
 
-WinFontInstance::WinFontInstance(const PhysicalFontFace& rPFF, const FontSelectPattern& rFSP)
+WinFontInstance::WinFontInstance(const PhysicalFontFace& rPFF, const FontSelectPatternAttributes& rFSP)
     : LogicalFontInstance(rPFF, rFSP)
     , m_hFont(nullptr)
 {


More information about the Libreoffice-commits mailing list