vcl/inc/sft.hxx | 1 + vcl/source/font/PhysicalFontFace.cxx | 3 ++- vcl/source/fontsubset/sft.cxx | 8 ++++---- 3 files changed, 7 insertions(+), 5 deletions(-)
New commits: commit 348452715de6af8be2d40407bbe191752452b883 Author: Khaled Hosny <kha...@aliftype.com> AuthorDate: Tue Sep 20 09:49:29 2022 +0200 Commit: خالد حسني <kha...@aliftype.com> CommitDate: Tue Sep 20 12:00:11 2022 +0200 vcl: tdf#138325 pass PostScript name down to CreateCFFfontSubset() If we don’t pass the name from the caller, it will try to read it from the CFF table but some fonts has CFF table without a PostScript name so we end up with a dummy value. Change-Id: Ie7c46cdf5542ce83a57b60dee35dbb704a898f18 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/140220 Tested-by: Jenkins Reviewed-by: خالد حسني <kha...@aliftype.com> diff --git a/vcl/inc/sft.hxx b/vcl/inc/sft.hxx index 55464aa85973..c1d2c5c8e3fe 100644 --- a/vcl/inc/sft.hxx +++ b/vcl/inc/sft.hxx @@ -628,6 +628,7 @@ class TrueTypeFace; VCL_DLLPUBLIC bool CreateCFFfontSubset(const unsigned char* pFontBytes, int nByteLength, std::vector<sal_uInt8>& rOutBuffer, + const OUString& rPSName, const sal_GlyphId* pGlyphIds, const sal_uInt8* pEncoding, int nGlyphCount, FontSubsetInfo& rInfo); diff --git a/vcl/source/font/PhysicalFontFace.cxx b/vcl/source/font/PhysicalFontFace.cxx index d210304f5b47..411f2d59ef5d 100644 --- a/vcl/source/font/PhysicalFontFace.cxx +++ b/vcl/source/font/PhysicalFontFace.cxx @@ -293,7 +293,8 @@ bool PhysicalFontFace::CreateFontSubset(std::vector<sal_uInt8>& rOutBuffer, // Shortcut for CFF-subsetting. auto aData = GetRawFontData(T_CFF); if (!aData.empty()) - return CreateCFFfontSubset(aData.data(), aData.size(), rOutBuffer, pGlyphIds, pEncoding, + return CreateCFFfontSubset(aData.data(), aData.size(), rOutBuffer, + GetName(NAME_ID_POSTSCRIPT_NAME), pGlyphIds, pEncoding, nGlyphCount, rInfo); // Prepare data for font subsetter. diff --git a/vcl/source/fontsubset/sft.cxx b/vcl/source/fontsubset/sft.cxx index de2461d07e48..892366ea3a62 100644 --- a/vcl/source/fontsubset/sft.cxx +++ b/vcl/source/fontsubset/sft.cxx @@ -1914,8 +1914,8 @@ bool CreateTTFfontSubset(vcl::AbstractTrueTypeFont& rTTF, std::vector<sal_uInt8> } bool CreateCFFfontSubset(const unsigned char* pFontBytes, int nByteLength, - std::vector<sal_uInt8>& rOutBuffer, const sal_GlyphId* pGlyphIds, - const sal_uInt8* pEncoding, int nGlyphCount, + std::vector<sal_uInt8>& rOutBuffer, const OUString& rPSName, + const sal_GlyphId* pGlyphIds, const sal_uInt8* pEncoding, int nGlyphCount, FontSubsetInfo& rInfo) { utl::TempFile aTempFile; @@ -1926,8 +1926,8 @@ bool CreateCFFfontSubset(const unsigned char* pFontBytes, int nByteLength, return false; rInfo.LoadFont(FontType::CFF_FONT, pFontBytes, nByteLength); - bool bRet = rInfo.CreateFontSubset(FontType::TYPE1_PFB, pOutFile, nullptr, pGlyphIds, pEncoding, - nGlyphCount); + bool bRet = rInfo.CreateFontSubset(FontType::TYPE1_PFB, pOutFile, rPSName.toUtf8().getStr(), + pGlyphIds, pEncoding, nGlyphCount); fclose(pOutFile); if (bRet)