[Libreoffice-commits] core.git: Branch 'libreoffice-6-2' - vcl/inc vcl/qt5

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Wed Feb 6 15:31:09 UTC 2019


 vcl/inc/qt5/Qt5Data.hxx      |    1 -
 vcl/qt5/Qt5Graphics_Text.cxx |   36 ++++++++++++++++++++++++++----------
 2 files changed, 26 insertions(+), 11 deletions(-)

New commits:
commit 133c8c08062b1cd7bae0b1490ac8866bb80ae577
Author:     Jan-Marek Glogowski <glogow at fbihome.de>
AuthorDate: Wed Jan 23 19:57:58 2019 +0100
Commit:     Thorsten Behrens <Thorsten.Behrens at CIB.de>
CommitDate: Wed Feb 6 16:30:46 2019 +0100

    Qt5 initialize GlyphCache for PSP graphics
    
    For whatever reason Calc uses a printer graphics context to
    layout cell context. Without the initialized printer fonts,
    you'll see broken cell content in Calc, until you edit them.
    
    So now some part of the Qt5 GUI is painted by Cairo via the
    psp::Printer graphics context.
    
    Change-Id: Ib67c44abc952bc244f2c803d1dba8987ab618470
    Reviewed-on: https://gerrit.libreoffice.org/66817
    Tested-by: Jenkins
    Reviewed-by: Jan-Marek Glogowski <glogow at fbihome.de>
    (cherry picked from commit a07524de096e8c8bfdb54cfd4ad061c8bd469792)
    Reviewed-on: https://gerrit.libreoffice.org/67408
    Reviewed-by: Thorsten Behrens <Thorsten.Behrens at CIB.de>

diff --git a/vcl/inc/qt5/Qt5Data.hxx b/vcl/inc/qt5/Qt5Data.hxx
index 6f64925cb2f5..ef537d0c040f 100644
--- a/vcl/inc/qt5/Qt5Data.hxx
+++ b/vcl/inc/qt5/Qt5Data.hxx
@@ -26,7 +26,6 @@
 #include <memory>
 #include <vclpluginapi.h>
 
-class GlyphCache;
 class QCursor;
 
 class VCLPLUG_QT5_PUBLIC Qt5Data : public GenericUnixSalData
diff --git a/vcl/qt5/Qt5Graphics_Text.cxx b/vcl/qt5/Qt5Graphics_Text.cxx
index 19a05f8410fc..150b296402f1 100644
--- a/vcl/qt5/Qt5Graphics_Text.cxx
+++ b/vcl/qt5/Qt5Graphics_Text.cxx
@@ -25,6 +25,8 @@
 #include <vcl/fontcharmap.hxx>
 #include <unx/geninst.h>
 #include <unx/fontmanager.hxx>
+#include <unx/glyphcache.hxx>
+#include <unx/genpspgraphics.h>
 
 #include <sallayout.hxx>
 #include <PhysicalFontCollection.hxx>
@@ -95,19 +97,32 @@ void Qt5Graphics::GetDevFontList(PhysicalFontCollection* pPFC)
         return;
 
     QFontDatabase aFDB;
-
+    QStringList aFontFamilyList;
     if (bUseFontconfig)
+        aFontFamilyList = aFDB.families();
+    GlyphCache& rGC = GlyphCache::GetInstance();
+    psp::PrintFontManager& rMgr = psp::PrintFontManager::get();
+    ::std::vector<psp::fontID> aList;
+    psp::FastPrintFontInfo aInfo;
+
+    rMgr.getFontList(aList);
+    for (auto const& elem : aList)
     {
-        const QStringList aFontFamilyList = aFDB.families();
-        ::std::vector<psp::fontID> aList;
-        psp::FastPrintFontInfo aInfo;
+        if (!rMgr.getFontFastInfo(elem, aInfo))
+            continue;
+
+        // normalize face number to the GlyphCache
+        int nFaceNum = rMgr.getFontFaceNumber(aInfo.m_nID);
+
+        // inform GlyphCache about this font provided by the PsPrint subsystem
+        FontAttributes aDFA = GenPspGraphics::Info2FontAttributes(aInfo);
+        aDFA.IncreaseQualityBy(4096);
+        const OString& rFileName = rMgr.getFontFileSysPath(aInfo.m_nID);
+        rGC.AddFontFile(rFileName, nFaceNum, aInfo.m_nID, aDFA);
 
-        psp::PrintFontManager& rMgr = psp::PrintFontManager::get();
-        rMgr.getFontList(aList);
-        for (auto const& elem : aList)
+        // register font files unknown to Qt
+        if (bUseFontconfig)
         {
-            if (!rMgr.getFontFastInfo(elem, aInfo))
-                continue;
             QString aFilename = toQString(
                 OStringToOUString(rMgr.getFontFileSysPath(aInfo.m_nID), RTL_TEXTENCODING_UTF8));
             QRawFont aRawFont(aFilename, 0.0);
@@ -116,9 +131,10 @@ void Qt5Graphics::GetDevFontList(PhysicalFontCollection* pPFC)
                 || !aFDB.styles(aFamilyName).contains(aRawFont.styleName()))
                 QFontDatabase::addApplicationFont(aFilename);
         }
+    }
 
+    if (bUseFontconfig)
         SalGenericInstance::RegisterFontSubstitutors(pPFC);
-    }
 
     for (auto& family : aFDB.families())
         for (auto& style : aFDB.styles(family))


More information about the Libreoffice-commits mailing list