From 98d32e50e01f474c65241cf0d94d8769c8804733 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Fri, 22 Mar 2024 14:38:08 +0530 Subject: [PATCH] macOS: Reject styled fallback from CoreText if its family name is not the same as the original On some systems, for the good Lord alone knows what reason, CoreText is giving us Zapf Dingbats as a font for some symbols, which doesnt actually work. Fixes #7249 (I hope) --- docs/changelog.rst | 2 ++ kitty/core_text.m | 5 +++++ 2 files changed, 7 insertions(+) diff --git a/docs/changelog.rst b/docs/changelog.rst index b1ceebc63..73647913a 100644 --- a/docs/changelog.rst +++ b/docs/changelog.rst @@ -60,6 +60,8 @@ Detailed list of changes - Mouse reporting: Fix drag release event outside the window not being reported in legacy mouse reporting modes (:iss:`7244`) +- macOS: Fix a regression in the previous release that broke rendering of some symbols on some systems (:iss:`7249`) + 0.33.1 [2024-03-21] ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ diff --git a/kitty/core_text.m b/kitty/core_text.m index 67d150bf1..ae4bebc8e 100644 --- a/kitty/core_text.m +++ b/kitty/core_text.m @@ -302,6 +302,11 @@ apply_styles_to_fallback_font(CTFontRef original_fallback_font, bool bold, bool if (descriptor) { ans = CTFontCreateWithFontDescriptor(descriptor, CTFontGetSize(original_fallback_font), NULL); CFRelease(descriptor); + CFStringRef new_name = CTFontCopyFamilyName(ans); + CFStringRef old_name = CTFontCopyFamilyName(original_fallback_font); + bool same_family = cf_string_equals(new_name, old_name); + CFRelease(new_name); CFRelease(old_name); + if (!same_family) { CFRelease(ans); return original_fallback_font; } } if (ans) { CFRelease(original_fallback_font); return ans; } return original_fallback_font;