[cairo] [API] Accept NULL for cairo_(pdf|ps|svg)_surface_create

Chris Wilson chris at chris-wilson.co.uk
Thu Oct 16 07:39:02 PDT 2008


On Thu, 2008-10-16 at 10:21 -0400, Dominic Lachowicz wrote:
> Hi Chris,
> 
> On Wed, Oct 15, 2008 at 5:56 PM, Chris Wilson <chris at chris-wilson.co.uk> wrote:
> > On IRC, Behdad bemoaned the lack of support in the current API for
> > cairo_pdf_surface_create(NULL, 0, 0). The use case here is querying the
> > target backend for its font options and for measuring the extents of
> > operations, prior to creating the real surface.
> 
> Can't one achieve Behdad's semantic using the create_for_stream()
> variant with a no-op write func, without needing any changes to cairo?
> Creating a valid surface for a NULL filename seems wrong to me.

Yes, that's currently how you must do it - though you tend to only
discover that by trial and error ;-)

The semantics that Behdad proposed are consistent with
cairo_image_surface_create_for_data (NULL, 0, 0) though we cannot
elegantly generalise it for all backends.
-- 
Chris



More information about the cairo mailing list