[cl-cairo2-devel] null pdf surface

Scott Graham scott.clcairo2 at h4ck3r.net
Mon Jan 5 03:40:40 UTC 2009


Hi

I want to create a null pdf surface to be used for calculating metrics
without writing a file. See:

http://cairographics.org/manual/cairo-pdf-surface.html#cairo-pdf-surface-create

But, with something like:

(defmacro with-pdf-file ((filename width height) &body body)
  "Execute the body with context bound to a newly created pdf
  file, and close it after executing body."
  `(let* ((*context* (create-pdf-context ,filename ,width ,height)))
         (unwind-protect (progn , at body)
                         (destroy *context*))))

(with-pdf-file ((cffi:null-pointer) 500 500)
  (move-to 100 100)
  (line-to 200 200)
  (stroke))

I get (a bunch of) errors spit out:

WARNING: function returned with status WRITE-ERROR.

So I guess it's not working properly. Is there a different way I could
try specifying that "NULL" gets passed into the cairo function
perhaps? Or is this perhaps just a bug in cairo itself?

scott




More information about the Cl-cairo2-devel mailing list