[Libreoffice-commits] core.git: vcl/qt5

Jan-Marek Glogowski (via logerrit) logerrit at kemper.freedesktop.org
Sun Sep 13 20:36:15 UTC 2020


 vcl/qt5/Qt5Graphics_Text.cxx |   12 ++++++++++++
 1 file changed, 12 insertions(+)

New commits:
commit 3c0dbea19492eecaf8e6e1cb0542a3f93c7298e3
Author:     Jan-Marek Glogowski <glogow at fbihome.de>
AuthorDate: Sun Sep 13 20:30:43 2020 +0200
Commit:     Jan-Marek Glogowski <glogow at fbihome.de>
CommitDate: Sun Sep 13 22:35:30 2020 +0200

    tdf#125234 Qt5 add missing CFF font subsetting
    
    Implemented like on Windows and MacOS.
    
    Change-Id: Ib0d5125b77770446d4ca01efbb7c54d9c6bdb2e5
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/102594
    Tested-by: Jenkins
    Reviewed-by: Jan-Marek Glogowski <glogow at fbihome.de>

diff --git a/vcl/qt5/Qt5Graphics_Text.cxx b/vcl/qt5/Qt5Graphics_Text.cxx
index c533ad1d599a..26b53ff694b8 100644
--- a/vcl/qt5/Qt5Graphics_Text.cxx
+++ b/vcl/qt5/Qt5Graphics_Text.cxx
@@ -231,6 +231,18 @@ bool Qt5Graphics::CreateFontSubset(const OUString& rToFile, const PhysicalFontFa
     const OString aToFile(OUStringToOString(aSysPath, osl_getThreadTextEncoding()));
     const int nOrigGlyphCount = nGlyphCount;
 
+    QByteArray aCFFtable = aRawFont.fontTable("CFF ");
+    if (!aCFFtable.isEmpty())
+    {
+        FILE* pOutFile = fopen(aToFile.getStr(), "wb");
+        rInfo.LoadFont(FontType::CFF_FONT, reinterpret_cast<const sal_uInt8*>(aCFFtable.data()),
+                       aCFFtable.size());
+        bool bRet = rInfo.CreateFontSubset(FontType::TYPE1_PFB, pOutFile, nullptr, pGlyphIds,
+                                           pEncoding, nGlyphCount, pGlyphWidths);
+        fclose(pOutFile);
+        return bRet;
+    }
+
     // get details about the subsetted font
     rInfo.m_nFontType = FontType::SFNT_TTF;
     rInfo.m_aPSName = toOUString(aRawFont.familyName());


More information about the Libreoffice-commits mailing list