[comp.windows.x] font names, xfd

adrian@ora.UUCP (Adrian Nye ) (11/29/88)

I was surprised at first when I got an error trying to invoke xfd with one
of the font file names I saw in /usr/lib/X11/fonts/75dpi.
xfd said it couldn't find the font.
Then I realized that this is because of 
the new font aliasing.  The name you have to give xfd
is one of the aliases in the second 
column of fonts.dir in the directory 
containing the font.  Here is an example of a line from this file.

courBO10.snf     -adobe-courier-bold-o-normal--10-100-75-75-m-60-iso8859-1

The rub is that the alias is a little long to type comfortably :-).
I discovered that if you type the file name with wildcards
between the various parts, it seems to uniquely identify a
font.  For example, for the courier font shown above, you can
look at it with xfd using:

xfd "*cour*BO*10*"

I tried this for about 10 fonts, and it worked for all of them.
Now, my question to you is "why does this work?!"  It is not
matching the filename courBO10 because that name does 
not work by itself or with leading and trailing wildcards (*courBO10*).
There is no occurence of BO in the alias, so it is not matching that.

What is it matching? The matching algorithm folds upper to lower case!
So "BO" is actually "bo" and that is in the alias.
-- 
Adrian Nye (617) 527-4210
O'Reilly & Associates, Inc., Publishers of Nutshell Handbooks
981 Chestnut Street, Newton, MA 02164
UUCP:	uunet!ora!adrian   ARPA: adrian@ora.uu.net

jim@EXPO.LCS.MIT.EDU (Jim Fulton) (11/29/88)

> [questions on font *file* names]

You have it backwards.  The name of the file in which a font is stored is
unrelated to the name of the font (which is specified by the FONT property).
This allows everyone to use the new naming scheme (the long names are needed to
uniquely identify a font) without having to pervert their file system (before
people flame 14 character filename limits, think about spaces or slashes in
fontnames). 

To make using font names a little easier, and more portable between 
displays of different resolutions, the semantics of fontnames were extended
to allow wildcards in font names.  This allows you to specify only the
fields that are important to you.  For example, if you wanted to use a 12 point
"roman" Courier font for an xterm, you could use the either of the following
names:

	-adobe-courier-medium-r-normal--12-120-75-75-m-70-iso8859-1
	*-courier-*-r-*-120-*

Note that you should match on the point size field which is measured in
tenths of a point (the 120 in this example) rather than the pixel field
(the 12).  This allows your defaults to work properly on tubes of different
resolution.  For example, to specify a 24 point, normal italic Charter, 

	*-charter-medium-i-*-240-*

will match either

	-bitstream-charter-medium-i-normal--25-240-75-75-p-136-iso8859-1
	-bitstream-charter-medium-i-normal--33-240-100-100-p-179-iso8859-1

depending on whether the 75dpi or 100dpi font directory comes first in your
font path.  This example also demonstrates why the pixel size should not be
when wildcarding.  On a 75dpi monitor, a 24 point font will be 25 pixels tall;
on a 100dpi monitor, it will be 33 pixels tall.

In summary, 

			font names  !=  file names


								Jim

pds@quintus.uucp (Peter Schachte) (12/01/88)

In article <8811291459.AA13065@EXPO.LCS.MIT.EDU> jim@EXPO.LCS.MIT.EDU (Jim Fulton) writes:
>  For example, if you wanted to use a 12 point
>"roman" Courier font for an xterm, you could use:
>
>	*-courier-*-r-*-120-*

But might this not get you, say, a 10 point courier roman font at 120 dpi?

Pnews
fodder
Pnews
fodder

-Peter Schachte
pds@quintus.uucp
..!sun!quintus!pds

karlton@decwrl.dec.com (Philip Karlton) (12/01/88)

In article <8811291459.AA13065@EXPO.LCS.MIT.EDU> jim@EXPO.LCS.MIT.EDU (Jim Fulton) writes:
>
>> [questions on font *file* names]
>
>[some good stuff explaining the difference between font and file names]
>
>This allows you to specify only the
>fields that are important to you.  For example, if you wanted to use a
>12 point "roman" Courier font for an xterm, you could use the either of
>the following
>names:
>
>	-adobe-courier-medium-r-normal--12-120-75-75-m-70-iso8859-1
>	*-courier-*-r-*-120-*
>

You have to be a little more careful than this when specifying font names. For
instance, the second string above would also match any courier font at 120 dpi
if it happened to be in your font path. A more common collision happens when
you try to specify a 10 point (i.e. 100 deci-point) high font and you end up
getting some random point size from the 100 dpi set.

The fields are positional in the sense that there are a fixed number of
hyphens in all fonts that are named in compliance with the convention. Picking
the name

	*-*-courier-*-r-*-*-*-120-*-*-*-*-iso8859-1

would pick a font that was 12.0 points high at the appropriate screen
resoulution (assuming your font path is set up correctly) and with the
encoding you are probably expecting.

PK