PostScript woes
Monday, November 6th, 2006 10:12 pm![[personal profile]](https://www.dreamwidth.org/img/silk/identity/user.png)
As I may have mentioned before, I have written myself a family tree plotting program. I've just tried running it for evidently the first time since upgrading to Fedora Core 5 at home, and the thing's stopped working gs barfed on the PostScript spat out by the Perl, when trying to convert it to PDF.
This is peculiar; I wouldn't have expected static PostScript to stop working. The PostScript in question was largely the output of ogonkify, which reencodes PostScript as Latin-2. Now, there are Perl modules which can spit out encoded PostScript for you, but I didn't know about those when I wrote this program, and in any case my PostScript is programmatic, as I felt generating lots of similar boxes containing text called for subroutines, so I can't use these. I can't wrap my head around encoding PostScript, so I took some ogonkify output and used it as it was. And that was fine, and I could refer to people called Zoë and ancestors from Białystok—until today.
I tried to run ogonkify afresh, to see what it produces on Fedora Core 5... and it fell over. Turns out the hash-bang line reads #!no. Having googled "Fedora Core 5" and "ogonkify", and found mention of an RPM to get it to build on Fedora Core 6. I try installing this, and it complains "Missing Dependency: rtld(GNU_HASH)".
Figuring this is getting me nowhere, I try correcting the hash bang line in ogonkify. After some wrestling with the syntax, I manage to get it to output some valid PostScript, and copy this into my Perl module. Finally, my trees are valid PDF once again. Only the accented characters are coming out garbled now, and I'm banging my head against the PostScript trying to guess what it is I need to do to it when I realise I've run out of time this evening, so shall now post this and go to bed.
Edit: Fixed it! A bit of googling and I found some code in the Blue Book (PostScript Tutorial and Cookbook) that could easily be adapted to solve my problem, with a lot less faff than the ogonkify-generated code, too (it only reencodes the characters it needs, rather than the entire character set). Have to wait until this evening to confirm it will work in my family tree plotter, but I'm confident it will.
This is peculiar; I wouldn't have expected static PostScript to stop working. The PostScript in question was largely the output of ogonkify, which reencodes PostScript as Latin-2. Now, there are Perl modules which can spit out encoded PostScript for you, but I didn't know about those when I wrote this program, and in any case my PostScript is programmatic, as I felt generating lots of similar boxes containing text called for subroutines, so I can't use these. I can't wrap my head around encoding PostScript, so I took some ogonkify output and used it as it was. And that was fine, and I could refer to people called Zoë and ancestors from Białystok—until today.
I tried to run ogonkify afresh, to see what it produces on Fedora Core 5... and it fell over. Turns out the hash-bang line reads #!no. Having googled "Fedora Core 5" and "ogonkify", and found mention of an RPM to get it to build on Fedora Core 6. I try installing this, and it complains "Missing Dependency: rtld(GNU_HASH)".
Figuring this is getting me nowhere, I try correcting the hash bang line in ogonkify. After some wrestling with the syntax, I manage to get it to output some valid PostScript, and copy this into my Perl module. Finally, my trees are valid PDF once again. Only the accented characters are coming out garbled now, and I'm banging my head against the PostScript trying to guess what it is I need to do to it when I realise I've run out of time this evening, so shall now post this and go to bed.
Edit: Fixed it! A bit of googling and I found some code in the Blue Book (PostScript Tutorial and Cookbook) that could easily be adapted to solve my problem, with a lot less faff than the ogonkify-generated code, too (it only reencodes the characters it needs, rather than the entire character set). Have to wait until this evening to confirm it will work in my family tree plotter, but I'm confident it will.
no subject
Date: 2006-11-07 10:35 pm (UTC)no subject
Date: 2006-11-08 07:07 am (UTC)no subject
Date: 2006-11-08 03:59 pm (UTC)no subject
Date: 2006-11-08 05:05 pm (UTC)(Also, please respect the threading.)