summaryrefslogtreecommitdiff
path: root/vcl
diff options
context:
space:
mode:
authorKhaled Hosny <khaled@aliftype.com>2022-09-20 09:49:29 +0200
committerخالد حسني <khaled@aliftype.com>2022-09-20 12:00:11 +0200
commit348452715de6af8be2d40407bbe191752452b883 (patch)
tree46da97d6633555086ba8b8dc24b5a1bbc5da927f /vcl
parent06a23b7b4d23a31a4808c68f00e1be42d8218737 (diff)
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: خالد حسني <khaled@aliftype.com>
Diffstat (limited to 'vcl')
-rw-r--r--vcl/inc/sft.hxx1
-rw-r--r--vcl/source/font/PhysicalFontFace.cxx3
-rw-r--r--vcl/source/fontsubset/sft.cxx8
3 files changed, 7 insertions, 5 deletions
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)