svx/source/svdraw/svdpdf.cxx | 7 +++++-- vcl/source/gdi/embeddedfontsafdko.cxx | 25 +++++++++++++++++++------ 2 files changed, 24 insertions(+), 8 deletions(-)
New commits: commit dc677727b84233915b3178fb8327fa497bcd2f18 Author: Caolán McNamara <caolan.mcnam...@collabora.com> AuthorDate: Tue Sep 30 10:32:19 2025 +0100 Commit: Miklos Vajna <vmik...@collabora.com> CommitDate: Wed Oct 1 16:00:23 2025 +0200 allow cmap to be optional Change-Id: Ifc6b943d11c1e1b3d4eb3ecb3468bc6ba69bac52 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/191676 Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoff...@gmail.com> Reviewed-by: Miklos Vajna <vmik...@collabora.com> diff --git a/svx/source/svdraw/svdpdf.cxx b/svx/source/svdraw/svdpdf.cxx index 40e7adb7582c..f0715718bb72 100644 --- a/svx/source/svdraw/svdpdf.cxx +++ b/svx/source/svdraw/svdpdf.cxx @@ -242,6 +242,7 @@ void ImpSdrPdfImport::CollectFonts() OUString sPostScriptName = GetPostScriptName(pPageObject->getBaseFontName()); OUString sFontName = pPageObject->getFontName(); + if (sFontName.isEmpty()) { sFontName = guessFontName(sPostScriptName); @@ -1470,7 +1471,7 @@ EmbeddedFontInfo ImpSdrPdfImport::convertToOTF(SubSetInfo& rSubSetInfo, const OU // Build CMap from pdfium toUnicodeData, etc. OUString CMapUrl = fileUrl + u".CMap"; OUString FeaturesUrl = fileUrl + u".Features"; - bool bFeatures = false; + bool bFeatures = false, bCMap = true; if (!toUnicodeData.empty()) { buildCMapAndFeatures(CMapUrl, FeaturesUrl, FontName, toUnicodeData, bNameKeyed, @@ -1479,6 +1480,7 @@ EmbeddedFontInfo ImpSdrPdfImport::convertToOTF(SubSetInfo& rSubSetInfo, const OU else { SAL_WARN("sd.filter", "There is no CMap, pdfium is missing unicodedata"); + bCMap = false; } // Create FontMenuName @@ -1497,7 +1499,8 @@ EmbeddedFontInfo ImpSdrPdfImport::convertToOTF(SubSetInfo& rSubSetInfo, const OU // Otherwise not merged font, just a single subset OUString otfUrl = EmbeddedFontsManager::getFileUrlForTemporaryFont(fontFileName, u".otf"); OUString features = bFeatures ? FeaturesUrl : OUString(); - if (EmbeddedFontsManager::makeotf(pfaCIDUrl, otfUrl, FontMenuNameDBUrl, CMapUrl, features)) + OUString cmap = bCMap ? CMapUrl : OUString(); + if (EmbeddedFontsManager::makeotf(pfaCIDUrl, otfUrl, FontMenuNameDBUrl, cmap, features)) return { longFontName, otfUrl, toOfficeWeight(Weight) }; SAL_WARN("sd.filter", "conversion failed"); return EmbeddedFontInfo(); diff --git a/vcl/source/gdi/embeddedfontsafdko.cxx b/vcl/source/gdi/embeddedfontsafdko.cxx index fb7e13e56af9..d97888324f47 100644 --- a/vcl/source/gdi/embeddedfontsafdko.cxx +++ b/vcl/source/gdi/embeddedfontsafdko.cxx @@ -208,8 +208,14 @@ bool EmbeddedFontsManager::makeotf(const OUString& srcFontUrl, const OUString& d || osl::FileBase::E_None != osl::FileBase::getSystemPathFromFileURL(destFileUrl, destFilePath) || osl::FileBase::E_None - != osl::FileBase::getSystemPathFromFileURL(fontMenuNameDBUrl, fontMenuNameDBPath) - || osl::FileBase::E_None + != osl::FileBase::getSystemPathFromFileURL(fontMenuNameDBUrl, fontMenuNameDBPath)) + { + SAL_WARN("vcl.fonts", "path failure"); + return false; + } + + if (!charMapUrl.isEmpty() + && osl::FileBase::E_None != osl::FileBase::getSystemPathFromFileURL(charMapUrl, charMapPath)) { SAL_WARN("vcl.fonts", "path failure"); @@ -231,17 +237,24 @@ bool EmbeddedFontsManager::makeotf(const OUString& srcFontUrl, const OUString& d const_cast<char*>(""), const_cast<char*>(""), mainDnaCtx); OString fontMenuNameDBPathA(fontMenuNameDBPath.toUtf8()); - cbFCDBRead(cbctx, const_cast<char*>(fontMenuNameDBPathA.getStr())); - OString srcFontPathA(srcFontPath.toUtf8()); OString destFilePathA(destFilePath.toUtf8()); OString charMapPathA(charMapPath.toUtf8()); OString featuresPathA(featuresPath.toUtf8()); + + SAL_INFO( + "vcl.fonts", "makeotf -mf " + << fontMenuNameDBPathA << " -f " << srcFontPathA << " -o " << destFilePathA + << (!charMapPathA.isEmpty() ? " -ch "_ostr + charMapPathA : OString()) + << (!featuresPathA.isEmpty() ? " -ff "_ostr + featuresPathA : OString())); + + cbFCDBRead(cbctx, const_cast<char*>(fontMenuNameDBPathA.getStr())); + cbConvert(cbctx, HOT_NO_OLD_OPS, nullptr, const_cast<char*>(srcFontPathA.getStr()), const_cast<char*>(destFilePathA.getStr()), !featuresPathA.isEmpty() ? const_cast<char*>(featuresPathA.getStr()) : nullptr, - const_cast<char*>(charMapPathA.getStr()), nullptr, nullptr, nullptr, 0, 0, 0, 0, 0, - -1, -1, 0, nullptr); + !charMapPathA.isEmpty() ? const_cast<char*>(charMapPathA.getStr()) : nullptr, nullptr, + nullptr, nullptr, 0, 0, 0, 0, 0, -1, -1, 0, nullptr); return true; }