[cairo] Initial tests of cairo's PostScript backend with firefox

Michael Sweet mike at easysw.com
Wed Apr 12 17:56:47 PDT 2006


Carl Worth wrote:
> On Tue, 11 Apr 2006 21:41:27 -0400, Michael Sweet wrote:
>> For fun, I ran these files through the (new) CUPS cupstestdsc program.
>> The original firefox 1.5 output passed the tests, but the new cairo-
>> based output had a couple issues:
>>
>>      - %%Page: needs a page label and ordinal page number; typically
>>        you will just use the page number twice, e.g.:
> ...
>>      - You have a lot of lines longer than 255 characters;
> 
> Thanks so much! I really appreciate your attention to detail. Thanks
> to feedback like this I'm hoping cairo will start generating fairly
> reasonable PostScript output soon. I've made changes for both of the
> above and the new output for the minefield page is here:
> 
> 	http://cairographics.org/~cworth/images/minefield-wrapped.ps
> 
> How does that look?

Better - cupstestdsc now passes the file, but I noticed that you
start with page number 0.  Here's the text from the DSC:

     %%Page: <label> <ordinal>
         <label>::= <text>                 (Page name)
         <ordinal> ::= <uint>              (Page position)

         This comment marks the beginning of the PostScript language
         instructions that describe a particular page. %%Page: requires
         two arguments: a page label and a sequential page number. The
         label may be anything, but the ordinal page number must reflect
         the position of that page in the body of the PostScript
         language file and must start with 1, not 0. In the following
         example, the name of the third page of the document is 1:

            %!PS-Adobe-3.0
            ...Document prolog and setup...
            %%Page: cover 1
            ...Rest of the cover page...
            %%Page: ii 2
            ...Rest of the ii page...
            %%Page: 1 3
            ...Rest of the first page...
            %%Page: 2 4
            ...Rest of the second page...
            %%EOF

I'll update cupstestdsc to check for this as well, but it should be
a rather simple change on your end to correct this... :)

>>                                                           probably
>>        the simplest fix is to use a LF instead of space as the
>>        separator.
> 
> That probably would have been the right thing to do, but instead I
> went ahead and wrote some stupid line wrapping code to keep things
> near 80 columns or so. I probably botched it pretty bad, so I've
> attached the patch below for review. In any case, it seems to work on
> the test cases we have in the test suite as well as the minefield page
> from firefox. But that's not saying much of course.

Yeah, generating "pretty" looking PostScript is your call; in my
own software I generally like to line wrap for image data and then
start new "primitives" on a new line - this helps when I do
debugging.  (It actually looks like you are basically doing this,
so good choice! :)

 > ...
> The output from this one is here:
> 
> 	http://cairographics.org/~cworth/images/minefield-wrapped-shorter.ps
> ...

Also tests OK, with the same comment about the ordinal page number.

-- 
______________________________________________________________________
Michael Sweet, Easy Software Products           mike at easysw dot com
Internet Printing and Publishing Software        http://www.easysw.com


More information about the cairo mailing list