[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[h-e-w] Re: Resizing a frame's font

From: David J. Biesack
Subject: [h-e-w] Re: Resizing a frame's font
Date: Tue, 7 Dec 2004 14:09:51 -0500 (EST)

David Vanderschel pointed out to me that my little contribution did not work if 
your font spec contains a wildcard, such as 

    "-*-Lucida Console-normal-r-*-*-18-108-*-*-c-*-*-ansi-"

This patch fixes it.

(defun font-resize (arg)
  "Increase the current frame's default font by ARG.
ARG may be negative to decrease the font size."
  (interactive "p")
  (let ((font (cdr (assoc 'font (frame-parameters))))
"\\(-[^-]*-[^-]+-[^-]*-.-[^-]*-[^-]*-\\)\\([0-9]+\\)\\(-.*\\)$" font)
    (setq size (string-to-int (substring font (match-beginning 2) (match-end 
    (setq new-size (+ size arg))
    (setq new-font (concat (substring font (match-beginning 1) (match-end 1))
                       (int-to-string new-size)
                       (substring font (match-beginning 3) (match-end 3))))
    (set-default-font new-font)
    (message "Set default font: %s" new-font)))

David J. Biesack     SAS Institute Inc.
(919) 531-7771       SAS Campus Drive   Cary, NC 27513

reply via email to

[Prev in Thread] Current Thread [Next in Thread]