home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Simtel MSDOS 1992 September
/
Simtel20_Sept92.cdr
/
msdos
/
laser
/
postprn.arc
/
SHOWLINE.PS
< prev
Wrap
Text File
|
1989-06-09
|
3KB
|
128 lines
%!
% showline -- display the top line on the stack.
%
% assumes we have access to:
%
% doFF handle a form-feed (2 arguments)
% /x current x location
% /y current y location
% /normal-font regular, unbolded font
% /bold-font bolded version of /normal
% /italic-font italics version of /normal
% /page_text set to 1 if text on this page, 0 otherwise
%
/underline 0 def
/showline
{
%
% We have a string -- look for any special characters.
%
/spec 0 def
dup
{
32 lt
{
/spec 1 def
exit
} if
} forall
%
% If no special characters, just show the line
%
spec 0 eq
{
x y moveto
show
/page_text 1 def
}
%
% Special characters -- do it the hard way, char by char.
%
{
{
dup 32 lt
{
dup 28 lt % If char not FS..US
{
dup 12 eq % If char is a FF
{
pop
0 1 doFF % Let doFF do it all
}
{
8 eq % If char is a BS
{
/x x xw sub def % Just decrement x
/y y yw sub def % Just decrement y
x y moveto
} if
} ifelse
}
{ % This is a FS..US
dup 31 eq
{ % US - turns off
pop
normal-font setfont % Return to normal font
/underline 0 def % Turn off underlining
/isbold 0 def % Remember not bold mode
/isitalic 0 def % Remember not italics mode
}
{ % turn bold, under or italics on
dup 30 eq
{ % - turns on bolding
pop
isitalic 0 eq
{
bold-font setfont
}
{
bolditalic-font setfont
} ifelse
/isbold 1 def % Remember bold mode
}
{
29 eq
{ % -- turn on underscoring
/underline 1 def
}
{ % -- turn on italics
/isitalic 1 def % Remember italics mode
isbold 0 eq
{
italic-font setfont
}
{
bolditalic-font setfont
} ifelse
} ifelse
} ifelse
} ifelse
} ifelse
}
%
% Otherwise -- character is printable
%
{
ones 0 3 -1 roll put % Make our substring
x y moveto
underline 1 eq
{
ones undershow % Show the string
}
{
ones show % Show the string
} ifelse
/xw % Prepare to update xw
ones stringwidth % new xw and yw now on stack
/yw exch def def % defines new xw and yw
/x x xw add def % Increment x
/y y yw add def % Increment y
/page_text 1 def
} ifelse
} forall
} ifelse
} def