Subject: bug#16028: 24.3.50; Latest build completely breaks my thumnail frames code

From: martin rudalics <[email-masked]>
Date: Fri, 06 Dec 2013 09:20:40 +0100

> Unfortunately, it doesn't help.  Exactly the same broken
 > behavior, I'm afraid.
 >
 > I tested using this build from Juanma:
 >
 > In GNU Emacs 24.3.50.1 (i686-pc-mingw32)
 >  of 2013-12-05 on ODIEONE
 > Bzr revision: 115389 [email-masked]

Then we have to dig into this further.  Let's stick to this simple
example (where `enlarged-font-name' is just yours):

(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) (signal 'font-too-small (list new-size)))
       (aset xlfd-fields xlfd-regexp-pixelsize-subnum
             (number-to-string new-size)))
     ;; Set point size & width to "*", so frame width adjusts to new font
     (aset xlfd-fields xlfd-regexp-pointsize-subnum "*")
     (aset xlfd-fields xlfd-regexp-avgwidth-subnum "*")
     (x-compose-font-name xlfd-fields)))

(defun enlarge-font-by (increment)
   (let* ((old-size (cons (frame-width) (frame-height)))
	 (old-pixel-size (cons (frame-pixel-width) (frame-pixel-height)))
	 (old-font (cdr (assq 'font (frame-parameters (selected-frame)))))
	 (new-font (enlarged-font-name old-font (selected-frame) increment)))
     (modify-frame-parameters (selected-frame) (list (cons 'font new-font)))
     (sit-for 0)
     (with-current-buffer (get-buffer-create "*temp*")
       (goto-char (point-max))
       (insert (format "%s %s %s ->\n%s %s %s\n\n"
		      old-font old-size old-pixel-size new-font
		      (cons (frame-width) (frame-height))
		      (cons (frame-pixel-width) (frame-pixel-height)))))))

;; (eval-buffer)
;; (enlarge-font-by 4)
;; (enlarge-font-by -4)
;; (enlarge-font-by -4)
;; (enlarge-font-by 0)
;; (enlarge-font-by 4)

With emacs -Q evaluating the commented out rows in sequence gets me in *temp*:

-outline-Courier New-normal-normal-normal-mono-13-*-*-*-c-*-iso8859-1 (80 . 38) (672 . 608) ->
-outline-Courier New-normal-normal-normal-mono-17-*-*-*-c-*-iso8859-1 (80 . 38) (836 . 760)

-outline-Courier New-normal-normal-normal-mono-17-*-*-*-c-*-iso8859-1 (80 . 38) (836 . 760) ->
-outline-Courier New-normal-normal-normal-mono-13-*-*-*-c-*-iso8859-1 (80 . 38) (672 . 608)

-outline-Courier New-normal-normal-normal-mono-13-*-*-*-c-*-iso8859-1 (80 . 38) (672 . 608) ->
-outline-Courier New-normal-normal-normal-mono-9-*-*-*-c-*-iso8859-1 (80 . 38) (436 . 456)

-outline-Courier New-normal-normal-normal-mono-9-*-*-*-c-*-iso8859-1 (80 . 38) (436 . 456) ->
-outline-Courier New-normal-normal-normal-mono-9-*-*-*-c-*-iso8859-1 (80 . 38) (436 . 456)

-outline-Courier New-normal-normal-normal-mono-9-*-*-*-c-*-iso8859-1 (80 . 38) (436 . 456) ->
-outline-Courier New-normal-normal-normal-mono-13-*-*-*-c-*-iso8859-1 (80 . 38) (672 . 608)

The sit-for is needed for getting the right new pixel values, the
resizing effect is the same when I comment it out.  What do you get
here?

martin