From f9dea5b4c5ba8e8a24cba3dc3d66a1f8a2a2b21f Mon Sep 17 00:00:00 2001 From: Po Lu Date: Tue, 3 May 2022 16:05:46 +0800 Subject: [PATCH] Fix default font in macOS font dialogs * src/nsterm.m ([EmacsView noteUserSelectedFont]): Use current font if none was selected. --- src/nsterm.m | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/nsterm.m b/src/nsterm.m index 7deafc8cbb3..dfb7c5d202a 100644 --- a/src/nsterm.m +++ b/src/nsterm.m @@ -6182,6 +6182,19 @@ ns_font_desc_to_font_spec (NSFontDescriptor *desc, NSFont *font) - (void) noteUserSelectedFont { font_panel_active = NO; + + /* If no font was previously selected, use the currently selected + font. */ + + if (!font_panel_result && FRAME_FONT (emacsframe)) + { + font_panel_result + = macfont_get_nsctfont (FRAME_FONT (emacsframe)); + + if (font_panel_result) + [font_panel_result retain]; + } + [NSApp stop: self]; } #endif -- 2.39.5