diff scripts/plot/private/__print_parse_opts__.m @ 14206:df695e37d404

Make sure "print '-SX,Y' ..." doesn't round down a pixel. Bug # 35307. The eps output from gnuplot and gl2ps each specify whole numbrer bboxs. Modify ghostscript's resolution to ensure output size is correct. Also adjust fontisize to compenstate for resolution change. * __print_parse_opts__.m: Set ghostscript resolution to 72 to ensure all bboxs have whole numbers. Add a scalefontsize variable to enable fontsize to be compensated for change in resolution. * print.m: Modify fontsize property value to compensate for change in ghostscript resolution. * __gnuplot_drawnow__.m: Increase precision for specified canvas size.
author Ben Abbott <bpabbott@mac.com>
date Tue, 17 Jan 2012 07:23:36 -0500
parents 72c96de7a403
children f3d52523cde1
line wrap: on
line diff
--- a/scripts/plot/private/__print_parse_opts__.m	Fri Jan 06 12:43:48 2012 -0500
+++ b/scripts/plot/private/__print_parse_opts__.m	Tue Jan 17 07:23:36 2012 -0500
@@ -36,6 +36,7 @@
   arg_st.fig2dev_binary = __quote_path__ (__find_binary__ ("fig2dev"));
   arg_st.fontsize = "";
   arg_st.font = "";
+  arg_st.scalefontsize = 1;
   arg_st.force_solid = 0; # 0=default, -1=dashed, +1=solid
   arg_st.formatted_for_printing = false;
   arg_st.ghostscript.binary = __quote_path__ (__ghostscript_binary__ ());
@@ -326,8 +327,12 @@
       arg_st.ghostscript.pageoffset = paperposition(1:2);
     endif
   else
-    ## Convert canvas size to points from pixles.
-    arg_st.canvas_size = arg_st.canvas_size * 72 / arg_st.ghostscript.resolution;
+    ## Convert canvas size to points from pixels.
+    if (! isempty (arg_st.fontsize))
+      ## Work around the eps bbox having whole numbers (both gnuplot & gl2ps).
+      arg_st.scalefontsize = arg_st.ghostscript.resolution / 72;
+    endif
+    arg_st.ghostscript.resolution = 72;
     arg_st.ghostscript.papersize = arg_st.canvas_size;
     arg_st.ghostscript.epscrop = true;
     arg_st.ghostscript.pageoffset = [0, 0];