From 79250a55589007930278e3fa59ccdf24c6ff8ea6 Mon Sep 17 00:00:00 2001 From: Khaled Hosny Date: Mon, 8 May 2023 16:14:52 +0300 Subject: [PATCH] tdf#155161: Always embed fonts with CFF2 table as PDF Type 3 fonts MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit PDF doesn’t support CFF2 table and we currently don’t convert them to Type 1 (like we do with CFF table), so treat it like fonts with variations and embed as Type 3 fonts. Change-Id: I963b55d5d0ed1470eda157c7e10cae63195a0c91 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/151515 Tested-by: Jenkins Reviewed-by: Adolfo Jayme Barrientos --- vcl/source/gdi/pdfwriter_impl.cxx | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/vcl/source/gdi/pdfwriter_impl.cxx b/vcl/source/gdi/pdfwriter_impl.cxx index 6b9fb711626a..ce26ea6b1342 100644 --- a/vcl/source/gdi/pdfwriter_impl.cxx +++ b/vcl/source/gdi/pdfwriter_impl.cxx @@ -6283,6 +6283,13 @@ void PDFWriterImpl::registerGlyph(const sal_GlyphId nFontGlyphId, sal_uInt8& nMappedGlyph, sal_Int32& nMappedFontObject) { auto bVariations = !pFace->GetVariations(*pFont).empty(); + // tdf#155161 + // PDF doesn’t support CFF2 table and we currently don’t convert them to + // Type 1 (like we do with CFF table), so treat it like fonts with + // variations and embed as Type 3 fonts. + if (!pFace->GetRawFontData(HB_TAG('C', 'F', 'F', '2')).empty()) + bVariations = true; + if (pFace->IsColorFont() || bVariations) { // Font has colors, check if this glyph has color layers or bitmap. -- 2.40.1