vcl/quartz/SystemFontList.cxx | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+)
New commits: commit a5dcb80e34f0b11bafe7c3f5530a0a1bc5f0b5a2 Author: Patrick Luby <guibmac...@gmail.com> AuthorDate: Sat Sep 28 21:09:24 2024 -0400 Commit: Andras Timar <andras.ti...@collabora.com> CommitDate: Mon Sep 30 08:57:52 2024 +0200 tdf#163000 don't add any fonts in the system "reserved fonts" folder macOS Sequoia added a new PingFangUI.ttc font file which contains all of the PingFang font families. However, any fonts loaded from this font file result in the following failures: - Skia renders font with wrong glyphs - Export to PDF contain a damaged embedded font macOS Sequoia still has separate, downloadable Type 3 bitmap fonts for the PingFang font family so ignore any fonts in the PingFangUI.ttc font file and, just to be safe, ignore any other font files in the system "reserved fonts" folder that may be added in the future. Change-Id: I8a025c8b6d84a661b173aa7d6d5b261c92452b34 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/174160 Reviewed-by: Jonathan Clark <jonat...@libreoffice.org> Reviewed-by: Patrick Luby <guibomac...@gmail.com> Tested-by: Jenkins (cherry picked from commit 8f3e84133628c420b7cc9896d6e92e2d66eae0b2) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/174017 Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoff...@gmail.com> Reviewed-by: Andras Timar <andras.ti...@collabora.com> diff --git a/vcl/quartz/SystemFontList.cxx b/vcl/quartz/SystemFontList.cxx index e068caf80fb6..c04c8fdd1f72 100644 --- a/vcl/quartz/SystemFontList.cxx +++ b/vcl/quartz/SystemFontList.cxx @@ -212,6 +212,34 @@ static void fontEnumCallBack( const void* pValue, void* pContext ) { CTFontDescriptorRef pFD = static_cast<CTFontDescriptorRef>(pValue); + // tdf#163000 don't add any fonts in the system "reserved fonts" folder + // macOS Sequoia added a new PingFangUI.ttc font file which + // contains all of the PingFang font families. However, any + // fonts loaded from this font file result in the following + // failures: + // - Skia renders font with wrong glyphs + // - Export to PDF contain a damaged embedded font + // macOS Sequoia still has separate, downloadable Type 3 + // bitmap fonts for the PingFang font family so ignore + // any fonts in the PingFangUI.ttc font file and, just to + // be safe, ignore any other font files in the system + // "reserved fonts" folder that may be added in the future. + CFURLRef pFontURL = static_cast<CFURLRef>(CTFontDescriptorCopyAttribute(pFD, kCTFontURLAttribute)); + if (pFontURL) + { + bool bSkipFont = false; + CFStringRef pFontPath = CFURLCopyFileSystemPath(pFontURL, kCFURLPOSIXPathStyle); + if (pFontPath) + { + bSkipFont = CFStringHasPrefix(pFontPath, CFSTR("/System/Library/PrivateFrameworks/FontServices.framework/Resources/Reserved/")); + CFRelease(pFontPath); + } + CFRelease(pFontURL); + + if (bSkipFont) + return; + } + bool bFontEnabled; FontAttributes rDFA = DevFontFromCTFontDescriptor( pFD, &bFontEnabled );