File tree 3 files changed +16
-6
lines changed
3 files changed +16
-6
lines changed Original file line number Diff line number Diff line change @@ -390,10 +390,12 @@ The API is similar:
390
390
``cairo-script `` output
391
391
-----------------------
392
392
393
- Setting the ``MPLCAIRO_DEBUG `` environment variable to a non-empty value allows
394
- one to save figures (with ``savefig ``) in the ``.cairoscript `` format, which is
395
- a "native script that matches the cairo drawing model". This may be helpful
396
- for troubleshooting purposes.
393
+ Setting the ``MPLCAIRO_SCRIPT_SURFACE `` environment variable to ``vector ``
394
+ or ``raster `` allows one to save figures (with ``savefig ``) in the
395
+ ``.cairoscript `` format, which is a "native script that matches the cairo
396
+ drawing model". The value of the variable determines the rendering path used
397
+ (e.g., whether marker stamping is used at all). This may be helpful for
398
+ troubleshooting purposes.
397
399
398
400
Note that this may crash the process after the file is written, due to `cairo
399
401
bug #104410 <cairo-104410_> `_.
Original file line number Diff line number Diff line change @@ -255,7 +255,7 @@ def _print_method(
255
255
_print_method , GraphicsContextRendererCairo ._for_svg_output )
256
256
print_svgz = partialmethod (
257
257
_print_method , GraphicsContextRendererCairo ._for_svgz_output )
258
- if os .environ .get ("MPLCAIRO_DEBUG" ) :
258
+ if os .environ .get ("MPLCAIRO_SCRIPT_SURFACE" ) in [ "raster" , "vector" ] :
259
259
print_cairoscript = partialmethod (
260
260
_print_method , GraphicsContextRendererCairo ._for_script_output )
261
261
Original file line number Diff line number Diff line change @@ -115,8 +115,16 @@ bool has_vector_surface(cairo_t* cr)
115
115
case CAIRO_SURFACE_TYPE_PS:
116
116
case CAIRO_SURFACE_TYPE_SVG:
117
117
case CAIRO_SURFACE_TYPE_RECORDING:
118
- case CAIRO_SURFACE_TYPE_SCRIPT:
119
118
return true ;
119
+ case CAIRO_SURFACE_TYPE_SCRIPT:
120
+ if (auto script_surface =
121
+ std::string{std::getenv (" MPLCAIRO_SCRIPT_SURFACE" )};
122
+ script_surface == " raster" ) {
123
+ return false ;
124
+ } else if (script_surface == " vector" ) {
125
+ return true ;
126
+ }
127
+ [[fallthrough]];
120
128
default :
121
129
throw
122
130
std::invalid_argument (
You can’t perform that action at this time.
0 commit comments