]> git.eshelyaron.com Git - emacs.git/commitdiff
Fix default font in macOS font dialogs
authorPo Lu <luangruo@yahoo.com>
Tue, 3 May 2022 08:05:46 +0000 (16:05 +0800)
committerPo Lu <luangruo@yahoo.com>
Tue, 3 May 2022 08:05:46 +0000 (16:05 +0800)
* src/nsterm.m ([EmacsView noteUserSelectedFont]): Use current
font if none was selected.

src/nsterm.m

index 7deafc8cbb38466264bf7d27a99446909b0d2a4d..dfb7c5d202ac4e52e820f6afaddb2f381eeb32b9 100644 (file)
@@ -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