Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

text replacement

Status
Not open for further replies.

schmitte

Programmer
Nov 23, 2005
3
FR
I want to make some text replacement in a postscript job. How can I do this. for example, I have this:

%!PS

/Courier 24 selectfont
10 600 moveto (This is a test) show
10 500 moveto (%%redcolor%%) show
10 400 moveto (This is a color changing test) show
10 300 moveto (This is a test) show
showpage

What I would like to do is the replacement of the string %%redcolor%% with this:
0.83 0.00 0.00 setrgbcolor to change the color of the text.

Thank's in advance for your help
 
I think what you want is to be able to define a dictionary entry redcolor so you can switch to red when necessary. For instance, try this:

Code:
%!PS

/redcolor { 0.83 0.00 0.00 setrgbcolor } def
 
/Courier 24 selectfont
10 600 moveto (This is a test) show
%10 500 moveto (%%redcolor%%) show 
%I do not understand why you are moving to 10 500 
%if you just wanted to switch the color, but I may
%misunderstand what you are trying to do
redcolor
10 400 moveto (This is a color changing test) show
10 300 moveto (This is a test) show
showpage

In this example, "This is a color changing test" and the second "This is a test" will both show as red since the color has changed. If you just want the "color changing" line to print red, place a gsave before redcolor and a grestore after show, or define a "blackcolor" as a similiar entry and place blackcolor after the show.

The redcolor can then be modified to whatever shade you need and used whereever you wish throughout the document.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top