From b03fa9c37f97230130b37fdf99eb8517235c32c2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Va=CC=81clav=20Slavi=CC=81k?= Date: Thu, 27 Aug 2020 13:10:45 +0200 Subject: [PATCH] Fix UI font serialization on macOS 11 e86154fc is insufficient, because there's still one situation when PostScript names can't be avoided: when storing them using wxNativeFontInfo::ToString(). Co-authored-by: Stefan Csomor --- src/osx/carbon/font.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/osx/carbon/font.cpp b/src/osx/carbon/font.cpp index 78020a603d..1c7e767eda 100644 --- a/src/osx/carbon/font.cpp +++ b/src/osx/carbon/font.cpp @@ -1062,6 +1062,17 @@ wxString wxNativeFontInfo::GetPostScriptName() const // if not explicitly set, obtain it from the font descriptor wxString ps; wxCFTypeRef(CTFontDescriptorCopyAttribute(GetCTFontDescriptor(), kCTFontNameAttribute)).GetValue(ps); + + if ( WX_IS_MACOS_AVAILABLE(10, 16) ) + { + // the PostScript names reported in macOS start with a dot for System Fonts, this has to be corrected + // otherwise round-trips are not possible, resulting in a Times Fallback, therefore we replace these with + // their official PostScript Name + wxString rest; + if ( ps.StartsWith(".SFNS", &rest) ) + return "SFPro" + rest; + } + return ps; }