changeset 26567:bf05a7c16e9e stable

Choose "painters" renderer when printing rotated text (bug #55485) * __print_parse_opt__.m: Do not choose opengl renderer when some text objects have angles other that multiples of 90°. * print.m: Document that the renderer options are only implemented for the qt toolkit.
author Pantxo Diribarne <pantxo.diribarne@gmail.com>
date Thu, 17 Jan 2019 09:25:35 +0100
parents f8d380d04b01
children 73654374b86f 0e77df67b522
files scripts/plot/util/print.m scripts/plot/util/private/__print_parse_opts__.m
diffstat 2 files changed, 18 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/scripts/plot/util/print.m	Thu Jan 17 08:04:53 2019 -0800
+++ b/scripts/plot/util/print.m	Thu Jan 17 09:25:35 2019 +0100
@@ -116,6 +116,7 @@
 ## @qcode{"Renderer"} property.  When the figure @code{RendererMode} property
 ## is @qcode{"auto"} Octave will use the @qcode{"opengl"} renderer for raster
 ## formats (e.g., JPEG) and @qcode{"painters"} for vector formats (e.g., PDF).
+## Those options are only supported for the "qt" graphics tookit.
 ##
 ## @item -svgconvert
 ##   For OpenGL-based graphic toolkits, this enables a different backend
--- a/scripts/plot/util/private/__print_parse_opts__.m	Thu Jan 17 08:04:53 2019 -0800
+++ b/scripts/plot/util/private/__print_parse_opts__.m	Thu Jan 17 09:25:35 2019 +0100
@@ -229,14 +229,28 @@
 
   if (strcmp (arg_st.renderer, "auto"))
     if (opengl_ok && strcmp (graphics_toolkit (arg_st.figure), "qt"))
-      arg_st.renderer = "opengl";
+      ## "opengl" renderer only does text rotations of 0°, 90°, 180°, 270°, ...
+      ht = findall (arg_st.figure, "type", "text");
+      angles = [get(ht, "rotation"){:}];
+      if (any (mod (angles, 90)))
+        arg_st.renderer = "painters";
+      else
+        arg_st.renderer = "opengl";
+      endif
     else
       arg_st.renderer = "painters";
     endif
   elseif (strcmp (arg_st.renderer, "opengl") && ! opengl_ok)
     arg_st.renderer = "painters";
-    warning (["print: unsupported output format \"%s\" for renderer ", ...
-              "\"opengl\"."], arg_st.devopt);
+    warning (['print: unsupported output format "%s" for renderer ', ...
+              '"opengl".'], arg_st.devopt);
+  elseif (! strcmp (graphics_toolkit (arg_st.figure), "qt")
+          && strcmp (arg_st.renderer, "opengl"))
+    ## The opengl renderer only works with the "qt" toolkit
+    arg_st.renderer = "painters";
+    warning ('Octave:print:unsupported-renderer',
+             'print: "opengl" renderer unsupported for "%s" toolkit',
+             graphics_toolkit (arg_st.figure));
   endif