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

Tips: How to config X fonts server



 
    
How to config X fonts server (secure font server, not using any tcp port):

[terrence@igloo terrence]$ cat /etc/rc.d/init.d/xfs
#!/bin/sh
#
# xfs:       Starts the X Font Server
#
# Version:      @(#) /etc/init.d/xfs 2.0
#
# chkconfig: 2345 90 10
# description: Starts and stops the X Font Server at boot time and shutdown. \
#              It also takes care of (re-)generating font lists.
#
# processname: xfs
# config: /etc/X11/fs/config
# hide: true

# Source function library.
. /etc/rc.d/init.d/functions


buildfontlist() {
	for d in `/usr/sbin/chkfontpath --list | cut -f 2 -d ':'`; do
		if [ -d "$d" ]; then
			cd $d
			# Check if we need to rerun mkfontdir
			NEEDED=no
			if ! [ -e fonts.dir ]; then
				NEEDED=yes
			elif [ "x`find . -type f -newer fonts.dir 2>/dev/null`" != "x" ]; then
				NEEDED=yes
			fi
			if [ "$NEEDED" = "yes" ]; then
				rm -f fonts.dir &>/dev/null
				if ls | grep \.ttf$ &>/dev/null; then
                                        # TrueType fonts found...
                                        ttmkfdir . >fonts.scale
                                        mkfontdir -e /usr/X11R6/lib/X11/fonts/encodings \
                                                  -e /usr/X11R6/lib/X11/fonts/encodings/large . &>/dev/null
                                        chmod +r fonts.scale
                                        chmod +r fonts.dir
                                fi
				if [ "x`ls |egrep --ignore-case -v '\.ttf$|^fonts\.|^encodings\.'`" != "x" ]; then
                                        # This directory contains fonts that are not TrueType...

                                        mkfontdir -e /usr/X11R6/lib/X11/fonts/encodings \
                                                  -e /usr/X11R6/lib/X11/fonts/encodings/large . &>/dev/null
                                        chmod +r fonts.dir
                                fi
		        fi

		fi
	done
}

start() {
	echo -n "Starting X Font Server: "
	buildfontlist
	rm -fr /tmp/.font-unix
	# daemon xfs -droppriv -daemon -port 7100
	daemon xfs -droppriv -daemon -port -1
	ret=$?
	[ $ret -eq 0 ] && touch /var/lock/subsys/xfs
	echo
	return $ret
}	
stop() {
	echo -n "Shutting down X Font Server: "
	killproc xfs
	ret=$?
	[ $ret -eq 0 ] && rm -f /var/lock/subsys/xfs
	echo
	return $ret
}	

rhstatus() {
	status xfs
}	

restart() {
	if [ -f /var/lock/subsys/xfs ]; then
	    echo -n "Restarting X Font Server: "
	    buildfontlist
	    killproc xfs -USR1
	    ret=$?
	    echo
	    return $ret
	else
	    stop
	    start
	fi
}

case "$1" in
  start)
  	start
	;;
  stop)
  	stop
	;;
  restart|reload)
  	restart
	;;
  condrestart)
  	if [ -f /var/lock/subsys/xfs ]; then
	    stop
	    start
	fi
	;;
  status)
  	rhstatus
	;;
  *)
	echo "*** Usage: xfs {start|stop|status|restart|reload|condrestart}"
	exit 1
esac

exit $?


[terrence@igloo terrence]$ cat /etc/X11/fs/config
#
# Default font server configuration file for Red Hat Linux
#

# allow a max of 10 clients to connect to this font server
client-limit = 10

# when a font server reaches its limit, start up a new one
clone-self = on

# alternate font servers for clients to use
#alternate-servers = foo:7101,bar:7102

# where to look for fonts
#
catalogue = /usr/share/fonts/default/TrueType/Western,
        /usr/share/fonts/default/TrueType/Chinese
        # /usr/X11R6/lib/X11/fonts/misc:unscaled,
        # /usr/X11R6/lib/X11/fonts/75dpi:unscaled,
        # /usr/X11R6/lib/X11/fonts/misc,
        # /usr/X11R6/lib/X11/fonts/Type1,
        # /usr/X11R6/lib/X11/fonts/Speedo,
        # /usr/X11R6/lib/X11/fonts/cyrillic,
        # /usr/X11R6/lib/X11/fonts/75dpi,
        # /usr/share/fonts/default/TrueType,
        # /usr/share/fonts/default/Type1,
        # /usr/X11R6/lib/X11/fonts/latin2/75dpi:unscaled,
        # /usr/X11R6/lib/X11/fonts/latin2/75dpi

# in 12 points, decipoints
default-point-size = 120

# 100 x 100 and 75 x 75
default-resolutions = 75,75,100,100

# use lazy loading on 16 bit (usually Asian) fonts
deferglyphs = 16

# how to log errors
use-syslog = on

# don't listen to TCP ports by default for security reasons
no-listen = tcp


[terrence@igloo terrence]$ cat /etc/X11/XF86Config
Section "ServerLayout"
	Identifier     "Simple Layout"
	# Screen         "Screen 1" 0 0
	# Screen      0  "Screen 2" 0 0
	Screen         "Dell Screen" 0 0
	Screen		   "Sun Screen" RightOf "Dell Screen"
	InputDevice    "Mouse1" "CorePointer"
	InputDevice    "Keyboard1" "CoreKeyboard"
EndSection

Section "Files"
	RgbPath      "/usr/X11R6/lib/X11/rgb"
	# FontPath     "/usr/X11R6/lib/X11/fonts/local/"
	FontPath     "/usr/X11R6/lib/X11/fonts/misc/"
	FontPath     "/usr/X11R6/lib/X11/fonts/75dpi/:unscaled"
	# FontPath	 "tcp/localhost:7100"	
	FontPath	 "unix/:-1"	
	FontPath     "/usr/X11R6/lib/X11/fonts/Type1/"
	# FontPath     "/usr/X11R6/lib/X11/fonts/Speedo/"
	FontPath     "/usr/X11R6/lib/X11/fonts/75dpi/"
EndSection

Section "Module"
	Load  "dbe"
	SubSection "extmod"
		Option "omit xfree86-dga"
	EndSubSection
	Load  "type1"
	Load  "freetype"
EndSection

Section "InputDevice"
	Identifier  "Keyboard1"
	Driver      "Keyboard"
	Option      "AutoRepeat" "500 30"
	Option      "XkbRules" "xfree86"
	Option      "XkbModel" "dell101"
	Option      "XkbLayout" "us"
	Option      "XkbCompat" ""
EndSection

Section "InputDevice"
	Identifier  "Mouse1"
	Driver      "mouse"
	Option      "Protocol" "PS/2"
	Option      "Device" "/dev/mouse"
EndSection

Section "Monitor"
	Identifier   "SUN Monitor"
	HorizSync    30.0 - 95.0
	VertRefresh  60.0 - 150.0

	# 1600x1200 @ 70 Hz, 87.50 kHz hsync
	Modeline "1600x1200"  185    1600 1664 1856 2160  1200 1201 1204 1250 -HSync -VSync
EndSection

Section "Monitor"
	Identifier   "Dell Monitor"
	HorizSync    30.0 - 95.0
	VertRefresh  60.0 - 150.0
EndSection

Section "Device"
	Identifier  "Matrox Millennium G200 SD 8MB"
	Driver      "mga"
	VideoRam    8192
	# BusID       "PCI:0:16:0"
EndSection

Section "Device"
	Identifier  "STB Velocity 128"
	Driver      "nv"
	ChipSet     "RIVA128"
	Card        "STB Velocity 128"
	ChipId      0x0
	ChipRev     0x0
	BusID       "PCI:1:0:0"
	IRQ         0
EndSection

Section "Screen"
	Identifier "Dell Screen"
	Device     "Matrox Millennium G200 SD 8MB"
	Monitor    "Dell Monitor"
	DefaultDepth     24
	SubSection "Display"
		Depth     8
		Modes "1600x1200"
	EndSubSection
	SubSection "Display"
		Depth     16
		Modes "1600x1200"
	EndSubSection
	SubSection "Display"
		Depth     24
		Modes "1600x1200"
	EndSubSection
EndSection

Section "Screen"
	Identifier "SUN Screen"
	Device     "STB Velocity 128"
	Monitor    "SUN Monitor"
	DefaultDepth     24
	SubSection "Display"
	 	Depth     8
	 	Modes "1600x1200"
	EndSubSection
	SubSection "Display"
	 	Depth     16
	 	Modes "1600x1200"
	EndSubSection
	SubSection "Display"
	 	Depth     24
	 	Modes "1600x1200"
	EndSubSection
EndSection

Section "DRI"
EndSection

Google