#!/usr/pkg/bin/ksh93
# $XConsortium: Xsetup.src /main/8 1996/07/02 11:40:32 mgreess $
# ##########################################################################
#
#  Common Desktop Environment
#
#  (c) Copyright 1993, 1994 Hewlett-Packard Company
#  (c) Copyright 1993, 1994 International Business Machines Corp.
#  (c) Copyright 1993, 1994 Sun Microsystems, Inc.
#  (c) Copyright 1993, 1994 Novell, Inc.
#
#      ************** DO NOT EDIT THIS FILE **************
#
#  /usr/pkg/dt/config/Xsetup is a factory-default file and will
#  be unconditionally overwritten upon subsequent installation.
#  Before making changes to the file, copy it to the configuration 
#  directory, /usr/pkg/usr/pkg/etc/dt/config. You must also update the setup
#  resource in /usr/pkg/usr/pkg/etc/dt/config/Xconfig.
#
# ##########################################################################
# ##########################################################################
# 
# Directory specifications
# 
# ##########################################################################
  XDIR=/usr/X11R7/bin
# ##########################################################################
#  
# Append desktop font aliases to font path
#
# ##########################################################################
    #
    # Append desktop font paths. Note: these directories should be
    # accessable by the X server. The file precedence is:
    #
    #   /usr/pkg/etc/dt/cde/fontaliases
    #   /usr/pkg/dt/share/cde/fontaliases
    #
    if [ "$DTXSERVERLOCATION" != "remote" ]; then
      #
      # Since X server is local, optimize by checking local desktop
      # font directories and making one call to xset.
      #
      if [ -f /usr/pkg/etc/dt/cde/fontaliases/fonts.dir ] ||          [ -f /usr/pkg/etc/dt/cde/fontaliases/fonts.alias ]; then
        fontpath=/usr/pkg/etc/dt/cde/fontaliases
      fi
      if [ -f /usr/pkg/dt/share/cde/fontaliases/fonts.dir ] ||          [ -f /usr/pkg/dt/share/cde/fontaliases/fonts.alias ]; then
        if [ -z "$fontpath" ]; then
          fontpath=/usr/pkg/dt/share/cde/fontaliases
        else
          fontpath=$fontpath,/usr/pkg/dt/share/cde/fontaliases
        fi
      fi
      if [ ! -z "$fontpath" ]; then
        $XDIR/xset fp+ $fontpath
      fi
    else
      #
      # Since X server not local, we don't know if the desktop font
      # directories exist on the X server machine, so we have to
      # set them one at a time.
      #
      $XDIR/xset fp+ /usr/pkg/etc/dt/cde/fontaliases 1>/dev/null
      $XDIR/xset fp+ /usr/pkg/dt/share/cde/fontaliases 1>/dev/null
    fi
    if [ "$DTXSERVERLOCATION" != "remote" ]; then
      fontpath=
      FONTLIB=/usr/X11R7/lib/X11/fonts
      for i in misc 75dpi 100dpi Speedo Type1 PJE
      do
	 if [ -f $FONTLIB/$i/fonts.dir ];  then
	     if [ ! -z "$fontpath" ]; then
		fontpath=$fontpath,$FONTLIB/$i/
	     else
		fontpath=$FONTLIB/$i/
	     fi
	 fi
      done
      if [ ! -z "$fontpath" ]; then
        $XDIR/xset fp+ $fontpath
      fi
    fi
