Re: new line character in a string
- From: RedGrittyBrick <RedGrittyBrick@xxxxxxxxxxxxx>
- Date: Sun, 19 Mar 2006 12:02:08 +0000 (UTC)
wizard.fred@xxxxxxxxx wrote:
...
Needo wrote:
I have tried using \n as newline character in a PS string but when i use
show operator to draw the string then newline doesnt work.
(abc\n mnm) show
I get the folling output
abc mnm
is there any other mechanism to use newline character in a PS string ?
No, you need to show two separate strings and position them individually.
The show operators in PostScript don't have any newline feature.
Helge
...
I think it would be possible of constructing a procedure that would
parse the line(s) and create a line break at that point. Similar to
the automatic book printing ones that do automatic justification and
pagination.
Maybe this will give the OP some clues on the construction of such a function:
%!-Adobe-1.0
%%Title: asciiprint.ps
%%Creator: Ben Cranston
%%CreationDate: Thu Feb 8 1990
% http://www.wam.umd.edu/~zben/PostScript/asciiprint.html
/Courier findfont 10 scalefont setfont
/colwid (m) stringwidth pop def
36 756 moveto
256 string
{ %exec
{ %loop over file
dup currentfile exch readstring exch
{ %loop FF
(\f) search exch
{ %loop LF
(\n) search exch
{ %loop CR
(\r) search exch
{ %loop TAB
(\t) search exch
{ %loop BS
(\b) search exch
show
not { exit } if
pop currentpoint exch colwid sub exch moveto
} loop %BS
not { exit } if
pop currentpoint exch 36 sub colwid div .49 add cvi
8 add dup 8 mod sub colwid mul 36 add exch moveto
} loop %TAB
not { exit } if
pop 36 currentpoint exch pop moveto
} loop %CR
not { exit } if
pop 36 currentpoint exch pop
11 sub dup 25 le { %if
pop showpage 756
} if
moveto
} loop %LF
not { exit } if
pop showpage 36 756 moveto
} loop %FF
not { exit } if
} loop %over file
pop showpage
} bind exec
.
- References:
- new line character in a string
- From: Needo
- Re: new line character in a string
- From: Helge Blischke
- Re: new line character in a string
- From: wizard . fred
- new line character in a string
- Prev by Date: Re: Setting pitch in a monospaced font
- Next by Date: Re: new line character in a string
- Previous by thread: Re: new line character in a string
- Next by thread: Re: new line character in a string
- Index(es):
Relevant Pages
|