emacs-devel
[Top][All Lists]
Advanced

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

RE: finger-pointer curser as default for mouse-face text


From: Drew Adams
Subject: RE: finger-pointer curser as default for mouse-face text
Date: Tue, 2 Nov 2004 15:41:40 -0800

[I don't know if this is pertinant to this discussion or not - ignore if
not. (CC'ing the list because this is related to Miles's message -- this is
_not_ a request to consider this feature for inclusion in Emacs.)]

Karl,

I too wrote a command (`doremi-grow-font') that increases or decreases the
font size of the frame by an increment. You could bind it to, say, C-+ (and
bind to C-- a lambda that calls `doremi-grow-font' after flipping the sign
of the increment). Like Miles's code, this lets you, in effect, _zoom_ the
Emacs page (buffer) in and out easily.

However, I also wrote another command, `doremi-font-size', that uses
`doremi-grow-font' to let you increase or decrease the font size
incrementally using the arrow keys or the mouse wheel (like IE browser-text
zooming with the mouse wheel). Command `doremi-font-size' uses a very
general function, `doremi', which you can use to do almost anything
incrementally using the arrow keys or mouse wheel.

See, for discussion, code, and documentation,
http://www.emacswiki.org/cgi-bin/wiki/DoReMi (the font-size changing code is
in library http://www.emacswiki.org/elisp/doremi-frm.el; the general
`doremi' function is in library http://www.emacswiki.org/elisp/doremi.el).

Without going into the details of the rest, here is the code of
`doremi-grow-font', to give you an idea:

(defun doremi-grow-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)))))
    (when (query-fontset fontname)
      (setq fontname (nth 2 (assq 'ascii (aref (fontset-info fontname frame)
2)))))
    (let ((xlfd-fields (x-decompose-font-name fontname))
          new-font-name)
      (unless xlfd-fields (error "Cannot decompose font name"))
      (aset xlfd-fields
            xlfd-regexp-pixelsize-subnum
            (number-to-string
             (+ (string-to-number (aref xlfd-fields
xlfd-regexp-pixelsize-subnum))
                increment)))
      ;; Must set point size and 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 "*")
      (setq new-font-name (x-compose-font-name xlfd-fields))
      (modify-frame-parameters frame (list (cons 'font new-font-name)))
      ;; Update faces that want a bold or italic version of the default
font.
      (frame-update-faces frame))))

Miles's code looks much simpler, and seems to work just as well. I don't
know what other functional differences there might be.

HTH,

  Drew

-----Original Message-----From: Miles Bader

On Tue, Nov 02, 2004 at 07:08:34PM +0100, Karl Eichwalder wrote:
> From time to time it is necessary to increase the font size: When I want
> to demonstrate something to somebody watching my screen, or when I want
> to check some accented or foreign characters more closely.

Something like the following elisp code might be more useful for this.  It
implements the C-+ and C-- (that's control-minus :-) bindings many modern
GUI
programs use to grow/shrink the default face.

... default-grow.el
<snip>





reply via email to

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