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

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

Re: How can I determine what the default font it?


From: Floyd L. Davidson
Subject: Re: How can I determine what the default font it?
Date: Thu, 26 Feb 2004 02:25:20 -0900
User-agent: gnus 5.10.6/XEmacs 21.4.15/Linux 2.6.0

exits funnel <address@hidden> wrote:
>Hello,
>
>I've just upgraded to emacs 21.3.1 from emacs 19.7(?)
>running on RedHat Linux.  It works great but for one
>immediate problem.  The default font size is much
>smaller and I can barely read it.  I've done a bit of
>research (I'm pretty new to Linux and well as emacs)
>on changing the font size but I have a few quick
>questions.  First of all it seems I can do this either
>by modifying my .emacs file or by modifying
>.Xdefaults.  Which approach is better?

You'll want to note that basically all of this applies not only
to Emacs, but to xterms as well, where you will probably have
exactly the same problem.  (I use a 1333x1000 resolution screen,
and have fits trying to work out fonts that provide readable
text in windows of the right size.)

Probably .Xdefaults is best, because that relates closely to the
X configuration (which is where the screen resolution is
chosen).  You can use the same ~/.emacs file, regardless of the
X configuration if you specify font sizes with the X
configuration rather than the Emacs configuration.

There still seem to be lots of "gotchas", and I haven't worked
it out well enough for GNU Emacs (mostly because I normally use
XEmacs, and they don't work quite the same).  In particular,
it is necessary to go through the faces customization menu
and set fonts.  And I've found that some fonts simply can't
be manipulated by GNU Emacs (for reasons that I do not at all
understand).  For example, I rather like, in XEmacs, using the
-misc-fixed-medium-r-semicondensed fonts.  But GNU Emacs can't
scale them, and attempts to do so result in very small sizes.

One comment on testing changes to ~/.Xdefaults before going on
to the rest of this.  To test a new configuration you can use
xrdb to effect the new configuration, but there are two ways
to do it.

  xrdb -merge .Xdefaults

is usually recommended, but it will not delete something you
have removed from .Xdefaults.  It will add, and it will change,
but no deletions.  But,

  xrdb .Xdefaults

will replace the existing definitions with the new definitions,
which means something that is not defined in the new file will
not exist after that command.  Hence it will delete what you've
removed, but it also deletes everything from any other
initialization files.  I.e., it's good for testing, but you'll
want to restart X when you are done.

>I'm assuming
>if I change .Xdefaults this will affect other programs
>besides emacs.

Only if you want it to.   For example,

  *font:  -*-courier-*-*-*-*-23-*-*-*-*-*-iso8859-1

will affect virtually everything ending in "font" that is not
otherwise specifically set, and hence is probably not a good
idea.  There are two ways to be specific,

Emacs*font:  -*-courier-*-*-*-*-23-*-*-*-*-*-iso8859-1
Emacs.font:  -*-courier-*-*-*-*-23-*-*-*-*-*-iso8859-1

will both affect either Emacs or XEmacs, but nothing else. While

XEmacs*font:  -*-courier-*-*-*-*-23-*-*-*-*-*-iso8859-1
XEmacs.font:  -*-courier-*-*-*-*-23-*-*-*-*-*-iso8859-1

will both affect only XEmacs and not GNU Emacs.

The difference between using the '*' wildcard or not, is that
the wild card will set all Emacs resources that end in "font",
that are not more specifically defined, while using the "."
specifies one and only one resource.  Hence, if you have only

Emacs.font:  -*-courier-*-*-*-*-23-*-*-*-*-*-iso8859-1

you might have not set several fonts, and they will default to
something like "fixed", which is exceedingly small and moreover
Emacs can neither scale it or find variations for such as
bold, italic, or underline.

But if you set 

Emacs*font:  9x15

you're screwed too, because everything is set to a font that
Emacs cannot manipulate.

However, I don't know that Emacs has any resource ending in
"font" other than the default, so it (may or) may not make any
difference at all.  But definitely with other programs that is
significant...  (for colors and other resources as well as
fonts).

>My other question is how can I find
>out what font emacs is currently displaying?  Thanks
>in advance for any replies.

You can do "M-x list-faces-display" which will give you
a line of text for each face that is defined.  It gives you
the variable for that particular face, and you can select
from that buffer any of the face names and change the font
or other properties.  For example, with some fonts being
too small (once you have the basic defaults set in .Xdefaults),
you can browse the list and change the ones that are hard
to read.

There are some strange things happen with fonts in GNU Emacs
that you may or may not bothered by.  One is the way tabs are
offset.  I have the following in my .Xdefaults file, and used it
for checking the results of font changes.

 #
 #  When playing with fonts for GNU Emacs, the tabs do not
 #  necessarily line up where they should when fonts are scaled.
 #  The following chart uses tabs between the 'T' characters, and
 #  spaces between the '|' characters.  They should line up
 #  exactly...
 #
 #      T       T       T       T       T       T       T       T       T       
T
 
#1234567890123456789012345678901234567890123456789012345678901234567890123456789
 #       |       |       |       |       |       |       |       |       |      
 |

Note the comment about tabs between the "T" characters on the
chart.  If, between my writing this and you reading it, they get
changed to spaces, it won't provide the needed value...

A couple recommendations.  Change the size to suit your needs,
but for menus and pop-ups the proportional spacing with a
helvetica font is much nicer.  I use bold to make it more readable
too. YMMV, of course.

 #
 # Font  menus
 #
 Emacs*menubar*font: -*-helvetica-bold-r-*-*-16-*-*-*-*-*-iso8859-*
 Emacs*popup*font:   -*-helvetica-bold-r-*-*-16-*-*-*-*-*-iso8859-*

Here is what I like for the default font.  Unfortunately, GNU Emacs
(unlike XEmacs) can't seem to scale this font.

 Emacs.font: -misc-fixed-medium-r-semicondensed-*-25-*-100-*-*-*-iso8859-1

Here is what I set for attribute fonts.

 Emacs.default.attributeFont:     -*-courier-*-*-*-*-23-*-*-*-*-*-iso8859-1
 Emacs.bold.attributeFont:        -*-courier-bold-r-*-*-23-*-*-*-*-*-iso8859-1
 Emacs.italic.attributeFont:      -*-courier-medium-r-*-*-23-*-*-*-*-*-iso8859-1
 Emacs.bold-italic.attributeFont: -*-courier-bold-r-*-*-23-*-*-*-*-*-iso8859-1

(Note that I don't use the oblique font for italics, because it is
just too ugly to look at and hard to read.)

However, despite having set those in ~/.Xdefaults, I'm pretty
sure that I've changed every one of them using the customize
menu, and therefore that is overridden by custom-set-faces
written to ~/.emacs.el.  The problem is that while the courier
fonts do scale, it is at intervals and is not a continuous
allowable range, and the trick is to get a size to most closely
match the default font's size.

-- 
Floyd L. Davidson           <http://web.newsguy.com/floyd_davidson>
Ukpeagvik (Barrow, Alaska)                         address@hidden


reply via email to

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