From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: "Drew Adams" Newsgroups: gmane.emacs.bugs,gmane.emacs.pretest.bugs Subject: bug#1562: 23.0.60; modify-frame-parameters in Emacs 23 for fonts Date: Sun, 14 Dec 2008 09:30:03 -0800 Message-ID: <000a01c95e11$99e69410$0200a8c0@us.oracle.com> References: <001e01c95d55$595d9b80$0200a8c0@us.oracle.com> <49451CBD.50108@gnu.org> Reply-To: Drew Adams , 1562@emacsbugs.donarmstrong.com NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="----=_NextPart_000_000B_01C95DCE.8BC35410" X-Trace: ger.gmane.org 1229499771 10217 80.91.229.12 (17 Dec 2008 07:42:51 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 17 Dec 2008 07:42:51 +0000 (UTC) Cc: emacs-pretest-bug@gnu.org To: "'Jason Rumney'" , <1562@emacsbugs.donarmstrong.com> Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Wed Dec 17 08:43:56 2008 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1LCr4W-0001sZ-BT for geb-bug-gnu-emacs@m.gmane.org; Wed, 17 Dec 2008 08:43:56 +0100 Original-Received: from localhost ([127.0.0.1]:45529 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1LCr3K-0004F4-5r for geb-bug-gnu-emacs@m.gmane.org; Wed, 17 Dec 2008 02:42:42 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1LCr23-0003Sw-Mf for bug-gnu-emacs@gnu.org; Wed, 17 Dec 2008 02:41:24 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1LCr1z-0003QZ-RR for bug-gnu-emacs@gnu.org; Wed, 17 Dec 2008 02:41:20 -0500 Original-Received: from [199.232.76.173] (port=47051 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1LCr1z-0003QO-M6 for bug-gnu-emacs@gnu.org; Wed, 17 Dec 2008 02:41:19 -0500 Original-Received: from mx20.gnu.org ([199.232.41.8]:43427) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1LCr1z-0007y3-0E for bug-gnu-emacs@gnu.org; Wed, 17 Dec 2008 02:41:19 -0500 Original-Received: from rzlab.ucr.edu ([138.23.92.77]) by mx20.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1LCr1x-0004f8-OJ for bug-gnu-emacs@gnu.org; Wed, 17 Dec 2008 02:41:18 -0500 Original-Received: from rzlab.ucr.edu (rzlab.ucr.edu [127.0.0.1]) by rzlab.ucr.edu (8.13.8/8.13.8/Debian-3) with ESMTP id mBH7OJG6014034; Tue, 16 Dec 2008 23:24:33 -0800 Original-Received: (from debbugs@localhost) by rzlab.ucr.edu (8.13.8/8.13.8/Submit) id mBH6ZY7A031011; Tue, 16 Dec 2008 22:35:34 -0800 X-Loop: don@donarmstrong.com Resent-From: "Drew Adams" Resent-To: bug-submit-list@donarmstrong.com Resent-CC: Emacs Bugs Resent-Date: Wed, 17 Dec 2008 06:35:32 +0000 Resent-Message-ID: Resent-Sender: don@donarmstrong.com X-Emacs-PR-Message: followup 1562 X-Emacs-PR-Package: emacs X-Emacs-PR-Keywords: Original-Received: via spool by 1562-submit@emacsbugs.donarmstrong.com id=B1562.122927580932202 (code B ref 1562); Wed, 17 Dec 2008 06:35:32 +0000 Original-Received: (at 1562) by emacsbugs.donarmstrong.com; 14 Dec 2008 17:30:09 +0000 X-Spam-Bayes: score:0.5 Bayes not run. spammytokens:Tokens not available. hammytokens:Tokens not available. Original-Received: from rgminet12.oracle.com (rcsinet12.oracle.com [148.87.113.124]) by rzlab.ucr.edu (8.13.8/8.13.8/Debian-3) with ESMTP id mBEHU5W8031606 for <1562@emacsbugs.donarmstrong.com>; Sun, 14 Dec 2008 09:30:07 -0800 Original-Received: from acsinet13.oracle.com (acsinet13.oracle.com [141.146.126.235]) by rgminet12.oracle.com (Switch-3.3.1/Switch-3.3.1) with ESMTP id mBEHTiMF021593 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Sun, 14 Dec 2008 17:29:45 GMT Original-Received: from acsmt707.oracle.com (acsmt707.oracle.com [141.146.40.85]) by acsinet13.oracle.com (Switch-3.3.1/Switch-3.3.1) with ESMTP id mBEHULRm026186; Sun, 14 Dec 2008 17:30:23 GMT Original-Received: from dradamslap1 (/141.144.72.6) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Sun, 14 Dec 2008 09:29:55 -0800 X-Mailer: Microsoft Office Outlook 11 In-Reply-To: <49451CBD.50108@gnu.org> Thread-Index: Acld+1H1G/p2teAMSsahfCToke0e1QAEkodw X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.3350 X-Source-IP: acsmt707.oracle.com [141.146.40.85] X-Auth-Type: Internal IP X-CT-RefId: str=0001.0A090201.49454295.0015:SCFSTAT928724,ss=1,fgs=0 X-detected-kernel: by mx20.gnu.org: Linux 2.6 (newer, 3) X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6, seldom 2.4 (older, 4) Resent-Date: Wed, 17 Dec 2008 02:41:20 -0500 X-BeenThere: bug-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:23312 gmane.emacs.pretest.bugs:23511 Archived-At: This is a multi-part message in MIME format. ------=_NextPart_000_000B_01C95DCE.8BC35410 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit > > (1) `modify-frame-parameters' changes the `font' parameter > > behind your back from the value you provide > > `modify-frame-parameters': > > > > (modify-frame-parameters frame > > (list (cons 'font "-outline-Lucida Console-normal-normal-\ > > normal-mono-15-*-*-*-c-*-iso8859-1"))) > > > > The `font' frame parameter is then: > > > > "-outline-Lucida Console-normal-normal-normal-mono-15-\ > > *-*-*-c-*-fontset-auto8" > > > > IOW, iso8859-1 gets replaced by fontset-auto8. > > I don't see this. Please try with emacs -Q. See attached file, bug-zoom.el. emacs -Q, then load the file or eval it a sexp at a time if you want to see the initial font name etc. After loading, (frame-parameter nil 'font) gives "-outline-Lucida Console-normal-normal-normal-mono-14-*-*-*-c-*-iso8859-1" Then do `C-u 5 M-x enlarge-font'. (frame-parameter nil 'font) gives "-outline-Lucida Console-normal-normal-normal-mono-19-*-*-*-c-*-iso8859-1" which is correct. Then do `C-u -5 M-x enlarge-font'. (frame-parameter nil 'font) gives "-outline-Lucida Console-normal-normal-normal-mono-14-*-*-*-c-*-fontset-auto1" which is NOT correct. The code calls `modify-frame-parameters' with the same 14-point font name that was returned initially, and which ends in "-iso8859-1", not "-fontset-auto1". But that's not what the `font' parameter value is after the `modify-frame-parameters' call. `M-x debug-on-entry enlarge-font', and you will see, just after this call (notice that the font name passed as argument is correct): Debugger entered--returning value: nil modify-frame-parameters(# ((font . "-outline-Lucida Console-normal-normal-normal-mono-14-*-*-*-c-*-iso8859-1"))) that (frame-parameter nil 'font) gives "-outline-Lucida Console-normal-normal-normal-mono-14-*-*-*-c-*-fontset-auto1" which is wrong. (I also tried using `copy-sequence' to ensure that the string passed is a new one etc. No improvement.) Initially, I thought perhaps it had something to do with the call to `query-fontset' in the commented-out piece of code in `enlarged-font-name', since `query-fontset' returns a string with "-fontset-auto1" at the end. But the bug remains, even with that code commented out. Note too that over time, "-fontset-auto1" becomes "-fontset-auto2", and so on. The bug seems to be in `modify-frame-parameters'. FWIW, let me be clear why I would like this bug fixed. While waiting for the fix, I hacked the code for Emacs 23 to just modify the :height attribute for the `default' face. That is what most people do, to zoom a frame. That does not give as many font/frame size possibilities as my code does - it is not as flexible. So yes, I know there is a rudimentary workaround, but I would like this code to work again, as it does in Emacs 20, 21, and 22. It doesn't seem right that `modify-frame-parameters' modifies a frame differently from what you tell it to do. ------=_NextPart_000_000B_01C95DCE.8BC35410 Content-Type: application/octet-stream; name="bug-zoom.el" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="bug-zoom.el" (modify-frame-parameters nil (list (cons=20 'font "-*-Lucida Console-normal-r-*-*-14-*-96-96-c-*-iso8859-1"))) (frame-parameter nil 'font) (defun enlarge-font (&optional increment frame) "Increase size of font in FRAME by INCREMENT. Interactively, INCREMENT is given by the prefix argument. Optional FRAME parameter defaults to current frame." (interactive "p") (setq frame (or frame (selected-frame))) (let ((fontname (cdr (assq 'font (frame-parameters frame)))) (count 100)) (setq fontname (enlarged-font-name fontname frame increment)) (while (and (not (x-list-fonts fontname)) (wholenump (setq count (1- = count)))) (setq fontname (enlarged-font-name fontname frame increment))) (unless (x-list-fonts fontname) (error "Cannot change font size")) (modify-frame-parameters frame (list (cons 'font fontname))) ;; Update faces that want a bold or italic version of the default = font. (frame-update-faces frame))) (defun enlarged-font-name (fontname frame increment) "FONTNAME, after enlarging font size of FRAME by INCREMENT. FONTNAME is the font of FRAME." ;; (when (query-fontset fontname) ;; (let ((ascii (assq 'ascii (aref (fontset-info fontname frame) = 2)))) ;; (when ascii (setq fontname (nth 2 ascii))))) (let ((xlfd-fields (x-decompose-font-name fontname))) (unless xlfd-fields (error "Cannot decompose font name")) (let ((new-size (+ (string-to-number (aref xlfd-fields = xlfd-regexp-pixelsize-subnum)) increment))) (unless (> new-size 0) (error "New font size is too small: %s" = new-size)) (aset xlfd-fields xlfd-regexp-pixelsize-subnum (number-to-string = new-size))) ;; Set point size & width to "*", so frame width will adjust to new = font size (aset xlfd-fields xlfd-regexp-pointsize-subnum "*") (aset xlfd-fields xlfd-regexp-avgwidth-subnum "*") (x-compose-font-name xlfd-fields))) ------=_NextPart_000_000B_01C95DCE.8BC35410--