PostScript woes

Monday, November 6th, 2006 10:12 pm
lethargic_man: Yellow smiley face, only with a neutral expression instead of the smile (Have a [gap] day)
[personal profile] lethargic_man
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.

Date: 2006-11-07 10:35 pm (UTC)
From: [identity profile] curious-reader.livejournal.com
Eh? Why is it called cook book? I was confused and expected some recipes. What a confusing name! Who on earth called it like that?

Date: 2006-11-08 07:07 am (UTC)
From: [identity profile] lethargic-man.livejournal.com
It is full of recipes—recipes for programs. It's not exactly unique in this respect either, witness, frex, the Perl Cookbook (http://www.oreilly.com/catalog/cookbook/). But, honestly, what were you doing expecting recipes in a book I said I got PostScript code out of!?

Date: 2006-11-08 03:59 pm (UTC)
From: [identity profile] curious-reader.livejournal.com
That is why it is so confusing. I know you are talking about PostScript code and Perl. I just wonder why is called "cook book" why not something like "help guide" or whatever. If I just saw the book I would expect cooking recipes.

Date: 2006-11-08 05:05 pm (UTC)
From: [identity profile] lethargic-man.livejournal.com
<rolls eyes> It's an analogical usage. Language does this all the time. You do it all the time too.

(Also, please respect the threading.)

Profile

lethargic_man: (Default)
Lethargic Man (anag.)

May 2025

S M T W T F S
    123
45678910
11121314151617
181920212223 24
25262728293031

Most Popular Tags

Style Credit

Expand Cut Tags

No cut tags
Page generated Tuesday, June 10th, 2025 07:00 am
Powered by Dreamwidth Studios