From: Po Lu Date: Tue, 3 May 2022 08:05:46 +0000 (+0800) Subject: Fix default font in macOS font dialogs X-Git-Tag: emacs-29.0.90~1931^2~114 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=f9dea5b4c5ba8e8a24cba3dc3d66a1f8a2a2b21f;p=emacs.git Fix default font in macOS font dialogs * src/nsterm.m ([EmacsView noteUserSelectedFont]): Use current font if none was selected. --- 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