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

Luboš Luňák (via logerrit) logerrit at kemper.freedesktop.org
Sun Mar 21 15:21:47 UTC 2021


 vcl/inc/impglyphitem.hxx   |    2 +-
 vcl/inc/sallayout.hxx      |    2 +-
 vcl/source/outdev/font.cxx |    8 ++++++--
 3 files changed, 8 insertions(+), 4 deletions(-)

New commits:
commit c3ffeb01a9f868c734ce235a6d38ce51b80ca05e
Author:     Luboš Luňák <l.lunak at collabora.com>
AuthorDate: Fri Mar 19 19:14:08 2021 +0100
Commit:     Luboš Luňák <l.lunak at collabora.com>
CommitDate: Sun Mar 21 16:21:09 2021 +0100

    reuse also font from cached SalLayoutGlyphs
    
    Change-Id: Ie85c7891cf65699529e0cc08746450bb3bc0aedb
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/112773
    Tested-by: Jenkins
    Reviewed-by: Luboš Luňák <l.lunak at collabora.com>

diff --git a/vcl/inc/impglyphitem.hxx b/vcl/inc/impglyphitem.hxx
index c3bd423d7e5a..3932b94891f9 100644
--- a/vcl/inc/impglyphitem.hxx
+++ b/vcl/inc/impglyphitem.hxx
@@ -120,7 +120,7 @@ class SalLayoutGlyphsImpl : public std::vector<GlyphItem>
 
 public:
     SalLayoutGlyphsImpl* clone() const;
-    LogicalFontInstance& GetFont() const { return *m_rFontInstance; }
+    const rtl::Reference<LogicalFontInstance>& GetFont() const { return m_rFontInstance; }
     bool IsValid() const;
     void Invalidate();
 
diff --git a/vcl/inc/sallayout.hxx b/vcl/inc/sallayout.hxx
index d480089c0b38..3852442eeadb 100644
--- a/vcl/inc/sallayout.hxx
+++ b/vcl/inc/sallayout.hxx
@@ -184,7 +184,7 @@ public:
 
     // used by display layers
     LogicalFontInstance& GetFont() const
-        { return m_GlyphItems.GetFont(); }
+        { return *m_GlyphItems.GetFont(); }
 
     bool            GetNextGlyph(const GlyphItem** pGlyph, Point& rPos, int& nStart,
                                  const PhysicalFontFace** pFallbackFont = nullptr) const override;
diff --git a/vcl/source/outdev/font.cxx b/vcl/source/outdev/font.cxx
index 0c6c29674527..e145d2bebbad 100644
--- a/vcl/source/outdev/font.cxx
+++ b/vcl/source/outdev/font.cxx
@@ -1267,11 +1267,15 @@ std::unique_ptr<SalLayout> OutputDevice::ImplGlyphFallbackLayout( std::unique_pt
     // try if fallback fonts support the missing code units
     for( int nFallbackLevel = 1; nFallbackLevel < MAX_FALLBACK; ++nFallbackLevel )
     {
+        rtl::Reference<LogicalFontInstance> pFallbackFont;
+        if(pGlyphs != nullptr && pGlyphs->Impl(nFallbackLevel) != nullptr)
+            pFallbackFont = pGlyphs->Impl(nFallbackLevel)->GetFont();
         // find a font family suited for glyph fallback
         // GetGlyphFallbackFont() needs a valid FontInstance
         // if the system-specific glyph fallback is active
-        rtl::Reference<LogicalFontInstance> pFallbackFont = mxFontCache->GetGlyphFallbackFont( mxFontCollection.get(),
-            aFontSelData, mpFontInstance.get(), nFallbackLevel, aMissingCodes );
+        if( !pFallbackFont )
+            pFallbackFont = mxFontCache->GetGlyphFallbackFont( mxFontCollection.get(),
+                aFontSelData, mpFontInstance.get(), nFallbackLevel, aMissingCodes );
         if( !pFallbackFont )
             break;
 


More information about the Libreoffice-commits mailing list