[cairo] PDF backend starts to get interesting

Carl Worth cworth at cworth.org
Wed Apr 19 15:59:48 PDT 2006


On Thu, 06 Apr 2006 15:36:59 -0700, Carl Worth wrote:
> Some of the things that can be done here include:
> 
>  * PDF output
> 
>    You might notice I've been talking about PostScript throughout this
>    mail. That's simply because it was what I decided to start with,
>    (being "harder" than PDF). But all the paginated/analysis/meta
>    infrastructure is entirely common, (along with any new work on more
>    interesting analysis strategies). So all that's missing is a little
>    bit of cut-and-paste from cairo-ps-surface.c to cairo-pdf-surface.c
>    to do similar kinds of analysis.

As the PostScript stuff has been coming together, I recently switched
gears and started hammering out was was missing for PDF output.

I've pushed out several commits to cairo's central tree lately that
turn on lots of native stroke and fill support. There's also some very
basic text support. It's currently doing text as paths, much like the
PostScript backend was doing a week ago.

In my personal tree I merged this latest stuff into the mozilla-merged
branch and replicated my "print to file" experiment with the minefield
page against these recent improvements to the PDF backend. The result
can be seen here:

http://cairographics.org/~cworth/images/minefield-mozilla.pdf

Again, this is a reasonable start, but there are also some easy ways
to improve it:

1) As with the PostScript backend, the first page is triggering image
   fallbacks. These should be much easier to avoid in PDF since the
   PDF imaging model (as of PDF 1.4) allows for doing much more than
   PostScript allows. In fact, there's already code in cairo's PDF
   backend to support things like uniform translucence across a stroke
   or fill object---so that just needs to be turned on.

   Then there are things like outputting image translucence via SMask
   support. That should be fairly easy to emit, but will be a bit
   harder to test since poppler currently doesn't support
   SMask. Anyone want to hook that up for us? It would help a lot.

2) Doing each show_text as a giant path is obviously not the right
   thing.

   As we saw with the PostScript backend last week, it was just a
   couple of days of effort to improve this considerably, (by adding
   Type3 support to the PostScript backend). We can now do the same
   kinds of things for the PDF backend.

   There's also some existing font subsetting code in the PDF backend
   that is not currently enabled, (it does have the drawback of being
   tied to the freetype font backend). So there are at least two
   different existing implementations that can be used as starting
   points for that work.

As soon as we get some sort of reasonable glyph output from cairo's
PDF backend I think we'll have an adequate baseline of functionality
for cairo 1.2.

So then I'll start shipping the frequent tar file snapshots I
promised, and we can see what other improvements we can get in before
we do the final 1.2 release.

-Carl
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 191 bytes
Desc: not available
Url : http://lists.freedesktop.org/archives/cairo/attachments/20060419/fe6e18ee/attachment.pgp


More information about the cairo mailing list