diff --git a/util/helper-cairo.hh b/util/helper-cairo.hh index 541d0e22e..a457f1024 100644 --- a/util/helper-cairo.hh +++ b/util/helper-cairo.hh @@ -67,6 +67,9 @@ _cairo_eps_surface_create_for_stream (cairo_write_func_t write_func, # undef HAS_EPS # endif #endif +#ifdef CAIRO_HAS_SCRIPT_SURFACE +# include +#endif static inline bool helper_cairo_use_hb_draw (const font_options_t *font_opts) @@ -386,6 +389,24 @@ _cairo_png_surface_create_for_stream (cairo_write_func_t write_func, #endif +#ifdef CAIRO_HAS_SCRIPT_SURFACE + +static cairo_surface_t * +_cairo_script_surface_create_for_stream (cairo_write_func_t write_func, + void *closure, + double width, + double height, + cairo_content_t content, + image_protocol_t protocol HB_UNUSED) +{ + cairo_device_t *script = cairo_script_create_for_stream (write_func, closure); + cairo_surface_t *surface = cairo_script_surface_create (script, content, width, height); + cairo_device_destroy (script); + return surface; +} + +#endif + static cairo_status_t stdio_write_func (void *closure, const unsigned char *data, @@ -422,6 +443,9 @@ static const char *helper_cairo_supported_formats[] = "eps", #endif #endif + #ifdef CAIRO_HAS_SCRIPT_SURFACE + "script", + #endif nullptr }; @@ -510,6 +534,10 @@ helper_cairo_create_context (double w, double h, else if (0 == g_ascii_strcasecmp (extension, "eps")) constructor = _cairo_eps_surface_create_for_stream; #endif + #ifdef CAIRO_HAS_SCRIPT_SURFACE + else if (0 == g_ascii_strcasecmp (extension, "script")) + constructor2 = _cairo_script_surface_create_for_stream; + #endif #endif