Subject: 23.0.60; Cocoa, Font dialog doesn't set font size

From: Benjamin Riefenstahl <[email-masked]>
Date: Sat, 19 Jul 2008 17:10:39 +0200

In GNU Emacs 23.0.60.1 (powerpc-apple-darwin8.11.0, *Step 9.0)
 of 2008-07-19 on sueton.benny.turtle-trading.net
configured using `configure  '--with-ns' '--with-png' '--with-gif' '--with-jpeg' '--with-tiff''

When setting the font via the font dialog either from the menu item
"Set Default Font..." or from the preferenc es dialog, only the font
family, but not the font size is actually configured.

The attached patch fixes the problem by passing XLFDs around instead
of Mac font names and eliminating the "FontSize" parameter from the
defaults database.

2008-07-19  Benjamin Riefenstahl  <[email-masked]>

	* lisp/term/ns-win.el (ns-save-preferences): Do not save defaults
	 parameter "FontSize".
	 (ns-respond-to-change-font): Construct an XLFD to pass to
	 set-frame-font.
	* src/nsfns.m (Fns_create_frame): Do not use defaults parameter
	"FontSize".

Index: src/nsfns.m
===================================================================
RCS file: /sources/emacs/emacs/src/nsfns.m,v
retrieving revision 1.6
diff -u -p -r1.6 nsfns.m
--- src/nsfns.m	17 Jul 2008 13:50:27 -0000	1.6
+++ src/nsfns.m	19 Jul 2008 13:48:28 -0000
@@ -1180,9 +1181,6 @@ be shared by the new frame.")
   {
     /* use for default font name */
     id font = [NSFont userFixedPitchFontOfSize: -1.0]; /* default */
-    tfontsize = x_default_parameter (f, parms, Qfontsize,
-                                    make_number (0 /*(int)[font pointSize]*/),
-                                    "fontSize", "FontSize", RES_TYPE_NUMBER);
     tfont = x_default_parameter (f, parms, Qfont,
                                  build_string ([[font fontName] UTF8String]),
                                  "font", "Font", RES_TYPE_STRING);
Index: lisp/term/ns-win.el
===================================================================
RCS file: /sources/emacs/emacs/lisp/term/ns-win.el,v
retrieving revision 1.11
diff -u -p -r1.11 ns-win.el
--- lisp/term/ns-win.el	19 Jul 2008 01:15:10 -0000	1.11
+++ lisp/term/ns-win.el	19 Jul 2008 13:48:29 -0000
@@ -1038,9 +1038,7 @@ Lines are highlighted according to `ns-i
   (let ((p (frame-parameters))
 	v)
     (if (setq v (assq 'font p))
-	(ns-set-resource nil "Font" (ns-font-name (cdr v))))
-    (if (setq v (assq 'fontsize p))
-	(ns-set-resource nil "FontSize" (number-to-string (cdr v))))
+	(ns-set-resource nil "Font" (cdr v)))
     (if (setq v (assq 'foreground-color p))
 	(ns-set-resource nil "Foreground" (cdr v)))
     (if (setq v (assq 'background-color p))
@@ -1325,10 +1322,9 @@ cursor display.  On a text-only terminal
   "Respond to changeFont: event, expecting ns-input-font and\n\
 ns-input-fontsize of new font."
   (interactive)
-  (modify-frame-parameters (selected-frame)
-                           (list (cons 'font ns-input-font)
-                                 (cons 'fontsize ns-input-fontsize)))
-  (set-frame-font ns-input-font))
+  (set-frame-font
+   (font-xlfd-name
+    (font-spec :family ns-input-font :size (float ns-input-fontsize)))))

 ;; Default fontset for Mac OS X.  This is mainly here to show how a fontset