[comp.windows.x] User definable font aliases

argv%turnpike@Sun.COM (Dan Heller) (04/10/90)

The system administrator can edit fonts.dir and fonts.alias, but there
doesn't seem to be a way for the user to do this.  It would sure be
nice for me to alias one of those very long font names to a common name
that I'd like to use.  Anyone have ideas on this?

dan
-----------------------------------------------------------
		    O'Reilly && Associates
		argv@sun.com / argv@ora.com
	   632 Petaluma Ave, Sebastopol, CA 95472 
     800-338-NUTS, in CA: 800-533-NUTS, FAX 707-829-0104
    Opinions expressed reflect those of the author only.

jim@EXPO.LCS.MIT.EDU (Jim Fulton) (04/11/90)

    The system administrator can edit fonts.dir and fonts.alias, but there
    doesn't seem to be a way for the user to do this.  It would sure be
    nice for me to alias one of those very long font names to a common name
    that I'd like to use.  Anyone have ideas on this?

Depends on how your X server locates fonts.  If it has access to your file
system (either because it is running on a workstation, can do NFS or [T]FTP,
or has some sort of font server protocol):

	%  mkdir ~/myfonts
	%  emacs ~/myfonts/fonts.alias
	%  xset fp+ ~/myfonts		# put this in your .xsession/.xinitrc

If your server can't get at your file system, then you'll have to read your
vendor doc to see if there is another way to do it.

janssen@parc.Xerox.COM (Bill Janssen) (04/11/90)

You should be able to create a new directory, put a fonts.alias file in it,
index it (just run mkfontdir?), and add it to your font path.  I don't
think the
fonts.alias file needs to refer to a font in the current directory.

(Wait... let me try it...)

Yep:

2 % cd
3 % xlsfonts 'foobar'
xlsfonts: pattern "foobar" unmatched
4 % mkdir myfonts
5 % cd myfonts
6 % echo 'foobar
-b&h-lucida-bold-i-normal-sans-8-80-75-75-p-49-iso8859-1' >fonts.alias
7 % mkfontdir
8 % xset fp+ ~/myfonts
9 % xlsfonts 'foobar'
foobar
10 % 

--
 Bill Janssen        janssen.pa@xerox.com      (415) 494-4763
 Xerox Palo Alto Research Center
 3333 Coyote Hill Road, Palo Alto, California   94304

brennan@rtp.dg.com (Dave Brennan) (04/14/90)

In article <134169@sun.Eng.Sun.COM> argv%turnpike@Sun.COM (Dan Heller) writes:

   The system administrator can edit fonts.dir and fonts.alias, but there
   doesn't seem to be a way for the user to do this.  It would sure be nice
   for me to alias one of those very long font names to a common name that
   I'd like to use.  Anyone have ideas on this?

    I not only have an idea, I know of a way to do it :-) Create a
directory to keep your for aliases.  For this exercise, we'll use
/usr/joe/X11/fonts.  In this directory place a file called "fonts.alias".
Each line of this file should contain your alias, white space, then an
exisiting font name.  For example, your file might contain these lines:

times10   -adobe-times-medium-r-normal--10-100-75-75-p-54-iso8859-1
helv10    -adobe-helvetica-medium-r-normal--10-100-75-75-p-56-iso8859-1
cour10    *courier-m*-r*--10*

Now run the following commands:  (You'll probably want to put these
somewhere that will get them executed whenever you run X.)

% xset fp+ /usr/joe/X11/fonts   [ you're font dir goes here ]
% xset fp rehash

To convince yourself that this _really_ did work, you can try

% xfd cour10

Hope this helps!

--
                                                   _________
Dave Brennan, User Interfaces, Data General Corp. /      brennan@dg-rtp.dg.com 
Research Triangle Park, North Carolina, 27709    /  ...mcnc!rti!dg-rtp!brennan
Hm: (919) 460-5725  Wk: (919) 248-6330 _________/ dave_brennan@rpitsmts.bitnet

parlier@jpl-devvax.JPL.NASA.GOV (Randy Parlier) (04/15/90)

>In article <134169@sun.Eng.Sun.COM> argv%turnpike@Sun.COM (Dan Heller) writes:
>
>   The system administrator can edit fonts.dir and fonts.alias, but there
>   doesn't seem to be a way for the user to do this.  It would sure be nice
>   for me to alias one of those very long font names to a common name that
>   I'd like to use.  Anyone have ideas on this?
>


	I think another good way is to have your system administrator
	edit the file "fonts.alias" found in the fonts directories and
	put the string "FILE_NAMES_ALIASES" on a single line. 
	
	This in effect will allow any one to use "fontname" without the 
	'.snf' suffix as an alias for that font.  See the man page on
	"mkfontdir" for more info.

	Hope this helps!

	Randy
	parlier@jpl-devvax.jpl.nasa.gov