[comp.lang.postscript] backspacing letters

beaty@handel.colostate.edu (Billy Bad Ass) (02/24/89)

fellow net-junkies,

i'm trying to modify a font so that the control-H backspaces along with
printing nothing.  this will allow me to print UNIX man pages and the
like without having to search the file for control-H's.  here is how
i'm trying using the example on pp 99-100 in the "red book".  i can get
'normal' letters to backspace, like the '/one' in the following
example;  how do i specify control-H in the place of the '/one'?  if
there is an easier way to get control-H to backspace, please let me
know at the following address

	mucho appreciado 
		steve beaty@handel.colostate.edu

----------------------------------------
%!
/Courier findfont

dup length 1 add dict /newdict exch def
{
	1 index /FID ne
	{
		newdict 3 1 roll put
	}
	{
		pop pop
	}
	ifelse
} 
forall

1 dict begin
	/one -100 def				% replace /one with ?
	newdict /Metrics currentdict put
end

/My-Courier newdict definefont pop
/My-Courier findfont 12 scalefont setfont

100 100 moveto
(ABC123DEF) show				% test overstrike
showpage
----------------------------------------

greid@adobe.com (Glenn Reid) (02/25/89)

In article <1281@ccncsu.ColoState.EDU> beaty@handel.colostate.edu.UUCP (Billy Bad Ass) writes:
>i'm trying to modify a font so that the control-H backspaces along with
>printing nothing.  this will allow me to print UNIX man pages and the
>like without having to search the file for control-H's.  here is how
>i'm trying using the example on pp 99-100 in the "red book".  i can get
>'normal' letters to backspace, like the '/one' in the following
>example;  how do i specify control-H in the place of the '/one'?  if
>there is an easier way to get control-H to backspace, please let me
>know at the following address

Steve,

I tried to get mail through to you on this, but it bounced several
times, and since you've posted teh question, I'll just post my
answer....

It just so happens that my brother and I put this backspace font
together for a project he was working on, and it seems to work pretty
well, although some of the naming is probably less general than it
should be.

Enjoy,
Glenn Reid
Adobe Systems

----------------------------- cut ---
%!
%Title: backspacefont.ps

/backspacefont {
    /Courier findfont dup length dict begin
	{ %forall
	    1 index /FID eq { pop pop } { def } ifelse
	} forall
	currentdict /UniqueID known { %if
	    /UniqueID UniqueID 16#800000 xor def
	} if
	CharStrings length 1 add dict begin
	    CharStrings { def } forall
	    /backspace { -600 0 setcharwidth } bind def
	    currentdict
	end
	/CharStrings exch def
	/Encoding Encoding 256 array copy def
	Encoding 8 /backspace put
	currentdict
    end
    definefont
} bind def

/CourierBack backspacefont

/CourierBack findfont 48 scalefont setfont

100 600 moveto
(ABC\b\b\b___DEF underline\b_\b_\b_\b_\b_\b_\b_\b_\b_) show

showpage