[alt.sources] Epson LQ-510 shadow, enhanced, etc

blair@obdient.chi.il.us (Doug Blair) (09/28/90)

I saw a couple of postings in (I think) comp.periphs.printers from Epson
LQ-510 owners unable to use their enhanced shadow, outline and shadow+outline
modes (activated with ESC q [0-3]).  Tried it here and it worked just fine.
(make sure your printer interface passes all 8 bits and that you haven't issued
an ESC [=>#]).  I'd been working on a project to use some of the fancier
typestyles from within shell scripts and the results are enclosed.

There are two files here: epfont and epdemo. Epfont will issue the necessary
escape sequences to change fonts, typestyles, point sizes, height and width,
underlining and a few other modes.  Epdemo excercises these features and
will produce SEVEN pages of output per font!  To use these, cut epfont and
epdemo out of this file.  Epfont will accept commands on the order of

	epfont -f Orator -p 12 -i italic -s outline 

to change to the Orator typestyle 12 pitch outlined and italicised.  
Include epfont commands in shell scripts designed to be piped to lp.  To 
show off ALL the typestyles (well, most actually) available on your LQ-510, 
first comment out an appropriate line in epdemo if you have or don't 
have the font module cartridge, then run 

	epdemo | lp

And you'll see almost all your printer can do.  Yes, it does improve the
appearances of the invoices around here tremendously!

Enjoy


Doug
 ___  _           _  _             _    
|   || |_  ___  _| ||_| ___  __  _| |_  Doug Blair    Obedient Software Corp.
| | ||  .\/ ._\/.  || |/ ._\|  \|_   _| 1007 Naperville Rd, Wheaton IL  60187 
|___||___/\___/\___||_|\___/|_|_| |_|   708-653-5527  blair@obdient.chi.il.us


---------------------------- epdemo ----------------------------------------

# epdemo
# exercises epfont functions for Epson LQ-510 printer
# 

# uncomment one of the following lines - use second if you have font module
fonts="Roman Sans"
#fonts="Roman Sans Courier Prestige Script Ocra Ocrb Orator OratorS"

epfont -z
epfont -q lq 

for font in $fonts
do
epfont -f $font

for style in normal outline shadow
do
epfont -s $style

for pitch in 15 12 10
do
epfont -p $pitch

for width in normal wide
do
epfont -w $width

for high in normal tall
do
epfont -h $high

for italic in normal italic
do
epfont -i $italic

for emphasis in normal emphasis
do
epfont -e $emphasis

if [ "$high" = "tall" ]
	then
	echo
fi
echo $width $high $style $font $pitch $italic $emphasis

if [ "$high" = "tall" ]
	then
	echo
fi
echo "ABCDEFGHIJ klmnopqrs 12345 ()#-+[]/"

done
done
done
done
done
done
done

epfont -z
echo

------------------------------- end of epdemo ---------------------------------

---------------------------------- epfont -------------------------------------


# epfont
# echoes escape codes for various fonts, styles and sizes for an
# Epson LQ-510 printer.  Designed to be incorporated into shell
# scripts piped to printer.

USAGE="epfont
	-d doublestrike -e emphasized -f font -h height -i italic
	-j justification -p pitch -q quality -s style -u underline
	-w width -x sub/superscript -z resets

	-d normal|strike
	-e normal|emphasized
	-f roman|sans|courier|prestige|script|ocra|ocrb|orator|orators
	-h normal|tall
	-i normal|italic
	-j left|center|right|full
	-p 10|12|15|condensed|proportional|cancel
	-q draft|lq
	-s normal|shadow|outline|shadline
	-u on|off
	-w normal|wide
	-x subscript|superscript|normal
	-z resets
	
	most arguments require first 2 letters only, case ignored
	"

myerror()
{
echo $0 option -$d bad argument: $OPTARG
echo "$USAGE"
exit 2
}

while getopts d:e:f:h:i:j:p:q:s:u:w:x:z d
do
	case $d in
		d | D )
			case $OPTARG in
				[Nn][Oo]*)
					echo "\033H\c"
					;;
				[Ss][Tt]*)
					echo "\033G\c"
					;;
				*)
					myerror
					;;
			esac
			;;
		e | E )
			case $OPTARG in
				[Nn][Oo]*)
					echo "\033F\c"
					;;
				[Ee][Mm]*)
					echo "\033E\c"
					;;
				*)
					myerror
					;;
			esac
			;;
		f | F )
		# fonts
			case $OPTARG in
				[Rr]*)
					echo "\033k\000\c"
					;;
				[Ss][Aa]*)
					echo "\033k\001\c"
					;;
				[Cc][Oo]*)
					echo "\033k\002\c"
					;;
				[Pp][Rr]*)
					echo "\033k\003\c"
					;;
				[Ss][Cc]*)
					echo "\033k\004\c"
					;;
				[Oo][Cc][Rr][Bb])
					echo "\033k\005\c"
					;;
				[Oo][Cc][Rr][Aa])
					echo "\033k\006\c"
					;;
				[Oo][Rr][Aa][Tt][Oo][Rr][Ss])
					echo "\033k\010\c"
					;;
				[Oo][Rr][Aa][Tt][Oo][Rr])
					echo "\033k\007\c"
					;;
				*)
					myerror
					;;
			esac
			;;
		h | H )
			case $OPTARG in
				[Nn][Oo]*)
					echo "\033w\000\c"
					;;
				[Tt][Aa]* | [Hh][Ii]*)
					echo "\033w\001\c"
					;;
				*)
					myerror
					;;
			esac
			;;
		i | I )
			case $OPTARG in
				[Nn][Oo]*)
					echo "\033\065\c"
					;;
				[Ii][Tt]*)
					echo "\033\064\c"
					;;
				*)
					myerror
					;;
			esac
			;;
		j | J )
			case $OPTARG in
				[Ll][Ee]*)
					echo "\033a\000\c"
					;;
			[Cc][Ee]*)	
					echo "\033a\001\c"
					;;
			[Rr][Ii]*)	
					echo "\033a\002\c"
					;;
			[Ff][Uu]*)	
					echo "\033a\003\c"
					;;
				*)
					myerror
					;;
			esac
			;;
		p | P )
			case $OPTARG in
				10)
					echo "\033p\c"
					;;
				12)
					echo "\033M\c"
					;;
				15)
					echo "\033g\c"
					;;
				[Cc][Oo]*)
					echo "\017\c"
					;;
				[Pp][Rr]*)
					echo "\033p1\c"
					;;
				[Cc][Aa]*)
				# note -p cancel cancels both condensed and proportional
					echo "\022\033p0\c"
					;;
				*)
					myerror
					;;
			esac
			;;
		q | Q )
			case $OPTARG in
				[Dd][Rr]*)
					echo "\033x\000\c"
					;;
				[Ll][Qq])
					echo "\033x\001\c"
					;;
				*)
					myerror
					;;
			esac
			;;
		s | S )
			case $OPTARG in
				[Nn][Oo]*)
					echo "\033q\000\c"
					;;
			[Oo][Uu]*)	
					echo "\033q\001\c"
					;;
			[Ss][Hh][Aa][Dd][Oo]*)	
					echo "\033q\002\c"
					;;
			[Ss][Hh][Aa][Dd][Ll]*)	
					echo "\033q\003\c"
					;;
				*)
					myerror
					;;
			esac
			;;
		u | U )
			case $OPTARG in
				[Oo][Nn]*)
					echo "\033-1\c"
					;;
				[Oo][Ff]*)
					echo "\033-0\c"
					;;
				*)
					myerror
					;;
			esac
			;;
		w | W )
			case $OPTARG in
				[Nn][Oo]*)
					echo "\033W\000\c"
					;;
				[Ww][Ii]*)
					echo "\033W\001\c"
					;;
				*)
					myerror
					;;
			esac
			;;
		x | X )
			case $OPTARG in
				[Ss][Uu][Bb]*)
					echo "\033S1\c"
					;;
				[Ss][Uu][Pp]*)
					echo "\033S0\c"
					;;
				[Nn][Oo]*)
					echo "\033T\c"
					;;
				*)
					myerror
					;;
			esac
			;;
		z | Z )
			echo "\033@\c"
			;;
		\?)
			echo "$USAGE"
			exit 2
			;;
	esac
done
shift `expr $OPTIND - 1`

---------------------------- end of epfont -------------------------------------