Summary: tcsh arrow key and cmdtool fonts

From: Ralf Vandenhouten (vanni@Orion.physiology.rwth-aachen.de)
Date: Thu Jun 17 1993 - 19:10:38 CDT


----------
X-Sun-Data-Type: text
X-Sun-Data-Description: text
X-Sun-Data-Name: text
X-Sun-Content-Lines: 54

Hi managers,

this is the promised summary to my yesterday's query:

Question 1:
> Does anyone know if it is possible to activate the 'up arrow' key (Type 4
> keyboard) for the tcsh history in a cmdtool and how ?

Question 2:
> By the way, how can I change the default font and fontsize for cmdtools in
> OpenWindows ?

Thank you very much for the fast and helpful responses to
(in order of appearance):

hightowr@afwc.af.mil (Dave Hightower)
murff@irt.com (Jim Murff)
danny@ews7.dseg.ti.com (Danny Johnson)
lokkur.dexter.mi.us!scs@heifetz.msen.com (Steve Simmons)
adam%bwnmr4@harvard.harvard.edu (Adam Shostack)
rakowski@land.nr.usu.edu (Andrew Rakowski)
bathurst@noaapmel.gov (Bill Bathurst)
Richard.Czech@gmd.de (Richard Czech)
perryh@pluto.rain.com (Perry Hutchison)
blymn@mulga.awadi.com.AU (Brett Lymn)

It seems that there is no solution for question 1 since cmdtool uses the
arrow keys itself for scrolling (so you're right, Steve), but you can use
ctrl-p (arrow up) and ctrl-n (arrow down) instead.
Another possibility is to use tcsh with xterm or shelltool instead of
cmdtool and the arrow key problem will vanish.

As to question 2 there are several ways to change font attributes:

1) If you only want to change the fonts for a single cmdtool session you
   can call it with the -fn option, e.g.
         /usr/openwin/bin/cmdtool -fn Lucidasans-Typewriter14

2) If you want to change the default settings you can edit the .Xdefaults file:
         Font.Name: <fontname>

3) The most convenient way to perform any font changes (default or individual)
   has been provided by Jim Murff (special thanks to you, Jim), who sent me
   a shell script for interactively changing the settings which he got from
   Richard W. Scott(Richard.W.Scott@Corp.Sun.COM) and which originally has
   been written by Michael O'Connor (michael.oconnor@west.Sun.COM) (great,
   Michael, thank you!). You can find this neat utility (called 'chfont')
   attached below.

Enjoy,

Ralf

----------
X-Sun-Data-Type: cshell-script
X-Sun-Data-Name: chfont
X-Sun-Content-Lines: 254

#!/bin/csh -f
###########################################################################
# chfont - change OpenWindows X server font or font scale
#
# Description:
#
# chfont is a menu driven C-shell script that allows the user to change
# the Window.Scale Resource or the Font.Name resource in the OpenWindows
# X11/NeWS server resource database. The user may also reset both settings
# back to default if either have been changed. The scale menu provides the
# user with the 4 choices for the Window.Scale resource:
#
# small, medium, large, extra_large
#
# The fonts menu provides the user with a choice of 11 fixedwidth fonts
# of various widths and point sizes. The fonts were chosen because they
# all work well with terminal emulator windows and are compatible with
# the vi utility.
#
# If the user has previously specified a specific font then he will not
# be allowed to change the scale. This is because setting the Font.Name
# resource will nullify any Window.Scale settings.
#
# The user is prompted to make the runtime changes permanent by editing
# the user's existing ~./Xdefaults. If the user responds positively the
# temporary file used to update the run-time database is copied to the
# users ~/.Xdefaults. The old version is written to ~/.Xdefaults.old
#
# NOTE: Not all fonts will work correctly with all OpenWindows deskset
# and 3rd party applications. This a particularily true of OWN V2
# applications. V3 apps seem to handle various font sizes much
# better.
#
# Usage:
# chfont
#
# Author:
#
# 9/24/91 - Michael O'Connor Sun Microsystems Computer Corp.
# email: michael.oconnor@west.Sun.COM
#
###########################################################################

set scale = ""
set font = ""
set change_font = FALSE
set change_scale = FALSE
set RESOURCE_FILE = ~/.Xdefaults
set SED_FILE = /tmp/sed.out

# Various commands/Utilities
set SED = /usr/bin/sed
set MV = /bin/mv
set RM = /bin/rm
set XRDB = $OPENWINHOME/bin/xrdb

# Delete old temp files
$RM -rf $SED_FILE

# Read current scale and font settings (if any) from database
set current_font = `$XRDB -query | egrep -i font.name`
set current_scale = `$XRDB -query | egrep -i window.scale`

# Create a copy of current existing resource file with Font.Name and
# Window.Scale entries commented out. Will use this new file below
$SED 's/^\([Ww]indow\.[Ss]cale\)/! \1/; s/^\([Ff]ont\.[Nn]ame\)/! \1/'\
        $RESOURCE_FILE > $SED_FILE

clear
echo "Which would you like:"
echo ""
echo " 1) Change scale of default font"
echo " 2) Select an alternate font"
if ( "$current_font" != "" || "$current_scale" != "" ) then
   echo " 3) Return to default font and scale settings"
endif
echo ""
echo -n "Enter Choice: "
        
set temp=$<

switch($temp)
        case 1:
                if ("$current_font" != "") then
                        echo ""
                        echo "Sorry, you currently have a specific font set"
                        echo "To remove setting and return to default font"
                        echo "re-run $0 and select (3) from menu."
                        echo ""
                        exit 1
                endif
                set change_scale = TRUE
                breaksw
        case 2:
                set change_font = TRUE
                breaksw
        case 3:
                echo "Removing all font and scale settings"
                breaksw
        default:
                echo "Invalid selection"
                exit 1
                breaksw
endsw
                
if ($change_scale == "TRUE") then

        clear
        echo "Select New OpenWindows Font Scale:"
        echo ""
        echo " 1. Small"
        echo ""
        echo " 2. Medium (default)"
        echo ""
        echo " 3. Large"
        echo ""
        echo " 4. Extra Large"
        echo ""
        echo -n "Enter Choice [or Ret for default]: "
        
        set temp=$<

        switch($temp)
                case 1:
                        set scale = small
                        breaksw
                case 2:
                        set scale = medium
                        breaksw
                case 3:
                        set scale = large
                        breaksw
                case 4:
                        set scale = extra_large
                        breaksw
                default:
                        set scale = default
                        breaksw
        endsw

        echo ""
        if ( "$current_scale" != "" ) then
                echo "Current value of $current_scale"
        endif
        echo ""
        echo "Setting value of Window.Scale to: $scale"
        if ($scale != "default") then
                echo "Window.Scale: $scale" >> $SED_FILE
        endif

else if ($change_font == "TRUE") then

        clear
        echo "Select New OpenWindows Font:"
        echo ""
        echo " 1. 5 x 8 (very small)"
        echo " 2. 6 x 10 (small)"
        echo " 3. 7 x 13 lucida bold"
        echo " 4. 8 x 13"
        echo " 5. 8 x 13 bold"
        echo " 6. 8 x 16 sony"
        echo " 7. 9 x 15"
        echo " 8. 9 x 15 bold"
        echo " 9. screen 16 (big)"
        echo " 10. gallant 19 (very big)"
        echo " 11. 12 x 24 sony (huge)"
        echo ""
        echo -n "Enter Choice [or Ret for default font]: "
        
        set temp=$<

        switch($temp)
                case 1:
                        set font = 5x8
                        breaksw
                case 2:
                        set font = 6x10
                        breaksw
                case 3:
                        set font = lucidasans-typewriterbold
                        breaksw
                case 4:
                        set font = 8x13
                        breaksw
                case 5:
                        set font = 8x13bold
                        breaksw
                case 6:
                        set font = rk16
                        breaksw
                case 7:
                        set font = 9x15
                        breaksw
                case 8:
                        set font = 9x15bold
                        breaksw
                case 9:
                        set font = screen.r.16
                        breaksw
                case 10:
                        set font = gallant.r.19
                        breaksw
                case 11:
                        set font = rk24
                        breaksw
                default:
                        set font = default
                        breaksw
        endsw

        echo ""
        if ( "$current_font" != "" ) then
                echo "Current value of $current_font"
        endif
        echo ""
        echo "Setting value of Font.Name to: $font"
        if ( $font != "default" ) then
                echo "Font.Name: $font" >> $SED_FILE
        endif

endif

# Use xrdb utility to rewrite runtime database with new settings
echo ""
echo "Updating X server resource database... "
$XRDB $SED_FILE >& /dev/null

echo ""
echo -n "Do you wish to save this change for future sessions [y/n]: "
        
set temp=$<

switch($temp)
        case 'y':
           echo ""
           echo "Saving current $RESOURCE_FILE to: $RESOURCE_FILE.old"
           echo ""
           $MV $RESOURCE_FILE $RESOURCE_FILE.old
           $MV $SED_FILE $RESOURCE_FILE
           echo "New settings saved to your $RESOURCE_FILE file"
           breaksw
        case 'n':
        default:
                echo ""
                echo Changes not saved to $RESOURCE_FILE
                breaksw
endsw

echo ""
echo "done."
echo ""

exit 0



This archive was generated by hypermail 2.1.2 : Fri Sep 28 2001 - 23:07:56 CDT