HOME

CONTACT

COMMENTS FROM OTHERS

From Chapman Flack

Dear Mr. Nielsen,

Thank you for linking to my direct PostScript page! I enjoyed reading your site.

I had a couple of ideas as I was reading....

Regarding EPS. Have you had a chance to read the Adobe EPS spec?

http://partners.adobe.com/public/developer/en/ps/5002.EPSF_Spec.pdf

That might make some things more clear. For example, there should be no need to manually strip off the showpage at the bottom of an EPS file. The specified thing to do is easier: essentially

save /showpage {} def % paste the EPS file here restore

Now you don't care if the EPS file has a showpage, because you have defined showpage to do nothing. After the EPS file, the restore puts things back as they were for the save, so your definition is gone and you have the real showpage again. (What I didn't show you is that save creates a save object on the stack, and you have to keep track of it and give it to restore. The example above would work fine as long as the EPS file leaves the stack as it found it.)

To be quite correct, there are a few more steps too (you are supposed to set some things to default values that the EPS will expect; again you set those after the save, so the restore gives them back the values you were using). The spec shows little procedures BeginEPSF and EndEPSF you can use to take care of all that. (I am also working on a slightly more convenient version, very close to putting it on the web site; perhaps in the coming week.)

If you do things that way, then no matter how many times you regenerate the EPS file, you never have to edit it and delete anything again. You can just paste or cat it all together and it works.

Regarding fonts . There is probably a way you will find easier. Since it is possible to reencode a font, you are allowed to reencode it any way you like! The way you would probably like best is to find out what codes your Danish keyboard produces for Æ, Ø, Å, æ, ø, å, and set the font encoding vector to use the same codes. Then you really can just type in your plain text editor and get the right result from PostScript without any sed games.

One way to do that would be to use the hexdump or od command on linux to look at a text file that you make to see what codes are in it for those characters. Whatever codes are there, use them in your encoding vector.

But it might be easier than that. Possibly you will find that your text file uses the codes (octal) 301, 330, 305, 346, 370, 345. If you look in appendix E again, you will see those are the codes in a different encoding vector called ISOLatin1Encoding. That vector is already defined in standard PostScript, so you only need to do something like

/Helvetica findfont dup length dict copy begin /Encoding ISOLatin1Encoding def /Helvetica-Lat1 currentdict definefont pop end

Even easier, no? Of course you can still do the hard way if your keyboard coding is different from ISOLatin1.

(Actually the ISOLatin1Encoding vector in PostScript is different in three characters (` ' -) from the real ISO standard for Latin 1. If that gives you a problem you still do not need to make a vector by hand, there is a real iso-8859-1 encoding vector on my web site.)

There is also a lot more information about encodings on my site, here: http://www.anastigmatix.net/postscript/Hyphenate.html#codes

Have fun!

Regards, Chapman Flack