Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.postscript > #713
| From | John Deubert <john@acumentraining.com> |
|---|---|
| Organization | Acumen Training |
| Newsgroups | comp.lang.postscript |
| Date | 2012-06-09 07:18 -0700 |
| Message-ID | <2012060907184822140-john@acumentrainingcom> (permalink) |
| References | <87r4to6ddr.fsf@Compaq.site> <878vfw66a3.fsf@Compaq.site> |
| Subject | Re: Why do I not see the characters |
Hi, Cecil -
By "library" do you mean PS code stored on your hard disk?
If so, you can store the code in a .ps file and execute it from within
another PS program with the "run" operator:
(myLibraryCode.ps) run
As you can see, "run" is the PS equivalent of "#include."
The only tricky bit is figuring out what directory on your disk
epstopdf considers to be its "home" directory, that is, where it will
look for the myLibraryCode.ps file. It may be the directory in which
the epstopdf executable resides; that's common, but by no means the
only possibility. One way to ferret this out is to make a file from
within a PS program and see where the file shows up on your disk. Try
this:
% ====Cut here======
(TestFile.txt)(w) file
dup (This is a test.) writestring
closefile
% ====Cut here======
Run this program and see where the TestFile.txt file shows up; that's
the home directory.
There's a detailed article on this in the January 2002 issue of the
Acumen Journal (free for the downloading here:
www.acumentraining.com/acumenjournal.html)
Or am I mistaken about what you're wanting to do?
- John
P.S. Incidentally, the "run" operator's string argument can take a
UNIX-style pathname:
(librarycode/myLibraryCode.ps) run
========
John Deubert
Acumen Training
PostScript & PDF Engineering Classes & Consulting
www.acumentraining.com
Learn PostScript programming techniques
Read the free Acumen Journal
acumentraining.com/acumenjournal.html
On 2012-06-09 12:04:04 +0000, Cecil Westerhof said:
> Op zaterdag 9 jun 2012 11:30 CEST schreef Cecil Westerhof:
>
>> I just started trying to do some things with postscript. I made a
>> little program based on the rosette example in the bluebook. I want in
>> the different wedges to display characters of a string, but they do
>> not appear. What am I doing wrong.
>
> The first part I found. I did not understand what was happening
> correctly. Below a correct working version. Comment is welcome. ;-}
>
>>
>> I also started making a library. But I am working with epstopdf to
>> make a pdf and then convert to create a png. Ideally I would not have
>> to have the library in the program itself, but could use an include.
>> But that is not possible with epstopdf. I tried to use the command
>> that epstopdf generates without the -dSAFER, but to no avail. Anyone
>> an idea how to solve this?
>
> Help with this is still very welcome.
>
> The new code:
> %!PS-Adobe-3.0 EPSF-3.0
> %%BoundingBox: 0 0 600 600
>
> /pageBottom 0 def
> /pageLeft 0 def
> /pageRight 600 def
> /pageTop 600 def
>
> %% Library functions
> /grayBackground { % gray
> newpath
> gsave
> setgray
> newpath
> pageLeft pageBottom pageRight pageTop rectangle
> fill
> stroke
> .4 setgray
> usedFont
> authorFont scalefont
> setfont
> ((c) Cecil Westerhof - Decebal Computing) 550 5 rightString
> grestore
> } def
>
> /rectangle { % left bottom right top
> 4 dict begin
> /top exch def
> /right exch def
> /bottom exch def
> /left exch def
>
> left bottom moveto
> right bottom lineto
> right top lineto
> left top lineto
> left bottom lineto
> closepath
>
> end
> } def
>
> /rightString { % string x y
> 3 dict begin
> /y exch def
> /x exch def
> /string exch def
>
> x y moveto
> string stringwidth pop neg
> 0
> rmoveto
> string
> show
>
> end
> } def
>
>
> %% Normal functions
> /wedge { % string
> gsave
> newpath
> 0 0 moveto
> 1 0 translate
> halfTurn rotate
> 0 halfTurn sin translate
> gsave
> 0 0 halfTurn sin 90 -90 arc
> closepath
> gsave
> fill
> grestore
> 0 setgray
> stroke
> grestore
> 0 setgray
> -90 rotate
> dup stringwidth pop neg 2 div 0 moveto
> show
> grestore
> } def
>
> % Library init
> /authorFont 10 def
> /backgroundGray .6 def
> /usedFont /Bookman findfont def
>
> % Program init
> /steps 14 def
> /turn 360 steps div neg def
> /halfTurn turn 2 div def
> /string (Testing) def
>
> backgroundGray grayBackground
>
> gsave
> 300 300 translate
> 0 0 moveto
> 200 200 scale
> usedFont
> .25 scalefont
> setfont
> 0.02 setlinewidth
> 180 rotate
> 0 1 steps 2 div 1 sub
> {
> dup
> steps div .5 add setgray
> string exch 1 getinterval
> wedge
> turn rotate
> } for
> grestore
>
> showpage
--
Back to comp.lang.postscript | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Why do I not see the characters Cecil Westerhof <Cecil@decebal.nl> - 2012-06-09 11:30 +0200
Re: Why do I not see the characters Cecil Westerhof <Cecil@decebal.nl> - 2012-06-09 14:04 +0200
Re: Why do I not see the characters John Deubert <john@acumentraining.com> - 2012-06-09 07:18 -0700
Re: Why do I not see the characters Cecil Westerhof <Cecil@decebal.nl> - 2012-06-09 19:50 +0200
Re: Why do I not see the characters Helge Blischke <h.blischke@acm.org> - 2012-06-09 22:24 +0200
Re: Why do I not see the characters luser- -droog <mijoryx@yahoo.com> - 2012-06-09 10:14 -0700
Re: Why do I not see the characters Cecil Westerhof <Cecil@decebal.nl> - 2012-06-09 22:16 +0200
Re: Why do I not see the characters luser- -droog <mijoryx@yahoo.com> - 2012-06-09 14:16 -0700
Re: Why do I not see the characters Cecil Westerhof <Cecil@decebal.nl> - 2012-06-10 00:15 +0200
Re: Why do I not see the characters luser- -droog <mijoryx@yahoo.com> - 2012-06-09 15:51 -0700
Re: Why do I not see the characters luser- -droog <mijoryx@yahoo.com> - 2012-06-09 10:24 -0700
csiph-web