unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: "Colin S. Miller" <no-spam-thank-you@csmiller.demon.co.uk>
Subject: Re: increasing font size
Date: Sat, 18 Feb 2006 17:47:14 +0000	[thread overview]
Message-ID: <43f75d8b$0$15791$14726298@news.sunsite.dk> (raw)
In-Reply-To: <mailman.515.1140191403.2856.help-gnu-emacs@gnu.org>

Senthil wrote:
> how do i increase the size of font appearing in emacs
> should i edit something in my .emacs file
> 
> --
> --------S.Senthil Kumaran-------
> blog : http://sskganesan.blogspot.com
> 
> 
Senthl,

I've written this module which will do this, assuming you are not running in a console.
However it only changes the base-font; if an emacs face sets the font size, then it
won't be changed.
This code was written for XEmacs, I haven't tested it on Emacs.
You might need to tweek the list of font sizes, depending on which font face you use.

However, if don't want to dynmically change the font size, you can use
Options/Font Size to set the default and Options/Advanced (Customize)/Face to overide
this for some faces.

HTH,
Colin S. Miller


(defvar csm-base-font-sizes [14 16 17 19 20 22 25 26 27 29 31 32 33 35 38 40] "* Font list")


(defun csm-base-font-inc ()
   "Increases the default font"
   (interactive)

   (let ((curr-val) (index) (elem) (num-elems))
     (progn
       (setq curr-val (string-to-number (custom-face-font-size 'default)))
       (setq index 0)
       (setq num-elems (length csm-base-font-sizes))

       (while
           (progn
             (setq elem (elt csm-base-font-sizes index))
             (setq index (+ index 1))
             (and (<   index num-elems)
                  (<  elem  curr-val)
                  )                      ; or
             )                           ; progn
         )

       (progn
         (if (< index num-elems)
             (progn

               (setq new-val (elt csm-base-font-sizes index))
               (if new-val
                   (progn
                     (custom-set-face-font-size 'default
                                                new-val)
                     (display-message 'command (concat "New font size is " (number-to-string new-val) " points")))))
           (display-message 'command "Font already at largest size")
           )                             ; if
         )                               ; progn
       )                                 ; progn
     )                                   ; let
   )                                     ; defun




(defun csm-base-font-dec ()
   "Decreases the default font"
   (interactive)

   (let ((curr-val) (index) (elem) (num-elems))
     (progn
       (setq curr-val (string-to-number (custom-face-font-size 'default)))
       (setq index 0)
       (setq num-elems (length csm-base-font-sizes))

       (while
           (progn
             (setq elem (elt csm-base-font-sizes index))
             (setq index (+ index 1))
             (and (<  index num-elems)
                  (<  elem  curr-val)
                  )                      ; or
             )                           ; progn
         )

       (progn
         (if (> index 1)
             (progn
               (setq index (- index 2))
               (setq new-val (elt csm-base-font-sizes index))
               (if new-val
                   (progn
                     (custom-set-face-font-size 'default
                                                new-val)

                     (display-message 'command (concat "New font size is " (number-to-string new-val) " points")))))
           (display-message 'command "Font already at smallest size")
           )                               ; if
         )                               ; progn
       )                                 ; progn
     )                                   ; let
   )                                     ; defun


(define-key global-map
   [(control kp-subtract)]
   'csm-base-font-dec
   )

(define-key global-map
   [(control kp-add)]
   'csm-base-font-inc
   )


-- 
Replace the obvious in my email address with the first three letters of the hostname to reply.

       reply	other threads:[~2006-02-18 17:47 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <mailman.515.1140191403.2856.help-gnu-emacs@gnu.org>
2006-02-18 17:47 ` Colin S. Miller [this message]
2006-02-21  9:30 increasing font size Suguru Furuta
2006-02-22  9:09 ` Raimund Kohl-Fuechsle
  -- strict thread matches above, loose matches on Subject: below --
2006-02-20 10:52 Suguru Furuta
2006-02-20 14:07 ` Raimund Kohl-Fuechsle
2006-02-20 23:26   ` Peter Dyballa
2006-02-17 12:46 Senthil
2006-02-18 10:44 ` Peter Dyballa
     [not found] <mailman.5899.1125876082.20277.help-gnu-emacs@gnu.org>
2005-09-05  4:58 ` Increasing " Tim X
2005-09-04 22:59 Rajiv Vyas

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='43f75d8b$0$15791$14726298@news.sunsite.dk' \
    --to=no-spam-thank-you@csmiller.demon.co.uk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).