changeset 29442:3a27122022f7 stable

print.m: Warn when figure is too large to be printed to output page (bug #60236) * __print_parse_opts__.m: Warn if the "paperposition" exceeds the boundaries of the output page.
author Pantxo Diribarne <pantxo.diribarne@gmail.com>
date Mon, 15 Mar 2021 13:41:36 +0100
parents 23424aa7a11a
children f2bd8ea1c79c f526f28f1aa4
files scripts/plot/util/private/__print_parse_opts__.m
diffstat 1 files changed, 9 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/scripts/plot/util/private/__print_parse_opts__.m	Sun Mar 14 19:15:57 2021 +0100
+++ b/scripts/plot/util/private/__print_parse_opts__.m	Mon Mar 15 13:41:36 2021 +0100
@@ -497,6 +497,15 @@
 
   if (arg_st.formatted_for_printing)
     arg_st.ghostscript.resolution = [];
+
+    ## Warn if the figure is too large for the selected paper size
+    if (any (papersize_points < (arg_st.canvas_size + paperposition(1:2)))
+        || any (paperposition(1:2) < 0))
+      warning ("Octave:print:figure-too-large", ...
+               ['print: given the current "paperposition" and ', ...
+                '"papersize" properties, the figure is too large ', ...
+                "and will be cropped to fit on the output page."]);
+    endif
   else
     arg_st.ghostscript.papersize = "";
     arg_st.ghostscript.pageoffset = [0, 0];