[Top][All Lists]

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

set-face-attribute and floating point :height values

From: Giorgos Keramidas
Subject: set-face-attribute and floating point :height values
Date: Mon, 31 Jan 2011 12:33:49 -0800
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (gnu/linux)

My ~/.emacs file now includes the following to fine-tune the default
face for X11 frames:

  (when (display-graphic-p)
    (set-face-attribute 'default nil :family "DejaVu Sans Mono" :width 
'ultra-condensed :height 102)
    (require 'color-theme))

The documentation of `set-face-attribute' mentions that :height is
supposed to accept floating point values too:

,----[ C-h f set-face-attribute ]---------------------------------------
| set-face-attribute is a compiled Lisp function in `faces.el'.
| (set-face-attribute FACE FRAME &rest ARGS)
| Set attributes of FACE on FRAME from ARGS.
| [...]
| `:height'
| VALUE must be either an integer specifying the height of the font to use
| in 1/10 pt, a floating point number specifying the amount by which to
| scale any underlying face, or a function, which is called with the old
| height (from the underlying face), and should return the new height.
| [...]

But trying to use a floating-point number in my ~/.emacs file throws up
an error, e.g. when I evaluate in my *scratch* buffer the expression:

  (set-face-attribute 'default nil :family "DejaVu Sans Mono" :height 1.4)

a debugger pops up with the following backtrace:

    Debugger entered--Lisp error: (error "Invalid default face height" 1.4)
      internal-set-lisp-face-attribute(default :height 1.4 0)
      set-face-attribute(default nil :family "DejaVu Sans Mono" :width
      ultra-condensed :height 1.4)
      eval((set-face-attribute (quote default) nil :family "DejaVu Sans
      Mono" :width (quote ultra-condensed) :height 1.4))
      call-interactively(eval-last-sexp nil nil)

Is the documentation of `set-face-attribute' out of date, or am I using
it incorrectly?

reply via email to

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