help-emacs-windows
[Top][All Lists]
Advanced

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

RE: [h-e-w] automated changing of fonts for different modes?


From: Eli Daniel
Subject: RE: [h-e-w] automated changing of fonts for different modes?
Date: Wed, 30 Oct 2002 10:56:16 -0500

First, you need to get the name of the font you want in the form that
emacs can deal with.   To do that, go to the *scratch* buffer and
evaluate

(insert (prin1-to-string (w32-select-font)))

This will produce a standard windows font-selection box; when you select
the font you're interested in, it will insert the X-style name of that
font into the buffer.  It will be something like:

"-outline-Georgia-normal-r-normal-normal-15-90-120-120-p-*-iso8859-15"

This specifies both the point size and the pixel height and width of the
font; if you change monitor resolutions, this combination may no longer
be valid.  In the example the 90 above is the point size (9.0), and the
15 and 120s are something else (I don't exactly remember what they
mean).  I generally just specify the point size; that is, I'd edit the
line printed out to be:

"-outline-Georgia-normal-r-normal-normal-*-90-*-*-p-*-iso8859-15"   

This is now the name of your desired font, in a generic enough form that
it should be OK across different monitor configurations.  

Once you have this string, you can set the current font with

(set-frame-font <your-font-name>) 

If you do this in a mode hook, then you can change fonts based on mode.

-Eli Daniel

> -----Original Message-----
> From: address@hidden [mailto:help-emacs-windows-
> address@hidden On Behalf Of Bob DuCharme
> Sent: Wednesday, October 30, 2002 8:55 AM
> To: address@hidden
> Subject: [h-e-w] automated changing of fonts for different modes?
> 
> Can anyone suggest how I might reset the displayed font by mode
(fixedsys
> for python, perl mode, etc., arial for txt mode, xml mode, etc.)?
> 
> I assume that I would include something in an add-hook expression, as
> shown
> below, but can't figure out what.
> 
>    (add-hook 'xml-mode-hook
>    (lambda ()
>      (define-key xml-mode-map "/" `sgml-slash-check)
>      ; what can I add here to set the text to Arial in xml-mode?
>    ))
> 
> thanks,
> 
> Bob DuCharme          www.snee.com/bob           <bob@
> snee.com>  "The elements be kind to thee, and make thy
> spirits all of comfort!" Anthony and Cleopatra, III ii
> (bobdc e-mail address used only for mailing lists)
> 






reply via email to

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