summaryrefslogtreecommitdiff
path: root/vcl
diff options
context:
space:
mode:
authorJan-Marek Glogowski <glogow@fbihome.de>2020-09-13 20:30:43 +0200
committerJan-Marek Glogowski <glogow@fbihome.de>2020-09-13 22:35:30 +0200
commit3c0dbea19492eecaf8e6e1cb0542a3f93c7298e3 (patch)
treecc60b00417fdb688b25aecc0f40fb0ca6038197e /vcl
parentbee46dbfd9986f324f20852987c05ac4339d4d25 (diff)
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@fbihome.de>
Diffstat (limited to 'vcl')
-rw-r--r--vcl/qt5/Qt5Graphics_Text.cxx12
1 files changed, 12 insertions, 0 deletions
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());