Mercurial > octave
annotate scripts/plot/util/print.m @ 25884:4e108574385c
Improve OpenGL rendering on high resolution screens with Qt 5 (bug #49053)
* FigureWindow.cc/h (FigureWindow::figureWindowShown): New signal
(FigureWindow::showEvent): Overload QMainWindow::showEvent to also emit
figureWindowShown signal.
* Figure.cc/h (Figure::figureWindowShown): New slot. Set the figure object
__device_pixel_ratio__ property and connect the window's screenChanged signal
to Figure::screenChanged slot.
(Figure::screenChanged): New slot. Update the figure object's
__device_pixel_ratio__ property.
* GLCanvas.cc (GLCanvas::draw, GLCanvas::selectFromAxes) scale the
opengl_rederer's viewport with the correct __device_pixel_ratio__
* gl-render.cc/h (opengl_renderer::m_devpixratio): New data member to store
the current screen's __device_pixel_ratio__
(opengl_renderer::draw_figure): Set m_devpixratio.
(opengl_renderer::setup_opengl_transformation,::draw_text_background,
::opengl_renderer::init_marker): Scale width and height of the figure
when setting up glOrtho transform.
(opengl_renderer::draw_image): Scale zoom factors when using glPixelZoom
(opengl_renderer::set_font): Scale font size.
(opengl_renderer::set_linewidth): Scale line width.
* graphics.cc (device_pixel_ratio): New static function to get the ancestor
figure's __devive_pixel_ratio__.
(axes::properties::update_font, text::properties::update_font): Scale font
size.
(axes::properties::get_ticklabel_extents): Scale tick labels size.
(text::properties::get_extent): Scale text size.
(figure::properties::update_text_pos): New mehtod to update the position of
axes objects annotations and text objects.
* graphics.in.h (figure::properties::__device_pixel_ratio__,
figure::properties::update__device_pixel_ratio__): New property and updater.
(axes::properties::update_font, text::properties::update_font,
text::properties::update_text_extent): Make methods public so that
update_text_pos can access them.
* acinclude.m4: Determine if QScreen::devicePixelRatio is present in the Qt
library in use.
* print.m: set __device_pixel_ratio__ to 1 when printing.
author | John Swensen <jpswensen@gmail.com> |
---|---|
date | Sat, 15 Sep 2018 09:43:48 +0200 |
parents | 3293cd2651fb |
children | 8d2b3e3ff182 |
rev | line source |
---|---|
25054
6652d3823428
maint: Update copyright dates in all source files.
John W. Eaton <jwe@octave.org>
parents:
25003
diff
changeset
|
1 ## Copyright (C) 2008-2018 David Bateman |
5361 | 2 ## |
5362 | 3 ## This file is part of Octave. |
4 ## | |
24534
194eb4bd202b
maint: Update punctuation for GPL v3 license text.
Rik <rik@octave.org>
parents:
24423
diff
changeset
|
5 ## Octave is free software: you can redistribute it and/or modify it |
5362 | 6 ## under the terms of the GNU General Public License as published by |
24534
194eb4bd202b
maint: Update punctuation for GPL v3 license text.
Rik <rik@octave.org>
parents:
24423
diff
changeset
|
7 ## the Free Software Foundation, either version 3 of the License, or |
22755
3a2b891d0b33
maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents:
22578
diff
changeset
|
8 ## (at your option) any later version. |
5362 | 9 ## |
10 ## Octave is distributed in the hope that it will be useful, but | |
11 ## WITHOUT ANY WARRANTY; without even the implied warranty of | |
22755
3a2b891d0b33
maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents:
22578
diff
changeset
|
12 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
3a2b891d0b33
maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents:
22578
diff
changeset
|
13 ## GNU General Public License for more details. |
5361 | 14 ## |
15 ## You should have received a copy of the GNU General Public License | |
7016 | 16 ## along with Octave; see the file COPYING. If not, see |
24534
194eb4bd202b
maint: Update punctuation for GPL v3 license text.
Rik <rik@octave.org>
parents:
24423
diff
changeset
|
17 ## <https://www.gnu.org/licenses/>. |
5361 | 18 |
19 ## -*- texinfo -*- | |
20852
516bb87ea72e
2015 Code Sprint: remove class of function from docstring for all m-files.
Rik <rik@octave.org>
parents:
20778
diff
changeset
|
20 ## @deftypefn {} {} print () |
516bb87ea72e
2015 Code Sprint: remove class of function from docstring for all m-files.
Rik <rik@octave.org>
parents:
20778
diff
changeset
|
21 ## @deftypefnx {} {} print (@var{options}) |
516bb87ea72e
2015 Code Sprint: remove class of function from docstring for all m-files.
Rik <rik@octave.org>
parents:
20778
diff
changeset
|
22 ## @deftypefnx {} {} print (@var{filename}, @var{options}) |
516bb87ea72e
2015 Code Sprint: remove class of function from docstring for all m-files.
Rik <rik@octave.org>
parents:
20778
diff
changeset
|
23 ## @deftypefnx {} {} print (@var{h}, @var{filename}, @var{options}) |
17122
eaab03308c0b
doc: Rewrite docstrings for most plot functions.
Rik <rik@octave.org>
parents:
16933
diff
changeset
|
24 ## Print a plot, or save it to a file. |
eaab03308c0b
doc: Rewrite docstrings for most plot functions.
Rik <rik@octave.org>
parents:
16933
diff
changeset
|
25 ## |
eaab03308c0b
doc: Rewrite docstrings for most plot functions.
Rik <rik@octave.org>
parents:
16933
diff
changeset
|
26 ## Both output formatted for printing (PDF and PostScript), and many bitmapped |
eaab03308c0b
doc: Rewrite docstrings for most plot functions.
Rik <rik@octave.org>
parents:
16933
diff
changeset
|
27 ## and vector image formats are supported. |
5361 | 28 ## |
20713
2469d78a1d8b
Consistently use 'filename' rather than 'file name' throughout code base.
Rik <rik@octave.org>
parents:
20231
diff
changeset
|
29 ## @var{filename} defines the name of the output file. If the filename has |
20173
777f26aa8e3e
doc: Update more docstrings to have one sentence summary as first line.
Rik <rik@octave.org>
parents:
19990
diff
changeset
|
30 ## no suffix, one is inferred from the specified device and appended to the |
20713
2469d78a1d8b
Consistently use 'filename' rather than 'file name' throughout code base.
Rik <rik@octave.org>
parents:
20231
diff
changeset
|
31 ## filename. If no filename is specified, the output is sent to the |
20173
777f26aa8e3e
doc: Update more docstrings to have one sentence summary as first line.
Rik <rik@octave.org>
parents:
19990
diff
changeset
|
32 ## printer. |
14456
05635e4c605a
Improve documentation for print().
Ben Abbott <bpabbott@mac.com>
parents:
14382
diff
changeset
|
33 ## |
17122
eaab03308c0b
doc: Rewrite docstrings for most plot functions.
Rik <rik@octave.org>
parents:
16933
diff
changeset
|
34 ## @var{h} specifies the handle of the figure to print. If no handle is |
eaab03308c0b
doc: Rewrite docstrings for most plot functions.
Rik <rik@octave.org>
parents:
16933
diff
changeset
|
35 ## specified the current figure is used. |
15301
3d05b55c91c7
doc: Clean up docstring for print.m.
Rik <rik@octave.org>
parents:
15214
diff
changeset
|
36 ## |
20173
777f26aa8e3e
doc: Update more docstrings to have one sentence summary as first line.
Rik <rik@octave.org>
parents:
19990
diff
changeset
|
37 ## For output to a printer, PostScript file, or PDF file, the paper size is |
777f26aa8e3e
doc: Update more docstrings to have one sentence summary as first line.
Rik <rik@octave.org>
parents:
19990
diff
changeset
|
38 ## specified by the figure's @code{papersize} property. The location and |
777f26aa8e3e
doc: Update more docstrings to have one sentence summary as first line.
Rik <rik@octave.org>
parents:
19990
diff
changeset
|
39 ## size of the image on the page are specified by the figure's |
777f26aa8e3e
doc: Update more docstrings to have one sentence summary as first line.
Rik <rik@octave.org>
parents:
19990
diff
changeset
|
40 ## @code{paperposition} property. The orientation of the page is specified |
777f26aa8e3e
doc: Update more docstrings to have one sentence summary as first line.
Rik <rik@octave.org>
parents:
19990
diff
changeset
|
41 ## by the figure's @code{paperorientation} property. |
14456
05635e4c605a
Improve documentation for print().
Ben Abbott <bpabbott@mac.com>
parents:
14382
diff
changeset
|
42 ## |
05635e4c605a
Improve documentation for print().
Ben Abbott <bpabbott@mac.com>
parents:
14382
diff
changeset
|
43 ## The width and height of images are specified by the figure's |
24608 | 44 ## @code{paperposition(3:4)} property values. |
14456
05635e4c605a
Improve documentation for print().
Ben Abbott <bpabbott@mac.com>
parents:
14382
diff
changeset
|
45 ## |
15301
3d05b55c91c7
doc: Clean up docstring for print.m.
Rik <rik@octave.org>
parents:
15214
diff
changeset
|
46 ## The @code{print} command supports many @var{options}: |
10834
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10821
diff
changeset
|
47 ## |
5361 | 48 ## @table @code |
10834
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10821
diff
changeset
|
49 ## @item -f@var{h} |
20173
777f26aa8e3e
doc: Update more docstrings to have one sentence summary as first line.
Rik <rik@octave.org>
parents:
19990
diff
changeset
|
50 ## Specify the handle, @var{h}, of the figure to be printed. The default |
777f26aa8e3e
doc: Update more docstrings to have one sentence summary as first line.
Rik <rik@octave.org>
parents:
19990
diff
changeset
|
51 ## is the current figure. |
10834
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10821
diff
changeset
|
52 ## |
5361 | 53 ## @item -P@var{printer} |
15301
3d05b55c91c7
doc: Clean up docstring for print.m.
Rik <rik@octave.org>
parents:
15214
diff
changeset
|
54 ## Set the @var{printer} name to which the plot is sent if no |
3d05b55c91c7
doc: Clean up docstring for print.m.
Rik <rik@octave.org>
parents:
15214
diff
changeset
|
55 ## @var{filename} is specified. |
10821
693e22af08ae
Grammarcheck documentation of m-files
Rik <octave@nomad.inbox5.com>
parents:
10793
diff
changeset
|
56 ## |
9152
4c9aff0c9a61
print.m: Use Ghostscript rather than ImageMagick's 'convert'.
Ben Abbott <bpabbott@mac.com>
parents:
9107
diff
changeset
|
57 ## @item -G@var{ghostscript_command} |
20173
777f26aa8e3e
doc: Update more docstrings to have one sentence summary as first line.
Rik <rik@octave.org>
parents:
19990
diff
changeset
|
58 ## Specify the command for calling Ghostscript. For Unix and Windows the |
777f26aa8e3e
doc: Update more docstrings to have one sentence summary as first line.
Rik <rik@octave.org>
parents:
19990
diff
changeset
|
59 ## defaults are @qcode{"gs"} and @qcode{"gswin32c"}, respectively. |
10821
693e22af08ae
Grammarcheck documentation of m-files
Rik <octave@nomad.inbox5.com>
parents:
10793
diff
changeset
|
60 ## |
17122
eaab03308c0b
doc: Rewrite docstrings for most plot functions.
Rik <rik@octave.org>
parents:
16933
diff
changeset
|
61 ## @item -color |
5361 | 62 ## @itemx -mono |
17122
eaab03308c0b
doc: Rewrite docstrings for most plot functions.
Rik <rik@octave.org>
parents:
16933
diff
changeset
|
63 ## Color or monochrome output. |
10821
693e22af08ae
Grammarcheck documentation of m-files
Rik <octave@nomad.inbox5.com>
parents:
10793
diff
changeset
|
64 ## |
17122
eaab03308c0b
doc: Rewrite docstrings for most plot functions.
Rik <rik@octave.org>
parents:
16933
diff
changeset
|
65 ## @item -solid |
5361 | 66 ## @itemx -dashed |
15301
3d05b55c91c7
doc: Clean up docstring for print.m.
Rik <rik@octave.org>
parents:
15214
diff
changeset
|
67 ## Force all lines to be solid or dashed, respectively. |
10821
693e22af08ae
Grammarcheck documentation of m-files
Rik <octave@nomad.inbox5.com>
parents:
10793
diff
changeset
|
68 ## |
17122
eaab03308c0b
doc: Rewrite docstrings for most plot functions.
Rik <rik@octave.org>
parents:
16933
diff
changeset
|
69 ## @item -portrait |
5361 | 70 ## @itemx -landscape |
20173
777f26aa8e3e
doc: Update more docstrings to have one sentence summary as first line.
Rik <rik@octave.org>
parents:
19990
diff
changeset
|
71 ## Specify the orientation of the plot for printed output. |
777f26aa8e3e
doc: Update more docstrings to have one sentence summary as first line.
Rik <rik@octave.org>
parents:
19990
diff
changeset
|
72 ## For non-printed output the aspect ratio of the output corresponds to the |
777f26aa8e3e
doc: Update more docstrings to have one sentence summary as first line.
Rik <rik@octave.org>
parents:
19990
diff
changeset
|
73 ## plot area defined by the @qcode{"paperposition"} property in the |
777f26aa8e3e
doc: Update more docstrings to have one sentence summary as first line.
Rik <rik@octave.org>
parents:
19990
diff
changeset
|
74 ## orientation specified. This option is equivalent to changing the figure's |
777f26aa8e3e
doc: Update more docstrings to have one sentence summary as first line.
Rik <rik@octave.org>
parents:
19990
diff
changeset
|
75 ## @qcode{"paperorientation"} property. |
10821
693e22af08ae
Grammarcheck documentation of m-files
Rik <octave@nomad.inbox5.com>
parents:
10793
diff
changeset
|
76 ## |
17122
eaab03308c0b
doc: Rewrite docstrings for most plot functions.
Rik <rik@octave.org>
parents:
16933
diff
changeset
|
77 ## @item -TextAlphaBits=@var{n} |
14774
0d6dae0f6bc2
Allow setting of ghostscript TextAlphaBits and GraphicsAlphaBits.
John Hunt <huntj@gmx.us>
parents:
14620
diff
changeset
|
78 ## @itemx -GraphicsAlphaBits=@var{n} |
0d6dae0f6bc2
Allow setting of ghostscript TextAlphaBits and GraphicsAlphaBits.
John Hunt <huntj@gmx.us>
parents:
14620
diff
changeset
|
79 ## Octave is able to produce output for various printers, bitmaps, and |
20173
777f26aa8e3e
doc: Update more docstrings to have one sentence summary as first line.
Rik <rik@octave.org>
parents:
19990
diff
changeset
|
80 ## vector formats by using Ghostscript. For bitmap and printer output |
777f26aa8e3e
doc: Update more docstrings to have one sentence summary as first line.
Rik <rik@octave.org>
parents:
19990
diff
changeset
|
81 ## anti-aliasing is applied using Ghostscript's TextAlphaBits and |
22517
34f98c1e4d56
Disable anti-aliasing for graphics in raster outputs (bug #48873).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
22323
diff
changeset
|
82 ## GraphicsAlphaBits options. The default number of bits are 4 and 1 |
34f98c1e4d56
Disable anti-aliasing for graphics in raster outputs (bug #48873).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
22323
diff
changeset
|
83 ## respectively. Allowed values for @var{N} are 1, 2, or 4. |
14774
0d6dae0f6bc2
Allow setting of ghostscript TextAlphaBits and GraphicsAlphaBits.
John Hunt <huntj@gmx.us>
parents:
14620
diff
changeset
|
84 ## |
5361 | 85 ## @item -d@var{device} |
20173
777f26aa8e3e
doc: Update more docstrings to have one sentence summary as first line.
Rik <rik@octave.org>
parents:
19990
diff
changeset
|
86 ## The available output format is specified by the option @var{device}, and |
777f26aa8e3e
doc: Update more docstrings to have one sentence summary as first line.
Rik <rik@octave.org>
parents:
19990
diff
changeset
|
87 ## is one of: |
14366
b76f0740940e
doc: Periodic grammar check of documentation.
Rik <octave@nomad.inbox5.com>
parents:
14356
diff
changeset
|
88 ## |
5361 | 89 ## @table @code |
17122
eaab03308c0b
doc: Rewrite docstrings for most plot functions.
Rik <rik@octave.org>
parents:
16933
diff
changeset
|
90 ## @item ps |
5361 | 91 ## @itemx ps2 |
92 ## @itemx psc | |
93 ## @itemx psc2 | |
23485
2f90ac754550
print.m: Update documentation to refer to OpenGL-based toolkits, not just FLTK.
Rik <rik@octave.org>
parents:
23219
diff
changeset
|
94 ## PostScript (level 1 and 2, mono and color). The OpenGL-based toolkits |
2f90ac754550
print.m: Update documentation to refer to OpenGL-based toolkits, not just FLTK.
Rik <rik@octave.org>
parents:
23219
diff
changeset
|
95 ## always generate PostScript level 3.0. |
10821
693e22af08ae
Grammarcheck documentation of m-files
Rik <octave@nomad.inbox5.com>
parents:
10793
diff
changeset
|
96 ## |
17122
eaab03308c0b
doc: Rewrite docstrings for most plot functions.
Rik <rik@octave.org>
parents:
16933
diff
changeset
|
97 ## @item eps |
5361 | 98 ## @itemx eps2 |
99 ## @itemx epsc | |
100 ## @itemx epsc2 | |
23485
2f90ac754550
print.m: Update documentation to refer to OpenGL-based toolkits, not just FLTK.
Rik <rik@octave.org>
parents:
23219
diff
changeset
|
101 ## Encapsulated PostScript (level 1 and 2, mono and color). The |
2f90ac754550
print.m: Update documentation to refer to OpenGL-based toolkits, not just FLTK.
Rik <rik@octave.org>
parents:
23219
diff
changeset
|
102 ## OpenGL-based toolkits always generate PostScript level 3.0. |
10841
1577accf2ed8
print.m: Update documentation string. Change to active voice.
Rik <octave@nomad.inbox5.com>
parents:
10834
diff
changeset
|
103 ## |
19026
d6f1f46e5b8f
Fix double '-P' in print command to printer (bug #41957).
Michael Godfrey <michaeldgodfrey@gmail.com>
parents:
17751
diff
changeset
|
104 ## @item pslatex |
6739 | 105 ## @itemx epslatex |
10860
3a5f5c99cc39
print.m: Modify texinfo. Add unwind_protect block.
Ben Abbott <bpabbott@mac.com>
parents:
10854
diff
changeset
|
106 ## @itemx pdflatex |
19026
d6f1f46e5b8f
Fix double '-P' in print command to printer (bug #41957).
Michael Godfrey <michaeldgodfrey@gmail.com>
parents:
17751
diff
changeset
|
107 ## @itemx pslatexstandalone |
d6f1f46e5b8f
Fix double '-P' in print command to printer (bug #41957).
Michael Godfrey <michaeldgodfrey@gmail.com>
parents:
17751
diff
changeset
|
108 ## @itemx epslatexstandalone |
d6f1f46e5b8f
Fix double '-P' in print command to printer (bug #41957).
Michael Godfrey <michaeldgodfrey@gmail.com>
parents:
17751
diff
changeset
|
109 ## @itemx pdflatexstandalone |
d6f1f46e5b8f
Fix double '-P' in print command to printer (bug #41957).
Michael Godfrey <michaeldgodfrey@gmail.com>
parents:
17751
diff
changeset
|
110 ## Generate a @LaTeX{} file @file{@var{filename}.tex} for the text |
d6f1f46e5b8f
Fix double '-P' in print command to printer (bug #41957).
Michael Godfrey <michaeldgodfrey@gmail.com>
parents:
17751
diff
changeset
|
111 ## portions of a plot and a file @file{@var{filename}.(ps|eps|pdf)} for the |
d6f1f46e5b8f
Fix double '-P' in print command to printer (bug #41957).
Michael Godfrey <michaeldgodfrey@gmail.com>
parents:
17751
diff
changeset
|
112 ## remaining graphics. The graphics file suffix .ps|eps|pdf is determined |
d6f1f46e5b8f
Fix double '-P' in print command to printer (bug #41957).
Michael Godfrey <michaeldgodfrey@gmail.com>
parents:
17751
diff
changeset
|
113 ## by the specified device type. The @LaTeX{} file produced by the |
d6f1f46e5b8f
Fix double '-P' in print command to printer (bug #41957).
Michael Godfrey <michaeldgodfrey@gmail.com>
parents:
17751
diff
changeset
|
114 ## @samp{standalone} option can be processed directly by @LaTeX{}. The file |
d6f1f46e5b8f
Fix double '-P' in print command to printer (bug #41957).
Michael Godfrey <michaeldgodfrey@gmail.com>
parents:
17751
diff
changeset
|
115 ## generated without the @samp{standalone} option is intended to be included |
d6f1f46e5b8f
Fix double '-P' in print command to printer (bug #41957).
Michael Godfrey <michaeldgodfrey@gmail.com>
parents:
17751
diff
changeset
|
116 ## from another @LaTeX{} document. In either case, the @LaTeX{} file |
d6f1f46e5b8f
Fix double '-P' in print command to printer (bug #41957).
Michael Godfrey <michaeldgodfrey@gmail.com>
parents:
17751
diff
changeset
|
117 ## contains an @code{\includegraphics} command so that the generated graphics |
d6f1f46e5b8f
Fix double '-P' in print command to printer (bug #41957).
Michael Godfrey <michaeldgodfrey@gmail.com>
parents:
17751
diff
changeset
|
118 ## file is automatically included when the @LaTeX{} file is processed. The |
d6f1f46e5b8f
Fix double '-P' in print command to printer (bug #41957).
Michael Godfrey <michaeldgodfrey@gmail.com>
parents:
17751
diff
changeset
|
119 ## text that is written to the @LaTeX{} file contains the strings |
d6f1f46e5b8f
Fix double '-P' in print command to printer (bug #41957).
Michael Godfrey <michaeldgodfrey@gmail.com>
parents:
17751
diff
changeset
|
120 ## @strong{exactly} as they were specified in the plot. If any special |
d6f1f46e5b8f
Fix double '-P' in print command to printer (bug #41957).
Michael Godfrey <michaeldgodfrey@gmail.com>
parents:
17751
diff
changeset
|
121 ## characters of the @TeX{} mode interpreter were used, the file must be |
d6f1f46e5b8f
Fix double '-P' in print command to printer (bug #41957).
Michael Godfrey <michaeldgodfrey@gmail.com>
parents:
17751
diff
changeset
|
122 ## edited before @LaTeX{} processing. Specifically, the special characters |
d6f1f46e5b8f
Fix double '-P' in print command to printer (bug #41957).
Michael Godfrey <michaeldgodfrey@gmail.com>
parents:
17751
diff
changeset
|
123 ## must be enclosed with dollar signs (@code{$ @dots{} $}), and other |
d6f1f46e5b8f
Fix double '-P' in print command to printer (bug #41957).
Michael Godfrey <michaeldgodfrey@gmail.com>
parents:
17751
diff
changeset
|
124 ## characters that are recognized by @LaTeX{} may also need editing (.e.g., |
d6f1f46e5b8f
Fix double '-P' in print command to printer (bug #41957).
Michael Godfrey <michaeldgodfrey@gmail.com>
parents:
17751
diff
changeset
|
125 ## braces). The @samp{pdflatex} device, and any of the @samp{standalone} |
d6f1f46e5b8f
Fix double '-P' in print command to printer (bug #41957).
Michael Godfrey <michaeldgodfrey@gmail.com>
parents:
17751
diff
changeset
|
126 ## formats, are not available with the Gnuplot toolkit. |
10821
693e22af08ae
Grammarcheck documentation of m-files
Rik <octave@nomad.inbox5.com>
parents:
10793
diff
changeset
|
127 ## |
21122
dba88797f69f
doc: Periodic grammarcheck of documentation.
Rik <rik@octave.org>
parents:
20971
diff
changeset
|
128 ## @item epscairo |
20964
6ac3d299c5ad
Add support for cairo based gnuplot terminals: "cairolatex", "epscairo",
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
20936
diff
changeset
|
129 ## @itemx pdfcairo |
6ac3d299c5ad
Add support for cairo based gnuplot terminals: "cairolatex", "epscairo",
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
20936
diff
changeset
|
130 ## @itemx epscairolatex |
6ac3d299c5ad
Add support for cairo based gnuplot terminals: "cairolatex", "epscairo",
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
20936
diff
changeset
|
131 ## @itemx pdfcairolatex |
6ac3d299c5ad
Add support for cairo based gnuplot terminals: "cairolatex", "epscairo",
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
20936
diff
changeset
|
132 ## @itemx epscairolatexstandalone |
6ac3d299c5ad
Add support for cairo based gnuplot terminals: "cairolatex", "epscairo",
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
20936
diff
changeset
|
133 ## @itemx pdfcairolatexstandalone |
25582
0df6454f58ea
print.m: Allow 'tif' to indicate 'tiff' format (bug #54282).
Rik <rik@octave.org>
parents:
25307
diff
changeset
|
134 ## Generate Cairo-based output when using the Gnuplot graphics toolkit. |
20964
6ac3d299c5ad
Add support for cairo based gnuplot terminals: "cairolatex", "epscairo",
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
20936
diff
changeset
|
135 ## The @samp{epscairo} and @samp{pdfcairo} devices are synonymous with |
21122
dba88797f69f
doc: Periodic grammarcheck of documentation.
Rik <rik@octave.org>
parents:
20971
diff
changeset
|
136 ## the @samp{epsc} device. The @LaTeX{} variants generate a @LaTeX{} file, |
20964
6ac3d299c5ad
Add support for cairo based gnuplot terminals: "cairolatex", "epscairo",
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
20936
diff
changeset
|
137 ## @file{@var{filename}.tex}, for the text portions of a plot, and an image |
6ac3d299c5ad
Add support for cairo based gnuplot terminals: "cairolatex", "epscairo",
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
20936
diff
changeset
|
138 ## file, @file{@var{filename}.(eps|pdf)}, for the graph portion of the plot. |
6ac3d299c5ad
Add support for cairo based gnuplot terminals: "cairolatex", "epscairo",
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
20936
diff
changeset
|
139 ## The @samp{standalone} variants behave as described for |
6ac3d299c5ad
Add support for cairo based gnuplot terminals: "cairolatex", "epscairo",
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
20936
diff
changeset
|
140 ## @samp{epslatexstandalone} above. |
6ac3d299c5ad
Add support for cairo based gnuplot terminals: "cairolatex", "epscairo",
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
20936
diff
changeset
|
141 ## |
17122
eaab03308c0b
doc: Rewrite docstrings for most plot functions.
Rik <rik@octave.org>
parents:
16933
diff
changeset
|
142 ## @item ill |
25003
2365c2661b3c
doc: Spellcheck documentation ahead of 4.4 release.
Rik <rik@octave.org>
parents:
24687
diff
changeset
|
143 ## @itemx @nospell{aifm} |
25582
0df6454f58ea
print.m: Allow 'tif' to indicate 'tiff' format (bug #54282).
Rik <rik@octave.org>
parents:
25307
diff
changeset
|
144 ## Adobe Illustrator (obsolete for Gnuplot versions > 4.2) |
10821
693e22af08ae
Grammarcheck documentation of m-files
Rik <octave@nomad.inbox5.com>
parents:
10793
diff
changeset
|
145 ## |
20971
22318eeaca3b
Add gnuplot "canvas" terminal to the print.m doc-string.
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
20970
diff
changeset
|
146 ## @item canvas |
22318eeaca3b
Add gnuplot "canvas" terminal to the print.m doc-string.
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
20970
diff
changeset
|
147 ## Javascript-based drawing on HTML5 canvas viewable in a web browser |
22318eeaca3b
Add gnuplot "canvas" terminal to the print.m doc-string.
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
20970
diff
changeset
|
148 ## (only available for the Gnuplot graphics toolkit). |
22318eeaca3b
Add gnuplot "canvas" terminal to the print.m doc-string.
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
20970
diff
changeset
|
149 ## |
17122
eaab03308c0b
doc: Rewrite docstrings for most plot functions.
Rik <rik@octave.org>
parents:
16933
diff
changeset
|
150 ## @item cdr |
10791
3140cb7a05a1
Add spellchecker scripts for Octave and run spellcheck of documentation
Rik <octave@nomad.inbox5.com>
parents:
10727
diff
changeset
|
151 ## @itemx @nospell{corel} |
25003
2365c2661b3c
doc: Spellcheck documentation ahead of 4.4 release.
Rik <rik@octave.org>
parents:
24687
diff
changeset
|
152 ## @nospell{CorelDraw} |
10821
693e22af08ae
Grammarcheck documentation of m-files
Rik <octave@nomad.inbox5.com>
parents:
10793
diff
changeset
|
153 ## |
25307
f2eb8bfcccb6
Use consistent gnuplot toolkit font syntax allow SVG fractional font size (bug #53737)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25054
diff
changeset
|
154 ## @item cgm |
f2eb8bfcccb6
Use consistent gnuplot toolkit font syntax allow SVG fractional font size (bug #53737)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25054
diff
changeset
|
155 ## Computer Graphics Metafile, Version 1, ANSI X3.122-1986 |
f2eb8bfcccb6
Use consistent gnuplot toolkit font syntax allow SVG fractional font size (bug #53737)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25054
diff
changeset
|
156 ## (only available for the Gnuplot graphics toolkit). |
f2eb8bfcccb6
Use consistent gnuplot toolkit font syntax allow SVG fractional font size (bug #53737)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25054
diff
changeset
|
157 ## |
6965 | 158 ## @item dxf |
159 ## AutoCAD | |
10821
693e22af08ae
Grammarcheck documentation of m-files
Rik <octave@nomad.inbox5.com>
parents:
10793
diff
changeset
|
160 ## |
17122
eaab03308c0b
doc: Rewrite docstrings for most plot functions.
Rik <rik@octave.org>
parents:
16933
diff
changeset
|
161 ## @item emf |
9107
d0d507cbd123
Improvements to printing functionality.
Ben Abbott <bpabbott@mac.com>
parents:
9056
diff
changeset
|
162 ## @itemx meta |
6965 | 163 ## Microsoft Enhanced Metafile |
10821
693e22af08ae
Grammarcheck documentation of m-files
Rik <octave@nomad.inbox5.com>
parents:
10793
diff
changeset
|
164 ## |
6965 | 165 ## @item fig |
11576
8ac9687dbe9f
rename backend to graphics_toolkit
John W. Eaton <jwe@octave.org>
parents:
11563
diff
changeset
|
166 ## XFig. For the Gnuplot graphics toolkit, the additional options |
22571
83f106bfcb37
Make "pdflatex" an alias of "pdfcairolatex" for gnuplot toolkit print (bug #49223).
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
22517
diff
changeset
|
167 ## @option{-textspecial} or @option{-textnormal} can be used to control |
83f106bfcb37
Make "pdflatex" an alias of "pdfcairolatex" for gnuplot toolkit print (bug #49223).
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
22517
diff
changeset
|
168 ## whether the special flag should be set for the text in the figure. |
83f106bfcb37
Make "pdflatex" an alias of "pdfcairolatex" for gnuplot toolkit print (bug #49223).
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
22517
diff
changeset
|
169 ## (default is @option{-textnormal}) |
10821
693e22af08ae
Grammarcheck documentation of m-files
Rik <octave@nomad.inbox5.com>
parents:
10793
diff
changeset
|
170 ## |
20969
984678f19352
Impproved support gnuplot terminals "eepic", "latex", "pstricks", & "texdraw".
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
20968
diff
changeset
|
171 ## @item gif |
25307
f2eb8bfcccb6
Use consistent gnuplot toolkit font syntax allow SVG fractional font size (bug #53737)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25054
diff
changeset
|
172 ## GIF image |
f2eb8bfcccb6
Use consistent gnuplot toolkit font syntax allow SVG fractional font size (bug #53737)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25054
diff
changeset
|
173 ## (only available for the Gnuplot graphics toolkit). |
20969
984678f19352
Impproved support gnuplot terminals "eepic", "latex", "pstricks", & "texdraw".
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
20968
diff
changeset
|
174 ## |
5361 | 175 ## @item hpgl |
176 ## HP plotter language | |
10821
693e22af08ae
Grammarcheck documentation of m-files
Rik <octave@nomad.inbox5.com>
parents:
10793
diff
changeset
|
177 ## |
20969
984678f19352
Impproved support gnuplot terminals "eepic", "latex", "pstricks", & "texdraw".
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
20968
diff
changeset
|
178 ## @item jpg |
984678f19352
Impproved support gnuplot terminals "eepic", "latex", "pstricks", & "texdraw".
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
20968
diff
changeset
|
179 ## @itemx jpeg |
984678f19352
Impproved support gnuplot terminals "eepic", "latex", "pstricks", & "texdraw".
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
20968
diff
changeset
|
180 ## JPEG image |
984678f19352
Impproved support gnuplot terminals "eepic", "latex", "pstricks", & "texdraw".
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
20968
diff
changeset
|
181 ## |
984678f19352
Impproved support gnuplot terminals "eepic", "latex", "pstricks", & "texdraw".
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
20968
diff
changeset
|
182 ## @item latex |
25307
f2eb8bfcccb6
Use consistent gnuplot toolkit font syntax allow SVG fractional font size (bug #53737)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25054
diff
changeset
|
183 ## @itemx eepic |
f2eb8bfcccb6
Use consistent gnuplot toolkit font syntax allow SVG fractional font size (bug #53737)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25054
diff
changeset
|
184 ## @LaTeX{} picture environment and extended picture environment |
f2eb8bfcccb6
Use consistent gnuplot toolkit font syntax allow SVG fractional font size (bug #53737)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25054
diff
changeset
|
185 ## (only available for the Gnuplot graphics toolkit). |
20969
984678f19352
Impproved support gnuplot terminals "eepic", "latex", "pstricks", & "texdraw".
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
20968
diff
changeset
|
186 ## |
5361 | 187 ## @item mf |
188 ## Metafont | |
10821
693e22af08ae
Grammarcheck documentation of m-files
Rik <octave@nomad.inbox5.com>
parents:
10793
diff
changeset
|
189 ## |
5361 | 190 ## @item png |
25582
0df6454f58ea
print.m: Allow 'tif' to indicate 'tiff' format (bug #54282).
Rik <rik@octave.org>
parents:
25307
diff
changeset
|
191 ## Portable Network Graphics |
10821
693e22af08ae
Grammarcheck documentation of m-files
Rik <octave@nomad.inbox5.com>
parents:
10793
diff
changeset
|
192 ## |
5361 | 193 ## @item pbm |
194 ## PBMplus | |
10821
693e22af08ae
Grammarcheck documentation of m-files
Rik <octave@nomad.inbox5.com>
parents:
10793
diff
changeset
|
195 ## |
20969
984678f19352
Impproved support gnuplot terminals "eepic", "latex", "pstricks", & "texdraw".
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
20968
diff
changeset
|
196 ## @item pdf |
25582
0df6454f58ea
print.m: Allow 'tif' to indicate 'tiff' format (bug #54282).
Rik <rik@octave.org>
parents:
25307
diff
changeset
|
197 ## Portable Document Format |
20969
984678f19352
Impproved support gnuplot terminals "eepic", "latex", "pstricks", & "texdraw".
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
20968
diff
changeset
|
198 ## |
6965 | 199 ## @item svg |
25582
0df6454f58ea
print.m: Allow 'tif' to indicate 'tiff' format (bug #54282).
Rik <rik@octave.org>
parents:
25307
diff
changeset
|
200 ## Scalable Vector Graphics |
0df6454f58ea
print.m: Allow 'tif' to indicate 'tiff' format (bug #54282).
Rik <rik@octave.org>
parents:
25307
diff
changeset
|
201 ## |
0df6454f58ea
print.m: Allow 'tif' to indicate 'tiff' format (bug #54282).
Rik <rik@octave.org>
parents:
25307
diff
changeset
|
202 ## @item tif |
0df6454f58ea
print.m: Allow 'tif' to indicate 'tiff' format (bug #54282).
Rik <rik@octave.org>
parents:
25307
diff
changeset
|
203 ## @itemx tiff |
0df6454f58ea
print.m: Allow 'tif' to indicate 'tiff' format (bug #54282).
Rik <rik@octave.org>
parents:
25307
diff
changeset
|
204 ## TIFF image, compressed |
10821
693e22af08ae
Grammarcheck documentation of m-files
Rik <octave@nomad.inbox5.com>
parents:
10793
diff
changeset
|
205 ## |
21122
dba88797f69f
doc: Periodic grammarcheck of documentation.
Rik <rik@octave.org>
parents:
20971
diff
changeset
|
206 ## @item tikz |
20969
984678f19352
Impproved support gnuplot terminals "eepic", "latex", "pstricks", & "texdraw".
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
20968
diff
changeset
|
207 ## @itemx tikzstandalone |
23485
2f90ac754550
print.m: Update documentation to refer to OpenGL-based toolkits, not just FLTK.
Rik <rik@octave.org>
parents:
23219
diff
changeset
|
208 ## Generate a @LaTeX{} file using PGF/TikZ format. The OpenGL-based |
2f90ac754550
print.m: Update documentation to refer to OpenGL-based toolkits, not just FLTK.
Rik <rik@octave.org>
parents:
23219
diff
changeset
|
209 ## toolkits create a PGF file while Gnuplot creates a TikZ file. The |
2f90ac754550
print.m: Update documentation to refer to OpenGL-based toolkits, not just FLTK.
Rik <rik@octave.org>
parents:
23219
diff
changeset
|
210 ## @samp{tikzstandalone} device produces a @LaTeX{} document which includes the |
2f90ac754550
print.m: Update documentation to refer to OpenGL-based toolkits, not just FLTK.
Rik <rik@octave.org>
parents:
23219
diff
changeset
|
211 ## TikZ file (@samp{tikzstandalone} and is only available for the Gnuplot |
2f90ac754550
print.m: Update documentation to refer to OpenGL-based toolkits, not just FLTK.
Rik <rik@octave.org>
parents:
23219
diff
changeset
|
212 ## graphics toolkit). |
24207
f3d754deb41d
print.m: fix device table formating in docstring
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
24139
diff
changeset
|
213 ## @end table |
5361 | 214 ## |
215 ## If the device is omitted, it is inferred from the file extension, | |
17122
eaab03308c0b
doc: Rewrite docstrings for most plot functions.
Rik <rik@octave.org>
parents:
16933
diff
changeset
|
216 ## or if there is no filename it is sent to the printer as PostScript. |
5361 | 217 ## |
10423
dfc662a47b7a
print.m: Add '-append' option.
Ben Abbott <bpabbott@mac.com>
parents:
10422
diff
changeset
|
218 ## @item -d@var{ghostscript_device} |
10854
d5a7db05d591
Add PS and PDF output for the fltk backend.
Ben Abbott <bpabbott@mac.com>
parents:
10841
diff
changeset
|
219 ## Additional devices are supported by Ghostscript. |
d5a7db05d591
Add PS and PDF output for the fltk backend.
Ben Abbott <bpabbott@mac.com>
parents:
10841
diff
changeset
|
220 ## Some examples are; |
9152
4c9aff0c9a61
print.m: Use Ghostscript rather than ImageMagick's 'convert'.
Ben Abbott <bpabbott@mac.com>
parents:
9107
diff
changeset
|
221 ## |
4c9aff0c9a61
print.m: Use Ghostscript rather than ImageMagick's 'convert'.
Ben Abbott <bpabbott@mac.com>
parents:
9107
diff
changeset
|
222 ## @table @code |
19026
d6f1f46e5b8f
Fix double '-P' in print command to printer (bug #41957).
Michael Godfrey <michaeldgodfrey@gmail.com>
parents:
17751
diff
changeset
|
223 ## @item pdfwrite |
d6f1f46e5b8f
Fix double '-P' in print command to printer (bug #41957).
Michael Godfrey <michaeldgodfrey@gmail.com>
parents:
17751
diff
changeset
|
224 ## Produces pdf output from eps |
d6f1f46e5b8f
Fix double '-P' in print command to printer (bug #41957).
Michael Godfrey <michaeldgodfrey@gmail.com>
parents:
17751
diff
changeset
|
225 ## |
11587
c792872f8942
all script files: untabify and strip trailing whitespace
John W. Eaton <jwe@octave.org>
parents:
11576
diff
changeset
|
226 ## @item ljet2p |
16826
a4969508008e
doc: Periodic spellcheck of the documentation.
Rik <rik@octave.org>
parents:
16766
diff
changeset
|
227 ## HP LaserJet @nospell{IIP} |
10821
693e22af08ae
Grammarcheck documentation of m-files
Rik <octave@nomad.inbox5.com>
parents:
10793
diff
changeset
|
228 ## |
9152
4c9aff0c9a61
print.m: Use Ghostscript rather than ImageMagick's 'convert'.
Ben Abbott <bpabbott@mac.com>
parents:
9107
diff
changeset
|
229 ## @item pcx24b |
4c9aff0c9a61
print.m: Use Ghostscript rather than ImageMagick's 'convert'.
Ben Abbott <bpabbott@mac.com>
parents:
9107
diff
changeset
|
230 ## 24-bit color PCX file format |
10821
693e22af08ae
Grammarcheck documentation of m-files
Rik <octave@nomad.inbox5.com>
parents:
10793
diff
changeset
|
231 ## |
9152
4c9aff0c9a61
print.m: Use Ghostscript rather than ImageMagick's 'convert'.
Ben Abbott <bpabbott@mac.com>
parents:
9107
diff
changeset
|
232 ## @item ppm |
4c9aff0c9a61
print.m: Use Ghostscript rather than ImageMagick's 'convert'.
Ben Abbott <bpabbott@mac.com>
parents:
9107
diff
changeset
|
233 ## Portable Pixel Map file format |
4c9aff0c9a61
print.m: Use Ghostscript rather than ImageMagick's 'convert'.
Ben Abbott <bpabbott@mac.com>
parents:
9107
diff
changeset
|
234 ## @end table |
4c9aff0c9a61
print.m: Use Ghostscript rather than ImageMagick's 'convert'.
Ben Abbott <bpabbott@mac.com>
parents:
9107
diff
changeset
|
235 ## |
17122
eaab03308c0b
doc: Rewrite docstrings for most plot functions.
Rik <rik@octave.org>
parents:
16933
diff
changeset
|
236 ## For a complete list, type @code{system ("gs -h")} to see what formats |
10854
d5a7db05d591
Add PS and PDF output for the fltk backend.
Ben Abbott <bpabbott@mac.com>
parents:
10841
diff
changeset
|
237 ## and devices are available. |
9152
4c9aff0c9a61
print.m: Use Ghostscript rather than ImageMagick's 'convert'.
Ben Abbott <bpabbott@mac.com>
parents:
9107
diff
changeset
|
238 ## |
20173
777f26aa8e3e
doc: Update more docstrings to have one sentence summary as first line.
Rik <rik@octave.org>
parents:
19990
diff
changeset
|
239 ## When Ghostscript output is sent to a printer the size is determined by |
777f26aa8e3e
doc: Update more docstrings to have one sentence summary as first line.
Rik <rik@octave.org>
parents:
19990
diff
changeset
|
240 ## the figure's @qcode{"papersize"} property. When the output is sent to a |
777f26aa8e3e
doc: Update more docstrings to have one sentence summary as first line.
Rik <rik@octave.org>
parents:
19990
diff
changeset
|
241 ## file the size is determined by the plot box defined by the figure's |
777f26aa8e3e
doc: Update more docstrings to have one sentence summary as first line.
Rik <rik@octave.org>
parents:
19990
diff
changeset
|
242 ## @qcode{"paperposition"} property. |
9152
4c9aff0c9a61
print.m: Use Ghostscript rather than ImageMagick's 'convert'.
Ben Abbott <bpabbott@mac.com>
parents:
9107
diff
changeset
|
243 ## |
16094
8899c785cc99
doc: Fix warnings associated with Texinfo 5.0 (bug #38392)
Rik <rik@octave.org>
parents:
15301
diff
changeset
|
244 ## @item -append |
17122
eaab03308c0b
doc: Rewrite docstrings for most plot functions.
Rik <rik@octave.org>
parents:
16933
diff
changeset
|
245 ## Append PostScript or PDF output to a pre-existing file of the same type. |
10423
dfc662a47b7a
print.m: Add '-append' option.
Ben Abbott <bpabbott@mac.com>
parents:
10422
diff
changeset
|
246 ## |
16094
8899c785cc99
doc: Fix warnings associated with Texinfo 5.0 (bug #38392)
Rik <rik@octave.org>
parents:
15301
diff
changeset
|
247 ## @item -r@var{NUM} |
20173
777f26aa8e3e
doc: Update more docstrings to have one sentence summary as first line.
Rik <rik@octave.org>
parents:
19990
diff
changeset
|
248 ## Resolution of bitmaps in pixels per inch. For both metafiles and SVG |
777f26aa8e3e
doc: Update more docstrings to have one sentence summary as first line.
Rik <rik@octave.org>
parents:
19990
diff
changeset
|
249 ## the default is the screen resolution; for other formats it is 150 dpi. To |
777f26aa8e3e
doc: Update more docstrings to have one sentence summary as first line.
Rik <rik@octave.org>
parents:
19990
diff
changeset
|
250 ## specify screen resolution, use @qcode{"-r0"}. |
8889
665b264b6a50
Compatible support of figure paper properties and resolution for the gnuplot backend.
Ben Abbott <bpabbott@mac.com>
parents:
8746
diff
changeset
|
251 ## |
17129
9d9fe4361870
print.m: Document that '-loose' is default option for eps.
Rik <rik@octave.org>
parents:
17122
diff
changeset
|
252 ## @item -loose |
9d9fe4361870
print.m: Document that '-loose' is default option for eps.
Rik <rik@octave.org>
parents:
17122
diff
changeset
|
253 ## @itemx -tight |
9d9fe4361870
print.m: Document that '-loose' is default option for eps.
Rik <rik@octave.org>
parents:
17122
diff
changeset
|
254 ## Force a tight or loose bounding box for eps files. The default is loose. |
11009 | 255 ## |
256 ## @item -@var{preview} | |
15301
3d05b55c91c7
doc: Clean up docstring for print.m.
Rik <rik@octave.org>
parents:
15214
diff
changeset
|
257 ## Add a preview to eps files. Supported formats are: |
11009 | 258 ## |
259 ## @table @code | |
260 ## @item -interchange | |
15301
3d05b55c91c7
doc: Clean up docstring for print.m.
Rik <rik@octave.org>
parents:
15214
diff
changeset
|
261 ## Provide an interchange preview. |
11009 | 262 ## |
19705
ef3cdadc2a08
doc: print.m: Fix typo metalfile -> metafile
Andreas Weber <andy.weber.aw@gmail.com>
parents:
19697
diff
changeset
|
263 ## @item -metafile |
15301
3d05b55c91c7
doc: Clean up docstring for print.m.
Rik <rik@octave.org>
parents:
15214
diff
changeset
|
264 ## Provide a metafile preview. |
11009 | 265 ## |
266 ## @item -pict | |
15301
3d05b55c91c7
doc: Clean up docstring for print.m.
Rik <rik@octave.org>
parents:
15214
diff
changeset
|
267 ## Provide pict preview. |
11009 | 268 ## |
269 ## @item -tiff | |
15301
3d05b55c91c7
doc: Clean up docstring for print.m.
Rik <rik@octave.org>
parents:
15214
diff
changeset
|
270 ## Provide a tiff preview. |
11009 | 271 ## @end table |
9157
fce7315c1eee
print.m: Fix typo, improvments to code, and allow for creation of tight bbox.
Ben Abbott <bpabbott@mac.com>
parents:
9152
diff
changeset
|
272 ## |
10841
1577accf2ed8
print.m: Update documentation string. Change to active voice.
Rik <octave@nomad.inbox5.com>
parents:
10834
diff
changeset
|
273 ## @item -S@var{xsize},@var{ysize} |
20173
777f26aa8e3e
doc: Update more docstrings to have one sentence summary as first line.
Rik <rik@octave.org>
parents:
19990
diff
changeset
|
274 ## Plot size in pixels for EMF, GIF, JPEG, PBM, PNG, and SVG@. |
777f26aa8e3e
doc: Update more docstrings to have one sentence summary as first line.
Rik <rik@octave.org>
parents:
19990
diff
changeset
|
275 ## For PS, EPS, PDF, and other vector formats the plot size is in points. |
777f26aa8e3e
doc: Update more docstrings to have one sentence summary as first line.
Rik <rik@octave.org>
parents:
19990
diff
changeset
|
276 ## This option is equivalent to changing the size of the plot box associated |
777f26aa8e3e
doc: Update more docstrings to have one sentence summary as first line.
Rik <rik@octave.org>
parents:
19990
diff
changeset
|
277 ## with the @qcode{"paperposition"} property. When using the command form of |
777f26aa8e3e
doc: Update more docstrings to have one sentence summary as first line.
Rik <rik@octave.org>
parents:
19990
diff
changeset
|
278 ## the print function you must quote the @var{xsize},@var{ysize} option. For |
777f26aa8e3e
doc: Update more docstrings to have one sentence summary as first line.
Rik <rik@octave.org>
parents:
19990
diff
changeset
|
279 ## example, by writing @w{"-S640,480"}. |
6965 | 280 ## |
17122
eaab03308c0b
doc: Rewrite docstrings for most plot functions.
Rik <rik@octave.org>
parents:
16933
diff
changeset
|
281 ## @item -F@var{fontname} |
5361 | 282 ## @itemx -F@var{fontname}:@var{size} |
283 ## @itemx -F:@var{size} | |
15301
3d05b55c91c7
doc: Clean up docstring for print.m.
Rik <rik@octave.org>
parents:
15214
diff
changeset
|
284 ## Use @var{fontname} and/or @var{fontsize} for all text. |
3d05b55c91c7
doc: Clean up docstring for print.m.
Rik <rik@octave.org>
parents:
15214
diff
changeset
|
285 ## @var{fontname} is ignored for some devices: dxf, fig, hpgl, etc. |
5361 | 286 ## @end table |
287 ## | |
288 ## The filename and options can be given in any order. | |
11107
811b51cdddce
print.m: Add examples to the docstring.
Ben Abbott <bpabbott@mac.com>
parents:
11014
diff
changeset
|
289 ## |
19026
d6f1f46e5b8f
Fix double '-P' in print command to printer (bug #41957).
Michael Godfrey <michaeldgodfrey@gmail.com>
parents:
17751
diff
changeset
|
290 ## Example: Print to a file using the pdf device. |
11107
811b51cdddce
print.m: Add examples to the docstring.
Ben Abbott <bpabbott@mac.com>
parents:
11014
diff
changeset
|
291 ## |
811b51cdddce
print.m: Add examples to the docstring.
Ben Abbott <bpabbott@mac.com>
parents:
11014
diff
changeset
|
292 ## @example |
11563
3c6e8aaa9555
Grammarcheck m-files before 3.4 release.
Rik <octave@nomad.inbox5.com>
parents:
11551
diff
changeset
|
293 ## @group |
14327
4d917a6a858b
doc: Use Octave coding conventions in @example blocks of docstrings.
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
294 ## figure (1); |
4d917a6a858b
doc: Use Octave coding conventions in @example blocks of docstrings.
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
295 ## clf (); |
4d917a6a858b
doc: Use Octave coding conventions in @example blocks of docstrings.
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
296 ## surf (peaks); |
19026
d6f1f46e5b8f
Fix double '-P' in print command to printer (bug #41957).
Michael Godfrey <michaeldgodfrey@gmail.com>
parents:
17751
diff
changeset
|
297 ## print figure1.pdf |
11563
3c6e8aaa9555
Grammarcheck m-files before 3.4 release.
Rik <octave@nomad.inbox5.com>
parents:
11551
diff
changeset
|
298 ## @end group |
11107
811b51cdddce
print.m: Add examples to the docstring.
Ben Abbott <bpabbott@mac.com>
parents:
11014
diff
changeset
|
299 ## @end example |
811b51cdddce
print.m: Add examples to the docstring.
Ben Abbott <bpabbott@mac.com>
parents:
11014
diff
changeset
|
300 ## |
19026
d6f1f46e5b8f
Fix double '-P' in print command to printer (bug #41957).
Michael Godfrey <michaeldgodfrey@gmail.com>
parents:
17751
diff
changeset
|
301 ## Example: Print to a file using jpg device. |
11107
811b51cdddce
print.m: Add examples to the docstring.
Ben Abbott <bpabbott@mac.com>
parents:
11014
diff
changeset
|
302 ## |
811b51cdddce
print.m: Add examples to the docstring.
Ben Abbott <bpabbott@mac.com>
parents:
11014
diff
changeset
|
303 ## @example |
11563
3c6e8aaa9555
Grammarcheck m-files before 3.4 release.
Rik <octave@nomad.inbox5.com>
parents:
11551
diff
changeset
|
304 ## @group |
14327
4d917a6a858b
doc: Use Octave coding conventions in @example blocks of docstrings.
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
305 ## clf (); |
4d917a6a858b
doc: Use Octave coding conventions in @example blocks of docstrings.
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
306 ## surf (peaks); |
19026
d6f1f46e5b8f
Fix double '-P' in print command to printer (bug #41957).
Michael Godfrey <michaeldgodfrey@gmail.com>
parents:
17751
diff
changeset
|
307 ## print -djpg figure2.jpg |
d6f1f46e5b8f
Fix double '-P' in print command to printer (bug #41957).
Michael Godfrey <michaeldgodfrey@gmail.com>
parents:
17751
diff
changeset
|
308 ## @end group |
d6f1f46e5b8f
Fix double '-P' in print command to printer (bug #41957).
Michael Godfrey <michaeldgodfrey@gmail.com>
parents:
17751
diff
changeset
|
309 ## @end example |
d6f1f46e5b8f
Fix double '-P' in print command to printer (bug #41957).
Michael Godfrey <michaeldgodfrey@gmail.com>
parents:
17751
diff
changeset
|
310 ## |
d6f1f46e5b8f
Fix double '-P' in print command to printer (bug #41957).
Michael Godfrey <michaeldgodfrey@gmail.com>
parents:
17751
diff
changeset
|
311 ## Example: Print to printer named PS_printer using ps format. |
d6f1f46e5b8f
Fix double '-P' in print command to printer (bug #41957).
Michael Godfrey <michaeldgodfrey@gmail.com>
parents:
17751
diff
changeset
|
312 ## |
d6f1f46e5b8f
Fix double '-P' in print command to printer (bug #41957).
Michael Godfrey <michaeldgodfrey@gmail.com>
parents:
17751
diff
changeset
|
313 ## @example |
d6f1f46e5b8f
Fix double '-P' in print command to printer (bug #41957).
Michael Godfrey <michaeldgodfrey@gmail.com>
parents:
17751
diff
changeset
|
314 ## @group |
d6f1f46e5b8f
Fix double '-P' in print command to printer (bug #41957).
Michael Godfrey <michaeldgodfrey@gmail.com>
parents:
17751
diff
changeset
|
315 ## clf (); |
d6f1f46e5b8f
Fix double '-P' in print command to printer (bug #41957).
Michael Godfrey <michaeldgodfrey@gmail.com>
parents:
17751
diff
changeset
|
316 ## surf (peaks); |
19593
446c46af4b42
strip trailing whitespace from most source files
John W. Eaton <jwe@octave.org>
parents:
19026
diff
changeset
|
317 ## print -dpswrite -PPS_printer |
11563
3c6e8aaa9555
Grammarcheck m-files before 3.4 release.
Rik <octave@nomad.inbox5.com>
parents:
11551
diff
changeset
|
318 ## @end group |
11107
811b51cdddce
print.m: Add examples to the docstring.
Ben Abbott <bpabbott@mac.com>
parents:
11014
diff
changeset
|
319 ## @end example |
811b51cdddce
print.m: Add examples to the docstring.
Ben Abbott <bpabbott@mac.com>
parents:
11014
diff
changeset
|
320 ## |
18580
13c80c3e9660
Add new functions hgsave and hgload (bug #39532).
Massimiliano Fasi <mogrob.sanit@gmail.com> and Rik <rik@octave.org>
parents:
17751
diff
changeset
|
321 ## @seealso{saveas, hgsave, orient, figure} |
5361 | 322 ## @end deftypefn |
323 | |
10834
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10821
diff
changeset
|
324 function print (varargin) |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10821
diff
changeset
|
325 |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10821
diff
changeset
|
326 opts = __print_parse_opts__ (varargin{:}); |
7550
bffb1e2ab732
print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents:
7543
diff
changeset
|
327 |
23118
46b914a213db
Workaround segfault when an error occurs while printing (bug #49779)
Avinoam Kalma <a.kalma@gmail.com>
parents:
23083
diff
changeset
|
328 folder = fileparts (opts.name); |
25787
3293cd2651fb
prefer 'isfolder' over 'exist (..., "dir")' in Octave functions
Mike Miller <mtmiller@octave.org>
parents:
25582
diff
changeset
|
329 if (! isempty (folder) && ! isfolder (folder)) |
23118
46b914a213db
Workaround segfault when an error occurs while printing (bug #49779)
Avinoam Kalma <a.kalma@gmail.com>
parents:
23083
diff
changeset
|
330 error ("print: directory %s does not exist", folder); |
46b914a213db
Workaround segfault when an error occurs while printing (bug #49779)
Avinoam Kalma <a.kalma@gmail.com>
parents:
23083
diff
changeset
|
331 endif |
46b914a213db
Workaround segfault when an error occurs while printing (bug #49779)
Avinoam Kalma <a.kalma@gmail.com>
parents:
23083
diff
changeset
|
332 |
23189
0c9195baea1a
print.m: fix regression with -append option (bug #50318)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23139
diff
changeset
|
333 ## Check the requested file is writable |
0c9195baea1a
print.m: fix regression with -append option (bug #50318)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23139
diff
changeset
|
334 do_unlink = (exist (opts.name, "file") != 2); |
0c9195baea1a
print.m: fix regression with -append option (bug #50318)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23139
diff
changeset
|
335 fid = fopen (opts.name, "a"); |
23118
46b914a213db
Workaround segfault when an error occurs while printing (bug #49779)
Avinoam Kalma <a.kalma@gmail.com>
parents:
23083
diff
changeset
|
336 if (fid == -1) |
46b914a213db
Workaround segfault when an error occurs while printing (bug #49779)
Avinoam Kalma <a.kalma@gmail.com>
parents:
23083
diff
changeset
|
337 error ("print: cannot open file %s for writing", opts.name); |
46b914a213db
Workaround segfault when an error occurs while printing (bug #49779)
Avinoam Kalma <a.kalma@gmail.com>
parents:
23083
diff
changeset
|
338 endif |
46b914a213db
Workaround segfault when an error occurs while printing (bug #49779)
Avinoam Kalma <a.kalma@gmail.com>
parents:
23083
diff
changeset
|
339 fclose (fid); |
23189
0c9195baea1a
print.m: fix regression with -append option (bug #50318)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23139
diff
changeset
|
340 if (do_unlink) |
0c9195baea1a
print.m: fix regression with -append option (bug #50318)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23139
diff
changeset
|
341 unlink (opts.name); |
0c9195baea1a
print.m: fix regression with -append option (bug #50318)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23139
diff
changeset
|
342 endif |
23139
900ae902aa90
maint: strip trailing whitespace from source files.
John W. Eaton <jwe@octave.org>
parents:
23118
diff
changeset
|
343 |
11009 | 344 opts.pstoedit_cmd = @pstoedit; |
345 opts.fig2dev_cmd = @fig2dev; | |
346 opts.latex_standalone = @latex_standalone; | |
347 opts.lpr_cmd = @lpr; | |
348 opts.epstool_cmd = @epstool; | |
349 | |
19026
d6f1f46e5b8f
Fix double '-P' in print command to printer (bug #41957).
Michael Godfrey <michaeldgodfrey@gmail.com>
parents:
17751
diff
changeset
|
350 if (isempty (opts.figure) || ! isfigure (opts.figure)) |
11589
b0084095098e
missing semicolons in script files
John W. Eaton <jwe@octave.org>
parents:
11587
diff
changeset
|
351 error ("print: no figure to print"); |
10834
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10821
diff
changeset
|
352 endif |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10821
diff
changeset
|
353 |
22099
4c0f78b3c86f
print.m: Fix typo "1" (char) to 1 (integer) as argument to findall -depth (bug #48478).
Rik <rik@octave.org>
parents:
21859
diff
changeset
|
354 if (isempty (findall (opts.figure, "-depth", 1, "type", "axes"))) |
19990
9a2d8b1f931e
Issue error when trying to print a figure with no axes object (bug #44655).
Rik <rik@octave.org>
parents:
19833
diff
changeset
|
355 error ("print: no axes object in figure to print"); |
9a2d8b1f931e
Issue error when trying to print a figure with no axes object (bug #44655).
Rik <rik@octave.org>
parents:
19833
diff
changeset
|
356 endif |
9a2d8b1f931e
Issue error when trying to print a figure with no axes object (bug #44655).
Rik <rik@octave.org>
parents:
19833
diff
changeset
|
357 |
10834
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10821
diff
changeset
|
358 orig_figure = get (0, "currentfigure"); |
17146
bbda4d952eb5
Fix pop-up of invisible figures during printing.
Rik <rik@octave.org>
parents:
17129
diff
changeset
|
359 set (0, "currentfigure", opts.figure); |
10834
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10821
diff
changeset
|
360 |
11009 | 361 if (opts.append_to_file) |
362 [~, ~, ext] = fileparts (opts.ghostscript.output); | |
19278
6ca096827123
Use tempname() rather than tmpnam() in core Octave.
Rik <rik@octave.org>
parents:
19078
diff
changeset
|
363 opts.ghostscript.prepend = [tempname() ext]; |
11014
92bb25c0da9e
When appending, delete temporary files at the end of the ghostscript pipeline.
Ben Abbott <bpabbott@mac.com>
parents:
11009
diff
changeset
|
364 copyfile (opts.ghostscript.output, opts.ghostscript.prepend); |
10834
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10821
diff
changeset
|
365 endif |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10821
diff
changeset
|
366 |
10913
dd6b90f44ae5
Unify gnuplot printing with the fltk backend.
Ben Abbott <bpabbott@mac.com>
parents:
10866
diff
changeset
|
367 unwind_protect |
10834
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10821
diff
changeset
|
368 |
10913
dd6b90f44ae5
Unify gnuplot printing with the fltk backend.
Ben Abbott <bpabbott@mac.com>
parents:
10866
diff
changeset
|
369 ## Modify properties as specified by options |
24139
5d2d0e570e46
print.m: fake grid transparency with gray color (bug #49705)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23991
diff
changeset
|
370 tk = get (opts.figure, "__graphics_toolkit__"); |
10913
dd6b90f44ae5
Unify gnuplot printing with the fltk backend.
Ben Abbott <bpabbott@mac.com>
parents:
10866
diff
changeset
|
371 props = []; |
22783
219c70d2ba28
print.m: Don't change ui* objects units (bug #49600).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
22755
diff
changeset
|
372 nfig = 0; |
10834
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10821
diff
changeset
|
373 |
14355
a6a5c5008e39
Print() function requires figure units to be "pixels".
Ben Abbott <bpabbott@mac.com>
parents:
14335
diff
changeset
|
374 drawnow (); |
a6a5c5008e39
Print() function requires figure units to be "pixels".
Ben Abbott <bpabbott@mac.com>
parents:
14335
diff
changeset
|
375 |
20936
80dd7b3529ee
Convert figure's descendants units to "normalized" during printing (Bug #46292).
Ben Abbott <bpabbott@mac.com>
parents:
20852
diff
changeset
|
376 ## print() requires children of axes to have units = "normalized", or "data" |
80dd7b3529ee
Convert figure's descendants units to "normalized" during printing (Bug #46292).
Ben Abbott <bpabbott@mac.com>
parents:
20852
diff
changeset
|
377 hobj = findall (opts.figure, "-not", "type", "figure", ... |
22783
219c70d2ba28
print.m: Don't change ui* objects units (bug #49600).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
22755
diff
changeset
|
378 "-not", "type", "axes", "-property", "units", ... |
219c70d2ba28
print.m: Don't change ui* objects units (bug #49600).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
22755
diff
changeset
|
379 "-not", "units", "normalized", "-not", "units", "data"); |
22784
e58879c649b5
print.m: Fix incorrect optimization from cset 219c70d2ba28.
Rik <rik@octave.org>
parents:
22783
diff
changeset
|
380 hobj(strncmp (get (hobj, "type"), "ui", 2)) = []; |
20936
80dd7b3529ee
Convert figure's descendants units to "normalized" during printing (Bug #46292).
Ben Abbott <bpabbott@mac.com>
parents:
20852
diff
changeset
|
381 for n = 1:numel(hobj) |
80dd7b3529ee
Convert figure's descendants units to "normalized" during printing (Bug #46292).
Ben Abbott <bpabbott@mac.com>
parents:
20852
diff
changeset
|
382 props(n).h = hobj(n); |
80dd7b3529ee
Convert figure's descendants units to "normalized" during printing (Bug #46292).
Ben Abbott <bpabbott@mac.com>
parents:
20852
diff
changeset
|
383 props(n).name = "units"; |
80dd7b3529ee
Convert figure's descendants units to "normalized" during printing (Bug #46292).
Ben Abbott <bpabbott@mac.com>
parents:
20852
diff
changeset
|
384 props(n).value = {get(hobj(n), "units")}; |
21323
030d4d6c2b58
Implement figure property "InvertHardCopy" for printing (bug #47230).
Rik <rik@octave.org>
parents:
21122
diff
changeset
|
385 set (hobj(n), "units", "data"); |
22783
219c70d2ba28
print.m: Don't change ui* objects units (bug #49600).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
22755
diff
changeset
|
386 nfig += 1; |
20936
80dd7b3529ee
Convert figure's descendants units to "normalized" during printing (Bug #46292).
Ben Abbott <bpabbott@mac.com>
parents:
20852
diff
changeset
|
387 endfor |
80dd7b3529ee
Convert figure's descendants units to "normalized" during printing (Bug #46292).
Ben Abbott <bpabbott@mac.com>
parents:
20852
diff
changeset
|
388 |
25884
4e108574385c
Improve OpenGL rendering on high resolution screens with Qt 5 (bug #49053)
John Swensen <jpswensen@gmail.com>
parents:
25787
diff
changeset
|
389 ## Don't account for the actual pixel density |
4e108574385c
Improve OpenGL rendering on high resolution screens with Qt 5 (bug #49053)
John Swensen <jpswensen@gmail.com>
parents:
25787
diff
changeset
|
390 if (strcmp (tk, "qt")) |
4e108574385c
Improve OpenGL rendering on high resolution screens with Qt 5 (bug #49053)
John Swensen <jpswensen@gmail.com>
parents:
25787
diff
changeset
|
391 props(end+1).h = opts.figure; |
4e108574385c
Improve OpenGL rendering on high resolution screens with Qt 5 (bug #49053)
John Swensen <jpswensen@gmail.com>
parents:
25787
diff
changeset
|
392 props(end).name = "__device_pixel_ratio__"; |
4e108574385c
Improve OpenGL rendering on high resolution screens with Qt 5 (bug #49053)
John Swensen <jpswensen@gmail.com>
parents:
25787
diff
changeset
|
393 props(end).value = {get(opts.figure, "__device_pixel_ratio__")}; |
4e108574385c
Improve OpenGL rendering on high resolution screens with Qt 5 (bug #49053)
John Swensen <jpswensen@gmail.com>
parents:
25787
diff
changeset
|
394 set (opts.figure, "__device_pixel_ratio__", 1); |
4e108574385c
Improve OpenGL rendering on high resolution screens with Qt 5 (bug #49053)
John Swensen <jpswensen@gmail.com>
parents:
25787
diff
changeset
|
395 nfig += 1; |
4e108574385c
Improve OpenGL rendering on high resolution screens with Qt 5 (bug #49053)
John Swensen <jpswensen@gmail.com>
parents:
25787
diff
changeset
|
396 endif |
4e108574385c
Improve OpenGL rendering on high resolution screens with Qt 5 (bug #49053)
John Swensen <jpswensen@gmail.com>
parents:
25787
diff
changeset
|
397 |
20936
80dd7b3529ee
Convert figure's descendants units to "normalized" during printing (Bug #46292).
Ben Abbott <bpabbott@mac.com>
parents:
20852
diff
changeset
|
398 ## print() requires axes units = "normalized" |
80dd7b3529ee
Convert figure's descendants units to "normalized" during printing (Bug #46292).
Ben Abbott <bpabbott@mac.com>
parents:
20852
diff
changeset
|
399 hax = findall (opts.figure, "-depth", 1, "type", "axes", ... |
80dd7b3529ee
Convert figure's descendants units to "normalized" during printing (Bug #46292).
Ben Abbott <bpabbott@mac.com>
parents:
20852
diff
changeset
|
400 "-not", "units", "normalized"); |
24139
5d2d0e570e46
print.m: fake grid transparency with gray color (bug #49705)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23991
diff
changeset
|
401 for n = 1:numel (hax) |
22783
219c70d2ba28
print.m: Don't change ui* objects units (bug #49600).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
22755
diff
changeset
|
402 props(end+1).h = hax(n); |
219c70d2ba28
print.m: Don't change ui* objects units (bug #49600).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
22755
diff
changeset
|
403 props(end).name = "units"; |
219c70d2ba28
print.m: Don't change ui* objects units (bug #49600).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
22755
diff
changeset
|
404 props(end).value = {get(hax(n), "units")}; |
21323
030d4d6c2b58
Implement figure property "InvertHardCopy" for printing (bug #47230).
Rik <rik@octave.org>
parents:
21122
diff
changeset
|
405 set (hax(n), "units", "normalized"); |
22783
219c70d2ba28
print.m: Don't change ui* objects units (bug #49600).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
22755
diff
changeset
|
406 nfig += 1; |
20936
80dd7b3529ee
Convert figure's descendants units to "normalized" during printing (Bug #46292).
Ben Abbott <bpabbott@mac.com>
parents:
20852
diff
changeset
|
407 endfor |
80dd7b3529ee
Convert figure's descendants units to "normalized" during printing (Bug #46292).
Ben Abbott <bpabbott@mac.com>
parents:
20852
diff
changeset
|
408 |
24139
5d2d0e570e46
print.m: fake grid transparency with gray color (bug #49705)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23991
diff
changeset
|
409 ## FIXME: line transparency is only handled for svg output when |
5d2d0e570e46
print.m: fake grid transparency with gray color (bug #49705)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23991
diff
changeset
|
410 ## using gl2ps. For other formats, switch grid lines to light gray |
5d2d0e570e46
print.m: fake grid transparency with gray color (bug #49705)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23991
diff
changeset
|
411 ## so that the image output approximately matches on-screen experience. |
5d2d0e570e46
print.m: fake grid transparency with gray color (bug #49705)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23991
diff
changeset
|
412 hax = findall (opts.figure, "type", "axes"); |
5d2d0e570e46
print.m: fake grid transparency with gray color (bug #49705)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23991
diff
changeset
|
413 if (! strcmp (tk, "gnuplot") && ! strcmp (opts.devopt, "svg")) |
5d2d0e570e46
print.m: fake grid transparency with gray color (bug #49705)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23991
diff
changeset
|
414 for n = 1:numel (hax) |
5d2d0e570e46
print.m: fake grid transparency with gray color (bug #49705)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23991
diff
changeset
|
415 if (strcmp (get (hax(n), "gridcolormode"), "auto")) |
5d2d0e570e46
print.m: fake grid transparency with gray color (bug #49705)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23991
diff
changeset
|
416 props(end+1).h = hax(n); |
5d2d0e570e46
print.m: fake grid transparency with gray color (bug #49705)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23991
diff
changeset
|
417 props(end).name = "gridcolormode"; |
5d2d0e570e46
print.m: fake grid transparency with gray color (bug #49705)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23991
diff
changeset
|
418 props(end).value = {"auto"}; |
5d2d0e570e46
print.m: fake grid transparency with gray color (bug #49705)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23991
diff
changeset
|
419 props(end+1).h = hax(n); |
5d2d0e570e46
print.m: fake grid transparency with gray color (bug #49705)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23991
diff
changeset
|
420 props(end).name = "gridcolor"; |
5d2d0e570e46
print.m: fake grid transparency with gray color (bug #49705)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23991
diff
changeset
|
421 props(end).value = {get(hax(n), "gridcolor")}; |
5d2d0e570e46
print.m: fake grid transparency with gray color (bug #49705)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23991
diff
changeset
|
422 set (hax(n), "gridcolor", [0.85 0.85 0.85]); |
5d2d0e570e46
print.m: fake grid transparency with gray color (bug #49705)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23991
diff
changeset
|
423 nfig += 2; |
5d2d0e570e46
print.m: fake grid transparency with gray color (bug #49705)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23991
diff
changeset
|
424 endif |
5d2d0e570e46
print.m: fake grid transparency with gray color (bug #49705)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23991
diff
changeset
|
425 |
5d2d0e570e46
print.m: fake grid transparency with gray color (bug #49705)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23991
diff
changeset
|
426 if (strcmp (get (hax(n), "minorgridcolormode"), "auto")) |
5d2d0e570e46
print.m: fake grid transparency with gray color (bug #49705)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23991
diff
changeset
|
427 props(end+1).h = hax(n); |
5d2d0e570e46
print.m: fake grid transparency with gray color (bug #49705)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23991
diff
changeset
|
428 props(end).name = "minorgridcolormode"; |
5d2d0e570e46
print.m: fake grid transparency with gray color (bug #49705)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23991
diff
changeset
|
429 props(end).value = {"auto"}; |
5d2d0e570e46
print.m: fake grid transparency with gray color (bug #49705)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23991
diff
changeset
|
430 props(end+1).h = hax(n); |
5d2d0e570e46
print.m: fake grid transparency with gray color (bug #49705)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23991
diff
changeset
|
431 props(end).name = "minorgridcolor"; |
5d2d0e570e46
print.m: fake grid transparency with gray color (bug #49705)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23991
diff
changeset
|
432 props(end).value = {get(hax(n), "minorgridcolor")}; |
5d2d0e570e46
print.m: fake grid transparency with gray color (bug #49705)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23991
diff
changeset
|
433 set (hax(n), "minorgridcolor", [0.75 0.75 0.75]); |
5d2d0e570e46
print.m: fake grid transparency with gray color (bug #49705)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23991
diff
changeset
|
434 nfig += 2; |
5d2d0e570e46
print.m: fake grid transparency with gray color (bug #49705)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23991
diff
changeset
|
435 endif |
5d2d0e570e46
print.m: fake grid transparency with gray color (bug #49705)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23991
diff
changeset
|
436 endfor |
5d2d0e570e46
print.m: fake grid transparency with gray color (bug #49705)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23991
diff
changeset
|
437 endif |
24208
eec262017c6a
maint: Strip trailing whitespace from source files.
John W. Eaton <jwe@octave.org>
parents:
24207
diff
changeset
|
438 |
14355
a6a5c5008e39
Print() function requires figure units to be "pixels".
Ben Abbott <bpabbott@mac.com>
parents:
14335
diff
changeset
|
439 ## print() requires figure units to be "pixels" |
22783
219c70d2ba28
print.m: Don't change ui* objects units (bug #49600).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
22755
diff
changeset
|
440 props(end+1).h = opts.figure; |
219c70d2ba28
print.m: Don't change ui* objects units (bug #49600).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
22755
diff
changeset
|
441 props(end).name = "units"; |
219c70d2ba28
print.m: Don't change ui* objects units (bug #49600).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
22755
diff
changeset
|
442 props(end).value = {get(opts.figure, "units")}; |
14355
a6a5c5008e39
Print() function requires figure units to be "pixels".
Ben Abbott <bpabbott@mac.com>
parents:
14335
diff
changeset
|
443 set (opts.figure, "units", "pixels"); |
22783
219c70d2ba28
print.m: Don't change ui* objects units (bug #49600).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
22755
diff
changeset
|
444 nfig += 1; |
14355
a6a5c5008e39
Print() function requires figure units to be "pixels".
Ben Abbott <bpabbott@mac.com>
parents:
14335
diff
changeset
|
445 |
17742
4e225f952885
Fix shrinking axes when printing plots with legends (bug #40333).
Rik <rik@octave.org>
parents:
17723
diff
changeset
|
446 ## graphics toolkit translates figure position to eps bbox (points) |
10860
3a5f5c99cc39
print.m: Modify texinfo. Add unwind_protect block.
Ben Abbott <bpabbott@mac.com>
parents:
10854
diff
changeset
|
447 fpos = get (opts.figure, "position"); |
22783
219c70d2ba28
print.m: Don't change ui* objects units (bug #49600).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
22755
diff
changeset
|
448 props(end+1).h = opts.figure; |
24687
8b935067a257
Allow printing without updating qt visible or invisible figures (bug #52940).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
24609
diff
changeset
|
449 props(end).name = "__printing__"; |
8b935067a257
Allow printing without updating qt visible or invisible figures (bug #52940).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
24609
diff
changeset
|
450 props(end).value = {"off"}; |
8b935067a257
Allow printing without updating qt visible or invisible figures (bug #52940).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
24609
diff
changeset
|
451 props(end+1).h = opts.figure; |
22783
219c70d2ba28
print.m: Don't change ui* objects units (bug #49600).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
22755
diff
changeset
|
452 props(end).name = "position"; |
219c70d2ba28
print.m: Don't change ui* objects units (bug #49600).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
22755
diff
changeset
|
453 props(end).value = {fpos}; |
10860
3a5f5c99cc39
print.m: Modify texinfo. Add unwind_protect block.
Ben Abbott <bpabbott@mac.com>
parents:
10854
diff
changeset
|
454 fpos(3:4) = opts.canvas_size; |
24687
8b935067a257
Allow printing without updating qt visible or invisible figures (bug #52940).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
24609
diff
changeset
|
455 set (opts.figure, "__printing__", "on", "position", fpos); |
22783
219c70d2ba28
print.m: Don't change ui* objects units (bug #49600).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
22755
diff
changeset
|
456 nfig += 1; |
7550
bffb1e2ab732
print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents:
7543
diff
changeset
|
457 |
21323
030d4d6c2b58
Implement figure property "InvertHardCopy" for printing (bug #47230).
Rik <rik@octave.org>
parents:
21122
diff
changeset
|
458 ## Implement InvertHardCopy option |
030d4d6c2b58
Implement figure property "InvertHardCopy" for printing (bug #47230).
Rik <rik@octave.org>
parents:
21122
diff
changeset
|
459 do_hardcopy = strcmp (get (opts.figure, "inverthardcopy"), "on"); |
030d4d6c2b58
Implement figure property "InvertHardCopy" for printing (bug #47230).
Rik <rik@octave.org>
parents:
21122
diff
changeset
|
460 |
030d4d6c2b58
Implement figure property "InvertHardCopy" for printing (bug #47230).
Rik <rik@octave.org>
parents:
21122
diff
changeset
|
461 if (do_hardcopy) |
030d4d6c2b58
Implement figure property "InvertHardCopy" for printing (bug #47230).
Rik <rik@octave.org>
parents:
21122
diff
changeset
|
462 ## Set figure background to white. |
22783
219c70d2ba28
print.m: Don't change ui* objects units (bug #49600).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
22755
diff
changeset
|
463 props(end+1).h = opts.figure; |
219c70d2ba28
print.m: Don't change ui* objects units (bug #49600).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
22755
diff
changeset
|
464 props(end).name = "color"; |
219c70d2ba28
print.m: Don't change ui* objects units (bug #49600).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
22755
diff
changeset
|
465 props(end).value{1} = get (opts.figure, "color"); |
219c70d2ba28
print.m: Don't change ui* objects units (bug #49600).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
22755
diff
changeset
|
466 set (opts.figure, "color", "white"); |
219c70d2ba28
print.m: Don't change ui* objects units (bug #49600).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
22755
diff
changeset
|
467 nfig += 1; |
21323
030d4d6c2b58
Implement figure property "InvertHardCopy" for printing (bug #47230).
Rik <rik@octave.org>
parents:
21122
diff
changeset
|
468 endif |
030d4d6c2b58
Implement figure property "InvertHardCopy" for printing (bug #47230).
Rik <rik@octave.org>
parents:
21122
diff
changeset
|
469 |
030d4d6c2b58
Implement figure property "InvertHardCopy" for printing (bug #47230).
Rik <rik@octave.org>
parents:
21122
diff
changeset
|
470 if (do_hardcopy) |
030d4d6c2b58
Implement figure property "InvertHardCopy" for printing (bug #47230).
Rik <rik@octave.org>
parents:
21122
diff
changeset
|
471 ## Set background to white for all top-level axes objects |
030d4d6c2b58
Implement figure property "InvertHardCopy" for printing (bug #47230).
Rik <rik@octave.org>
parents:
21122
diff
changeset
|
472 hax = findall (opts.figure, "-depth", 1, "type", "axes", |
21859
ec3adcec1337
Fix "inverthardcopy" for transparent axes and plotyy (bug #48161).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
21759
diff
changeset
|
473 "-not", "tag", "legend", |
ec3adcec1337
Fix "inverthardcopy" for transparent axes and plotyy (bug #48161).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
21759
diff
changeset
|
474 "-not", "color", "none"); |
22578
956f5c71dc3c
Fix printing when axes has color "none" (bug #49243).
Rik <rik@octave.org>
parents:
22571
diff
changeset
|
475 if (! isempty (hax)) |
956f5c71dc3c
Fix printing when axes has color "none" (bug #49243).
Rik <rik@octave.org>
parents:
22571
diff
changeset
|
476 for n = 1:numel (hax) |
22783
219c70d2ba28
print.m: Don't change ui* objects units (bug #49600).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
22755
diff
changeset
|
477 props(end+1).h = hax(n); |
219c70d2ba28
print.m: Don't change ui* objects units (bug #49600).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
22755
diff
changeset
|
478 props(end).name = "color"; |
219c70d2ba28
print.m: Don't change ui* objects units (bug #49600).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
22755
diff
changeset
|
479 props(end).value{1} = get(hax(n), "color"); |
22578
956f5c71dc3c
Fix printing when axes has color "none" (bug #49243).
Rik <rik@octave.org>
parents:
22571
diff
changeset
|
480 set (hax(n), "color", "white"); |
22783
219c70d2ba28
print.m: Don't change ui* objects units (bug #49600).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
22755
diff
changeset
|
481 nfig += 1; |
22578
956f5c71dc3c
Fix printing when axes has color "none" (bug #49243).
Rik <rik@octave.org>
parents:
22571
diff
changeset
|
482 endfor |
956f5c71dc3c
Fix printing when axes has color "none" (bug #49243).
Rik <rik@octave.org>
parents:
22571
diff
changeset
|
483 endif |
21323
030d4d6c2b58
Implement figure property "InvertHardCopy" for printing (bug #47230).
Rik <rik@octave.org>
parents:
21122
diff
changeset
|
484 endif |
10913
dd6b90f44ae5
Unify gnuplot printing with the fltk backend.
Ben Abbott <bpabbott@mac.com>
parents:
10866
diff
changeset
|
485 |
10860
3a5f5c99cc39
print.m: Modify texinfo. Add unwind_protect block.
Ben Abbott <bpabbott@mac.com>
parents:
10854
diff
changeset
|
486 if (opts.force_solid != 0) |
10913
dd6b90f44ae5
Unify gnuplot printing with the fltk backend.
Ben Abbott <bpabbott@mac.com>
parents:
10866
diff
changeset
|
487 h = findall (opts.figure, "-property", "linestyle"); |
10834
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10821
diff
changeset
|
488 m = numel (props); |
14868
5d3a684236b0
maint: Use Octave coding conventions for cuddling parentheses in scripts directory
Rik <octave@nomad.inbox5.com>
parents:
14852
diff
changeset
|
489 for n = 1:numel (h) |
10834
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10821
diff
changeset
|
490 props(m+n).h = h(n); |
10860
3a5f5c99cc39
print.m: Modify texinfo. Add unwind_protect block.
Ben Abbott <bpabbott@mac.com>
parents:
10854
diff
changeset
|
491 props(m+n).name = "linestyle"; |
3a5f5c99cc39
print.m: Modify texinfo. Add unwind_protect block.
Ben Abbott <bpabbott@mac.com>
parents:
10854
diff
changeset
|
492 props(m+n).value = {get(h(n), "linestyle")}; |
10834
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10821
diff
changeset
|
493 endfor |
10860
3a5f5c99cc39
print.m: Modify texinfo. Add unwind_protect block.
Ben Abbott <bpabbott@mac.com>
parents:
10854
diff
changeset
|
494 if (opts.force_solid > 0) |
3a5f5c99cc39
print.m: Modify texinfo. Add unwind_protect block.
Ben Abbott <bpabbott@mac.com>
parents:
10854
diff
changeset
|
495 linestyle = "-"; |
3a5f5c99cc39
print.m: Modify texinfo. Add unwind_protect block.
Ben Abbott <bpabbott@mac.com>
parents:
10854
diff
changeset
|
496 else |
3a5f5c99cc39
print.m: Modify texinfo. Add unwind_protect block.
Ben Abbott <bpabbott@mac.com>
parents:
10854
diff
changeset
|
497 linestyle = "--"; |
3a5f5c99cc39
print.m: Modify texinfo. Add unwind_protect block.
Ben Abbott <bpabbott@mac.com>
parents:
10854
diff
changeset
|
498 endif |
11589
b0084095098e
missing semicolons in script files
John W. Eaton <jwe@octave.org>
parents:
11587
diff
changeset
|
499 set (h, "linestyle", linestyle); |
10860
3a5f5c99cc39
print.m: Modify texinfo. Add unwind_protect block.
Ben Abbott <bpabbott@mac.com>
parents:
10854
diff
changeset
|
500 endif |
10834
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10821
diff
changeset
|
501 |
21365
5b9618f4f841
Rely upon print.m for mono/color conversion. This simplifies gnuplot support
Ben Abbott <bpabbott@mac.com>
parents:
21323
diff
changeset
|
502 if (opts.use_color < 0) |
10866
045558999570
print.m: Include 'colormap' when converting RGB to mono.
Ben Abbott <bpabbott@mac.com>
parents:
10860
diff
changeset
|
503 color_props = {"color", "facecolor", "edgecolor", "colormap"}; |
14868
5d3a684236b0
maint: Use Octave coding conventions for cuddling parentheses in scripts directory
Rik <octave@nomad.inbox5.com>
parents:
14852
diff
changeset
|
504 for c = 1:numel (color_props) |
10913
dd6b90f44ae5
Unify gnuplot printing with the fltk backend.
Ben Abbott <bpabbott@mac.com>
parents:
10866
diff
changeset
|
505 h = findall (opts.figure, "-property", color_props{c}); |
dd6b90f44ae5
Unify gnuplot printing with the fltk backend.
Ben Abbott <bpabbott@mac.com>
parents:
10866
diff
changeset
|
506 hnone = findall (opts.figure, color_props{c}, "none"); |
10860
3a5f5c99cc39
print.m: Modify texinfo. Add unwind_protect block.
Ben Abbott <bpabbott@mac.com>
parents:
10854
diff
changeset
|
507 h = setdiff (h, hnone); |
3a5f5c99cc39
print.m: Modify texinfo. Add unwind_protect block.
Ben Abbott <bpabbott@mac.com>
parents:
10854
diff
changeset
|
508 m = numel (props); |
14868
5d3a684236b0
maint: Use Octave coding conventions for cuddling parentheses in scripts directory
Rik <octave@nomad.inbox5.com>
parents:
14852
diff
changeset
|
509 for n = 1:numel (h) |
24423
1d52db450db4
Change ishandle to return true for Java objects for Matlab compatibility.
Rik <rik@octave.org>
parents:
24370
diff
changeset
|
510 if (ishghandle (h(n))) |
11551
84fa2ba414ee
print.m: Fix printing to eps for DOS.
Ben Abbott <bpabbott@mac.com>
parents:
11523
diff
changeset
|
511 ## Need to verify objects exist since callbacks may delete objects |
84fa2ba414ee
print.m: Fix printing to eps for DOS.
Ben Abbott <bpabbott@mac.com>
parents:
11523
diff
changeset
|
512 ## as the colors for others are modified. |
84fa2ba414ee
print.m: Fix printing to eps for DOS.
Ben Abbott <bpabbott@mac.com>
parents:
11523
diff
changeset
|
513 rgb = get (h(n), color_props{c}); |
84fa2ba414ee
print.m: Fix printing to eps for DOS.
Ben Abbott <bpabbott@mac.com>
parents:
11523
diff
changeset
|
514 props(end+1).h = h(n); |
84fa2ba414ee
print.m: Fix printing to eps for DOS.
Ben Abbott <bpabbott@mac.com>
parents:
11523
diff
changeset
|
515 props(end).name = color_props{c}; |
84fa2ba414ee
print.m: Fix printing to eps for DOS.
Ben Abbott <bpabbott@mac.com>
parents:
11523
diff
changeset
|
516 props(end).value = {get(h(n), color_props{c})}; |
84fa2ba414ee
print.m: Fix printing to eps for DOS.
Ben Abbott <bpabbott@mac.com>
parents:
11523
diff
changeset
|
517 if (isnumeric (rgb)) |
84fa2ba414ee
print.m: Fix printing to eps for DOS.
Ben Abbott <bpabbott@mac.com>
parents:
11523
diff
changeset
|
518 ## convert RGB color to RGB gray scale |
14872
c2dbdeaa25df
maint: use rows() and columns() to clarify m-files.
Rik <octave@nomad.inbox5.com>
parents:
14868
diff
changeset
|
519 xfer = repmat ([0.30, 0.59, 0.11], rows (rgb), 1); |
11551
84fa2ba414ee
print.m: Fix printing to eps for DOS.
Ben Abbott <bpabbott@mac.com>
parents:
11523
diff
changeset
|
520 ggg = repmat (sum (xfer .* rgb, 2), 1, 3); |
11589
b0084095098e
missing semicolons in script files
John W. Eaton <jwe@octave.org>
parents:
11587
diff
changeset
|
521 set (h(n), color_props{c}, ggg); |
11551
84fa2ba414ee
print.m: Fix printing to eps for DOS.
Ben Abbott <bpabbott@mac.com>
parents:
11523
diff
changeset
|
522 endif |
10866
045558999570
print.m: Include 'colormap' when converting RGB to mono.
Ben Abbott <bpabbott@mac.com>
parents:
10860
diff
changeset
|
523 endif |
10860
3a5f5c99cc39
print.m: Modify texinfo. Add unwind_protect block.
Ben Abbott <bpabbott@mac.com>
parents:
10854
diff
changeset
|
524 endfor |
3a5f5c99cc39
print.m: Modify texinfo. Add unwind_protect block.
Ben Abbott <bpabbott@mac.com>
parents:
10854
diff
changeset
|
525 endfor |
3a5f5c99cc39
print.m: Modify texinfo. Add unwind_protect block.
Ben Abbott <bpabbott@mac.com>
parents:
10854
diff
changeset
|
526 endif |
3a5f5c99cc39
print.m: Modify texinfo. Add unwind_protect block.
Ben Abbott <bpabbott@mac.com>
parents:
10854
diff
changeset
|
527 |
3a5f5c99cc39
print.m: Modify texinfo. Add unwind_protect block.
Ben Abbott <bpabbott@mac.com>
parents:
10854
diff
changeset
|
528 if (! isempty (opts.font) || ! isempty (opts.fontsize)) |
10913
dd6b90f44ae5
Unify gnuplot printing with the fltk backend.
Ben Abbott <bpabbott@mac.com>
parents:
10866
diff
changeset
|
529 h = findall (opts.figure, "-property", "fontname"); |
10860
3a5f5c99cc39
print.m: Modify texinfo. Add unwind_protect block.
Ben Abbott <bpabbott@mac.com>
parents:
10854
diff
changeset
|
530 m = numel (props); |
14868
5d3a684236b0
maint: Use Octave coding conventions for cuddling parentheses in scripts directory
Rik <octave@nomad.inbox5.com>
parents:
14852
diff
changeset
|
531 for n = 1:numel (h) |
24423
1d52db450db4
Change ishandle to return true for Java objects for Matlab compatibility.
Rik <rik@octave.org>
parents:
24370
diff
changeset
|
532 if (ishghandle (h(n))) |
11551
84fa2ba414ee
print.m: Fix printing to eps for DOS.
Ben Abbott <bpabbott@mac.com>
parents:
11523
diff
changeset
|
533 if (! isempty (opts.font)) |
84fa2ba414ee
print.m: Fix printing to eps for DOS.
Ben Abbott <bpabbott@mac.com>
parents:
11523
diff
changeset
|
534 props(end+1).h = h(n); |
84fa2ba414ee
print.m: Fix printing to eps for DOS.
Ben Abbott <bpabbott@mac.com>
parents:
11523
diff
changeset
|
535 props(end).name = "fontname"; |
84fa2ba414ee
print.m: Fix printing to eps for DOS.
Ben Abbott <bpabbott@mac.com>
parents:
11523
diff
changeset
|
536 props(end).value = {get(h(n), "fontname")}; |
84fa2ba414ee
print.m: Fix printing to eps for DOS.
Ben Abbott <bpabbott@mac.com>
parents:
11523
diff
changeset
|
537 endif |
10860
3a5f5c99cc39
print.m: Modify texinfo. Add unwind_protect block.
Ben Abbott <bpabbott@mac.com>
parents:
10854
diff
changeset
|
538 endif |
24423
1d52db450db4
Change ishandle to return true for Java objects for Matlab compatibility.
Rik <rik@octave.org>
parents:
24370
diff
changeset
|
539 if (ishghandle (h(n))) |
11551
84fa2ba414ee
print.m: Fix printing to eps for DOS.
Ben Abbott <bpabbott@mac.com>
parents:
11523
diff
changeset
|
540 if (! isempty (opts.fontsize)) |
84fa2ba414ee
print.m: Fix printing to eps for DOS.
Ben Abbott <bpabbott@mac.com>
parents:
11523
diff
changeset
|
541 props(end+1).h = h(n); |
84fa2ba414ee
print.m: Fix printing to eps for DOS.
Ben Abbott <bpabbott@mac.com>
parents:
11523
diff
changeset
|
542 props(end).name = "fontsize"; |
84fa2ba414ee
print.m: Fix printing to eps for DOS.
Ben Abbott <bpabbott@mac.com>
parents:
11523
diff
changeset
|
543 props(end).value = {get(h(n), "fontsize")}; |
84fa2ba414ee
print.m: Fix printing to eps for DOS.
Ben Abbott <bpabbott@mac.com>
parents:
11523
diff
changeset
|
544 endif |
10860
3a5f5c99cc39
print.m: Modify texinfo. Add unwind_protect block.
Ben Abbott <bpabbott@mac.com>
parents:
10854
diff
changeset
|
545 endif |
3a5f5c99cc39
print.m: Modify texinfo. Add unwind_protect block.
Ben Abbott <bpabbott@mac.com>
parents:
10854
diff
changeset
|
546 endfor |
10834
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10821
diff
changeset
|
547 if (! isempty (opts.font)) |
24423
1d52db450db4
Change ishandle to return true for Java objects for Matlab compatibility.
Rik <rik@octave.org>
parents:
24370
diff
changeset
|
548 set (h(ishghandle (h)), "fontname", opts.font); |
10834
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10821
diff
changeset
|
549 endif |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10821
diff
changeset
|
550 if (! isempty (opts.fontsize)) |
10860
3a5f5c99cc39
print.m: Modify texinfo. Add unwind_protect block.
Ben Abbott <bpabbott@mac.com>
parents:
10854
diff
changeset
|
551 if (ischar (opts.fontsize)) |
3a5f5c99cc39
print.m: Modify texinfo. Add unwind_protect block.
Ben Abbott <bpabbott@mac.com>
parents:
10854
diff
changeset
|
552 fontsize = str2double (opts.fontsize); |
3a5f5c99cc39
print.m: Modify texinfo. Add unwind_protect block.
Ben Abbott <bpabbott@mac.com>
parents:
10854
diff
changeset
|
553 else |
3a5f5c99cc39
print.m: Modify texinfo. Add unwind_protect block.
Ben Abbott <bpabbott@mac.com>
parents:
10854
diff
changeset
|
554 fontsize = opts.fontsize; |
3a5f5c99cc39
print.m: Modify texinfo. Add unwind_protect block.
Ben Abbott <bpabbott@mac.com>
parents:
10854
diff
changeset
|
555 endif |
15214
ae6b7ee0a733
print.m: Correct typo preventing fontsize to be set (bug #37163)
Rik <rik@octave.org>
parents:
14872
diff
changeset
|
556 if (! isempty (opts.scalefontsize) && ! opts.scalefontsize != 1) |
14206
df695e37d404
Make sure "print '-SX,Y' ..." doesn't round down a pixel. Bug # 35307.
Ben Abbott <bpabbott@mac.com>
parents:
14138
diff
changeset
|
557 ## This is done to work around the bbox being whole numbers. |
20231
83792dd9bcc1
Use in-place operators in m-files where possible.
Rik <rik@octave.org>
parents:
20181
diff
changeset
|
558 fontsize *= opts.scalefontsize; |
14206
df695e37d404
Make sure "print '-SX,Y' ..." doesn't round down a pixel. Bug # 35307.
Ben Abbott <bpabbott@mac.com>
parents:
14138
diff
changeset
|
559 endif |
17723
132d9f543cc5
print.m: 2nd fix for printing when using -F option (bug #40334)
Rik <rik@octave.org>
parents:
17721
diff
changeset
|
560 ## FIXME: legend child objects need to be acted on first. |
132d9f543cc5
print.m: 2nd fix for printing when using -F option (bug #40334)
Rik <rik@octave.org>
parents:
17721
diff
changeset
|
561 ## or legend fontsize callback will destroy them. |
24423
1d52db450db4
Change ishandle to return true for Java objects for Matlab compatibility.
Rik <rik@octave.org>
parents:
24370
diff
changeset
|
562 hlist = h(ishghandle (h)); |
17723
132d9f543cc5
print.m: 2nd fix for printing when using -F option (bug #40334)
Rik <rik@octave.org>
parents:
17721
diff
changeset
|
563 haxes = strcmp (get (hlist, "type"), "axes"); |
132d9f543cc5
print.m: 2nd fix for printing when using -F option (bug #40334)
Rik <rik@octave.org>
parents:
17721
diff
changeset
|
564 set (hlist(! haxes), "fontsize", fontsize); |
132d9f543cc5
print.m: 2nd fix for printing when using -F option (bug #40334)
Rik <rik@octave.org>
parents:
17721
diff
changeset
|
565 set (hlist(haxes), "fontsize", fontsize); |
10834
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10821
diff
changeset
|
566 endif |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10821
diff
changeset
|
567 endif |
10860
3a5f5c99cc39
print.m: Modify texinfo. Add unwind_protect block.
Ben Abbott <bpabbott@mac.com>
parents:
10854
diff
changeset
|
568 |
19026
d6f1f46e5b8f
Fix double '-P' in print command to printer (bug #41957).
Michael Godfrey <michaeldgodfrey@gmail.com>
parents:
17751
diff
changeset
|
569 ## call the graphics toolkit print script |
24139
5d2d0e570e46
print.m: fake grid transparency with gray color (bug #49705)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23991
diff
changeset
|
570 switch (tk) |
17174
c3c1ebfaa7dc
maint: Use common indentation for switch statement.
Rik <rik@octave.org>
parents:
17146
diff
changeset
|
571 case "gnuplot" |
c3c1ebfaa7dc
maint: Use common indentation for switch statement.
Rik <rik@octave.org>
parents:
17146
diff
changeset
|
572 opts = __gnuplot_print__ (opts); |
c3c1ebfaa7dc
maint: Use common indentation for switch statement.
Rik <rik@octave.org>
parents:
17146
diff
changeset
|
573 otherwise |
19640
3b0b4d55002d
rename __fltk_print__.m to __opengl_print__.m
John W. Eaton <jwe@octave.org>
parents:
19596
diff
changeset
|
574 opts = __opengl_print__ (opts); |
11009 | 575 endswitch |
19706
18fd412c7dc3
Remove erroneously added "keyboard" in cset ef3cdadc2a08
Andreas Weber <andy.weber.aw@gmail.com>
parents:
19705
diff
changeset
|
576 |
10860
3a5f5c99cc39
print.m: Modify texinfo. Add unwind_protect block.
Ben Abbott <bpabbott@mac.com>
parents:
10854
diff
changeset
|
577 unwind_protect_cleanup |
3a5f5c99cc39
print.m: Modify texinfo. Add unwind_protect block.
Ben Abbott <bpabbott@mac.com>
parents:
10854
diff
changeset
|
578 ## restore modified properties |
3a5f5c99cc39
print.m: Modify texinfo. Add unwind_protect block.
Ben Abbott <bpabbott@mac.com>
parents:
10854
diff
changeset
|
579 if (isstruct (props)) |
17751
e2f83152e64a
print.m: Restore figure position first (in pixels) and then original units.
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
580 ## Restore figure position and units first |
20936
80dd7b3529ee
Convert figure's descendants units to "normalized" during printing (Bug #46292).
Ben Abbott <bpabbott@mac.com>
parents:
20852
diff
changeset
|
581 for n = nfig:-1:1 |
24423
1d52db450db4
Change ishandle to return true for Java objects for Matlab compatibility.
Rik <rik@octave.org>
parents:
24370
diff
changeset
|
582 if (ishghandle (props(n).h)) |
17751
e2f83152e64a
print.m: Restore figure position first (in pixels) and then original units.
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
583 set (props(n).h, props(n).name, props(n).value{1}); |
e2f83152e64a
print.m: Restore figure position first (in pixels) and then original units.
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
584 endif |
e2f83152e64a
print.m: Restore figure position first (in pixels) and then original units.
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
585 endfor |
20936
80dd7b3529ee
Convert figure's descendants units to "normalized" during printing (Bug #46292).
Ben Abbott <bpabbott@mac.com>
parents:
20852
diff
changeset
|
586 for n = numel (props):-1:(nfig + 1) |
24423
1d52db450db4
Change ishandle to return true for Java objects for Matlab compatibility.
Rik <rik@octave.org>
parents:
24370
diff
changeset
|
587 if (ishghandle (props(n).h)) |
11589
b0084095098e
missing semicolons in script files
John W. Eaton <jwe@octave.org>
parents:
11587
diff
changeset
|
588 set (props(n).h, props(n).name, props(n).value{1}); |
11551
84fa2ba414ee
print.m: Fix printing to eps for DOS.
Ben Abbott <bpabbott@mac.com>
parents:
11523
diff
changeset
|
589 endif |
10860
3a5f5c99cc39
print.m: Modify texinfo. Add unwind_protect block.
Ben Abbott <bpabbott@mac.com>
parents:
10854
diff
changeset
|
590 endfor |
3a5f5c99cc39
print.m: Modify texinfo. Add unwind_protect block.
Ben Abbott <bpabbott@mac.com>
parents:
10854
diff
changeset
|
591 endif |
10834
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10821
diff
changeset
|
592 |
10913
dd6b90f44ae5
Unify gnuplot printing with the fltk backend.
Ben Abbott <bpabbott@mac.com>
parents:
10866
diff
changeset
|
593 ## Unlink temporary files |
14868
5d3a684236b0
maint: Use Octave coding conventions for cuddling parentheses in scripts directory
Rik <octave@nomad.inbox5.com>
parents:
14852
diff
changeset
|
594 for n = 1:numel (opts.unlink) |
10913
dd6b90f44ae5
Unify gnuplot printing with the fltk backend.
Ben Abbott <bpabbott@mac.com>
parents:
10866
diff
changeset
|
595 [status, output] = unlink (opts.unlink{n}); |
dd6b90f44ae5
Unify gnuplot printing with the fltk backend.
Ben Abbott <bpabbott@mac.com>
parents:
10866
diff
changeset
|
596 if (status != 0) |
11589
b0084095098e
missing semicolons in script files
John W. Eaton <jwe@octave.org>
parents:
11587
diff
changeset
|
597 warning ("print.m: %s, '%s'", output, opts.unlink{n}); |
10913
dd6b90f44ae5
Unify gnuplot printing with the fltk backend.
Ben Abbott <bpabbott@mac.com>
parents:
10866
diff
changeset
|
598 endif |
dd6b90f44ae5
Unify gnuplot printing with the fltk backend.
Ben Abbott <bpabbott@mac.com>
parents:
10866
diff
changeset
|
599 endfor |
10860
3a5f5c99cc39
print.m: Modify texinfo. Add unwind_protect block.
Ben Abbott <bpabbott@mac.com>
parents:
10854
diff
changeset
|
600 end_unwind_protect |
10834
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10821
diff
changeset
|
601 |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10821
diff
changeset
|
602 if (isfigure (orig_figure)) |
17146
bbda4d952eb5
Fix pop-up of invisible figures during printing.
Rik <rik@octave.org>
parents:
17129
diff
changeset
|
603 set (0, "currentfigure", orig_figure); |
10834
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10821
diff
changeset
|
604 endif |
5363 | 605 |
5361 | 606 endfunction |
11009 | 607 |
608 function cmd = epstool (opts, filein, fileout) | |
609 ## As epstool does not work with pipes, a subshell is used to | |
21751
b571fc85953f
maint: Use two spaces after period to indicate sentence break.
Rik <rik@octave.org>
parents:
21578
diff
changeset
|
610 ## permit piping. Since this solution does not work with the DOS |
11009 | 611 ## command shell, the -tight and -preview options are disabled if |
612 ## output must be piped. | |
613 | |
614 ## DOS Shell: | |
11551
84fa2ba414ee
print.m: Fix printing to eps for DOS.
Ben Abbott <bpabbott@mac.com>
parents:
11523
diff
changeset
|
615 ## gs.exe [...] -sOutputFile=<filein> - & epstool -bbox -preview-tiff <filein> <fileout> & del <filein> |
11009 | 616 ## Unix Shell; |
617 ## cat > <filein> ; epstool -bbox -preview-tiff <filein> <fileout> ; rm <filein> | |
618 | |
19724
abc158e7122e
Use epswrite/eps2write depending on capabilities of ghostscript (bug #44186).
Rik <rik@octave.org>
parents:
19706
diff
changeset
|
619 ## HACK: Keep track of whether ghostscript supports epswrite or eps2write. |
abc158e7122e
Use epswrite/eps2write depending on capabilities of ghostscript (bug #44186).
Rik <rik@octave.org>
parents:
19706
diff
changeset
|
620 persistent epsdevice; |
abc158e7122e
Use epswrite/eps2write depending on capabilities of ghostscript (bug #44186).
Rik <rik@octave.org>
parents:
19706
diff
changeset
|
621 if (isempty (epsdevice)) |
abc158e7122e
Use epswrite/eps2write depending on capabilities of ghostscript (bug #44186).
Rik <rik@octave.org>
parents:
19706
diff
changeset
|
622 [status, devlist] = system (sprintf ("%s -h", opts.ghostscript.binary)); |
abc158e7122e
Use epswrite/eps2write depending on capabilities of ghostscript (bug #44186).
Rik <rik@octave.org>
parents:
19706
diff
changeset
|
623 if (isempty (strfind (devlist, "eps2write"))) |
abc158e7122e
Use epswrite/eps2write depending on capabilities of ghostscript (bug #44186).
Rik <rik@octave.org>
parents:
19706
diff
changeset
|
624 epsdevice = "epswrite"; |
abc158e7122e
Use epswrite/eps2write depending on capabilities of ghostscript (bug #44186).
Rik <rik@octave.org>
parents:
19706
diff
changeset
|
625 else |
abc158e7122e
Use epswrite/eps2write depending on capabilities of ghostscript (bug #44186).
Rik <rik@octave.org>
parents:
19706
diff
changeset
|
626 epsdevice = "eps2write"; |
abc158e7122e
Use epswrite/eps2write depending on capabilities of ghostscript (bug #44186).
Rik <rik@octave.org>
parents:
19706
diff
changeset
|
627 endif |
abc158e7122e
Use epswrite/eps2write depending on capabilities of ghostscript (bug #44186).
Rik <rik@octave.org>
parents:
19706
diff
changeset
|
628 endif |
19833
9fc020886ae9
maint: Clean up m-files to follow Octave coding conventions.
Rik <rik@octave.org>
parents:
19725
diff
changeset
|
629 |
11009 | 630 dos_shell = (ispc () && ! isunix ()); |
631 | |
632 cleanup = ""; | |
633 if (nargin < 3) | |
634 fileout = opts.name; | |
635 elseif (isempty (fileout)) | |
636 fileout = "-"; | |
637 endif | |
638 | |
639 if (nargin < 2 || strcmp (filein, "-") || isempty (filein)) | |
640 pipein = true; | |
19278
6ca096827123
Use tempname() rather than tmpnam() in core Octave.
Rik <rik@octave.org>
parents:
19078
diff
changeset
|
641 filein = [tempname() ".eps"]; |
11009 | 642 if (dos_shell) |
11252
d048ce3f7cef
Replace "delete" with "del" in DOS shell commands.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
11120
diff
changeset
|
643 cleanup = sprintf ("& del %s ", strrep (filein, '/', '\')); |
11009 | 644 else |
645 cleanup = sprintf ("; rm %s ", filein); | |
646 endif | |
647 else | |
648 pipein = false; | |
20778
8513c84a13cb
Use parser string concatenation rather than strcat() for performance in m-files.
Rik <rik@octave.org>
parents:
20713
diff
changeset
|
649 filein = ["'" strtrim(filein) "'"]; |
11009 | 650 endif |
651 if (strcmp (fileout, "-")) | |
652 pipeout = true; | |
19278
6ca096827123
Use tempname() rather than tmpnam() in core Octave.
Rik <rik@octave.org>
parents:
19078
diff
changeset
|
653 fileout = [tempname() ".eps"]; |
11009 | 654 if (dos_shell) |
19833
9fc020886ae9
maint: Clean up m-files to follow Octave coding conventions.
Rik <rik@octave.org>
parents:
19725
diff
changeset
|
655 cleanup = [cleanup, sprintf("& del %s ", strrep (fileout, '/', '\'))]; |
11009 | 656 else |
19833
9fc020886ae9
maint: Clean up m-files to follow Octave coding conventions.
Rik <rik@octave.org>
parents:
19725
diff
changeset
|
657 cleanup = [cleanup, sprintf("; rm %s ", fileout)]; |
11009 | 658 endif |
659 else | |
660 pipeout = false; | |
20778
8513c84a13cb
Use parser string concatenation rather than strcat() for performance in m-files.
Rik <rik@octave.org>
parents:
20713
diff
changeset
|
661 fileout = ["'" strtrim(fileout) "'"]; |
11009 | 662 endif |
663 | |
664 if (! isempty (opts.preview) && opts.tight_flag) | |
665 warning ("print:previewandtight", | |
11589
b0084095098e
missing semicolons in script files
John W. Eaton <jwe@octave.org>
parents:
11587
diff
changeset
|
666 "print.m: eps preview may not be combined with -tight"); |
11009 | 667 endif |
668 if (! isempty (opts.preview) || opts.tight_flag) | |
23991
fcf7543e0d49
Only print warning messages about missing print tools when needed (bug #44152).
Rik <rik@octave.org>
parents:
23486
diff
changeset
|
669 |
fcf7543e0d49
Only print warning messages about missing print tools when needed (bug #44152).
Rik <rik@octave.org>
parents:
23486
diff
changeset
|
670 if (isempty (opts.epstool_binary)) |
fcf7543e0d49
Only print warning messages about missing print tools when needed (bug #44152).
Rik <rik@octave.org>
parents:
23486
diff
changeset
|
671 error ("print:noepstool", "print.m: 'epstool' is required for specified output format, but binary is not available in PATH"); |
fcf7543e0d49
Only print warning messages about missing print tools when needed (bug #44152).
Rik <rik@octave.org>
parents:
23486
diff
changeset
|
672 endif |
fcf7543e0d49
Only print warning messages about missing print tools when needed (bug #44152).
Rik <rik@octave.org>
parents:
23486
diff
changeset
|
673 |
fcf7543e0d49
Only print warning messages about missing print tools when needed (bug #44152).
Rik <rik@octave.org>
parents:
23486
diff
changeset
|
674 if (opts.tight_flag) |
fcf7543e0d49
Only print warning messages about missing print tools when needed (bug #44152).
Rik <rik@octave.org>
parents:
23486
diff
changeset
|
675 cmd = "--copy --bbox"; |
fcf7543e0d49
Only print warning messages about missing print tools when needed (bug #44152).
Rik <rik@octave.org>
parents:
23486
diff
changeset
|
676 elseif (! isempty (opts.preview)) |
fcf7543e0d49
Only print warning messages about missing print tools when needed (bug #44152).
Rik <rik@octave.org>
parents:
23486
diff
changeset
|
677 switch (opts.preview) |
fcf7543e0d49
Only print warning messages about missing print tools when needed (bug #44152).
Rik <rik@octave.org>
parents:
23486
diff
changeset
|
678 case "tiff" |
fcf7543e0d49
Only print warning messages about missing print tools when needed (bug #44152).
Rik <rik@octave.org>
parents:
23486
diff
changeset
|
679 cmd = sprintf ("--add-%s-preview --device tiffg3", opts.preview); |
fcf7543e0d49
Only print warning messages about missing print tools when needed (bug #44152).
Rik <rik@octave.org>
parents:
23486
diff
changeset
|
680 case {"tiff6u", "tiff6p", "metafile"} |
fcf7543e0d49
Only print warning messages about missing print tools when needed (bug #44152).
Rik <rik@octave.org>
parents:
23486
diff
changeset
|
681 cmd = sprintf ("--add-%s-preview --device bmpgray", opts.preview); |
fcf7543e0d49
Only print warning messages about missing print tools when needed (bug #44152).
Rik <rik@octave.org>
parents:
23486
diff
changeset
|
682 case {"tiff4", "interchange"} |
fcf7543e0d49
Only print warning messages about missing print tools when needed (bug #44152).
Rik <rik@octave.org>
parents:
23486
diff
changeset
|
683 cmd = sprintf ("--add-%s-preview", opts.preview); |
fcf7543e0d49
Only print warning messages about missing print tools when needed (bug #44152).
Rik <rik@octave.org>
parents:
23486
diff
changeset
|
684 case "pict" |
fcf7543e0d49
Only print warning messages about missing print tools when needed (bug #44152).
Rik <rik@octave.org>
parents:
23486
diff
changeset
|
685 cmd = sprintf ("--add-%s-preview --mac-single", opts.preview); |
fcf7543e0d49
Only print warning messages about missing print tools when needed (bug #44152).
Rik <rik@octave.org>
parents:
23486
diff
changeset
|
686 otherwise |
fcf7543e0d49
Only print warning messages about missing print tools when needed (bug #44152).
Rik <rik@octave.org>
parents:
23486
diff
changeset
|
687 error ("print:invalidpreview", |
fcf7543e0d49
Only print warning messages about missing print tools when needed (bug #44152).
Rik <rik@octave.org>
parents:
23486
diff
changeset
|
688 "print.m: epstool cannot include preview for format '%s'", |
fcf7543e0d49
Only print warning messages about missing print tools when needed (bug #44152).
Rik <rik@octave.org>
parents:
23486
diff
changeset
|
689 opts.preview); |
fcf7543e0d49
Only print warning messages about missing print tools when needed (bug #44152).
Rik <rik@octave.org>
parents:
23486
diff
changeset
|
690 endswitch |
fcf7543e0d49
Only print warning messages about missing print tools when needed (bug #44152).
Rik <rik@octave.org>
parents:
23486
diff
changeset
|
691 if (! isempty (opts.ghostscript.resolution)) |
fcf7543e0d49
Only print warning messages about missing print tools when needed (bug #44152).
Rik <rik@octave.org>
parents:
23486
diff
changeset
|
692 cmd = sprintf ("%s --dpi %d", cmd, fix (opts.ghostscript.resolution)); |
11009 | 693 endif |
23991
fcf7543e0d49
Only print warning messages about missing print tools when needed (bug #44152).
Rik <rik@octave.org>
parents:
23486
diff
changeset
|
694 else |
fcf7543e0d49
Only print warning messages about missing print tools when needed (bug #44152).
Rik <rik@octave.org>
parents:
23486
diff
changeset
|
695 cmd = ""; |
fcf7543e0d49
Only print warning messages about missing print tools when needed (bug #44152).
Rik <rik@octave.org>
parents:
23486
diff
changeset
|
696 endif |
fcf7543e0d49
Only print warning messages about missing print tools when needed (bug #44152).
Rik <rik@octave.org>
parents:
23486
diff
changeset
|
697 if (! isempty (cmd)) |
fcf7543e0d49
Only print warning messages about missing print tools when needed (bug #44152).
Rik <rik@octave.org>
parents:
23486
diff
changeset
|
698 cmd = sprintf ("%s --quiet %s %s %s ", opts.epstool_binary, |
fcf7543e0d49
Only print warning messages about missing print tools when needed (bug #44152).
Rik <rik@octave.org>
parents:
23486
diff
changeset
|
699 cmd, filein, fileout); |
fcf7543e0d49
Only print warning messages about missing print tools when needed (bug #44152).
Rik <rik@octave.org>
parents:
23486
diff
changeset
|
700 endif |
fcf7543e0d49
Only print warning messages about missing print tools when needed (bug #44152).
Rik <rik@octave.org>
parents:
23486
diff
changeset
|
701 if (pipein) |
fcf7543e0d49
Only print warning messages about missing print tools when needed (bug #44152).
Rik <rik@octave.org>
parents:
23486
diff
changeset
|
702 if (dos_shell) |
24370
b1d1229d9e83
maint: Use single quotes to simplify excessive backslash escapes in code.
Rik <rik@octave.org>
parents:
24208
diff
changeset
|
703 filein(filein=="'") = '"'; |
23991
fcf7543e0d49
Only print warning messages about missing print tools when needed (bug #44152).
Rik <rik@octave.org>
parents:
23486
diff
changeset
|
704 gs_cmd = __ghostscript__ ("binary", opts.ghostscript.binary, |
fcf7543e0d49
Only print warning messages about missing print tools when needed (bug #44152).
Rik <rik@octave.org>
parents:
23486
diff
changeset
|
705 "device", epsdevice, |
fcf7543e0d49
Only print warning messages about missing print tools when needed (bug #44152).
Rik <rik@octave.org>
parents:
23486
diff
changeset
|
706 "source", "-", |
fcf7543e0d49
Only print warning messages about missing print tools when needed (bug #44152).
Rik <rik@octave.org>
parents:
23486
diff
changeset
|
707 "output", filein); |
fcf7543e0d49
Only print warning messages about missing print tools when needed (bug #44152).
Rik <rik@octave.org>
parents:
23486
diff
changeset
|
708 cmd = sprintf ("%s %s & %s", gs_cmd, filein, cmd); |
fcf7543e0d49
Only print warning messages about missing print tools when needed (bug #44152).
Rik <rik@octave.org>
parents:
23486
diff
changeset
|
709 else |
fcf7543e0d49
Only print warning messages about missing print tools when needed (bug #44152).
Rik <rik@octave.org>
parents:
23486
diff
changeset
|
710 cmd = sprintf ("cat > %s ; %s", filein, cmd); |
11009 | 711 endif |
23991
fcf7543e0d49
Only print warning messages about missing print tools when needed (bug #44152).
Rik <rik@octave.org>
parents:
23486
diff
changeset
|
712 endif |
fcf7543e0d49
Only print warning messages about missing print tools when needed (bug #44152).
Rik <rik@octave.org>
parents:
23486
diff
changeset
|
713 if (pipeout) |
fcf7543e0d49
Only print warning messages about missing print tools when needed (bug #44152).
Rik <rik@octave.org>
parents:
23486
diff
changeset
|
714 if (dos_shell) |
fcf7543e0d49
Only print warning messages about missing print tools when needed (bug #44152).
Rik <rik@octave.org>
parents:
23486
diff
changeset
|
715 cmd = sprintf ("%s & type %s", cmd, fileout); |
fcf7543e0d49
Only print warning messages about missing print tools when needed (bug #44152).
Rik <rik@octave.org>
parents:
23486
diff
changeset
|
716 else |
fcf7543e0d49
Only print warning messages about missing print tools when needed (bug #44152).
Rik <rik@octave.org>
parents:
23486
diff
changeset
|
717 cmd = sprintf ("%s ; cat %s", cmd, fileout); |
11009 | 718 endif |
23991
fcf7543e0d49
Only print warning messages about missing print tools when needed (bug #44152).
Rik <rik@octave.org>
parents:
23486
diff
changeset
|
719 endif |
fcf7543e0d49
Only print warning messages about missing print tools when needed (bug #44152).
Rik <rik@octave.org>
parents:
23486
diff
changeset
|
720 if (! isempty (cleanup)) |
fcf7543e0d49
Only print warning messages about missing print tools when needed (bug #44152).
Rik <rik@octave.org>
parents:
23486
diff
changeset
|
721 if (pipeout && dos_shell) |
fcf7543e0d49
Only print warning messages about missing print tools when needed (bug #44152).
Rik <rik@octave.org>
parents:
23486
diff
changeset
|
722 error ("print:epstoolpipe", |
fcf7543e0d49
Only print warning messages about missing print tools when needed (bug #44152).
Rik <rik@octave.org>
parents:
23486
diff
changeset
|
723 "print.m: cannot pipe output of 'epstool' for DOS shell"); |
fcf7543e0d49
Only print warning messages about missing print tools when needed (bug #44152).
Rik <rik@octave.org>
parents:
23486
diff
changeset
|
724 elseif (pipeout) |
fcf7543e0d49
Only print warning messages about missing print tools when needed (bug #44152).
Rik <rik@octave.org>
parents:
23486
diff
changeset
|
725 cmd = sprintf ("( %s %s )", cmd, cleanup); |
fcf7543e0d49
Only print warning messages about missing print tools when needed (bug #44152).
Rik <rik@octave.org>
parents:
23486
diff
changeset
|
726 else |
fcf7543e0d49
Only print warning messages about missing print tools when needed (bug #44152).
Rik <rik@octave.org>
parents:
23486
diff
changeset
|
727 cmd = sprintf ("%s %s", cmd, cleanup); |
11009 | 728 endif |
729 endif | |
730 else | |
731 if (pipein && pipeout) | |
732 if (dos_shell) | |
11551
84fa2ba414ee
print.m: Fix printing to eps for DOS.
Ben Abbott <bpabbott@mac.com>
parents:
11523
diff
changeset
|
733 cmd = __ghostscript__ ("binary", opts.ghostscript.binary, |
19724
abc158e7122e
Use epswrite/eps2write depending on capabilities of ghostscript (bug #44186).
Rik <rik@octave.org>
parents:
19706
diff
changeset
|
734 "device", epsdevice, |
11551
84fa2ba414ee
print.m: Fix printing to eps for DOS.
Ben Abbott <bpabbott@mac.com>
parents:
11523
diff
changeset
|
735 "source", "-", |
84fa2ba414ee
print.m: Fix printing to eps for DOS.
Ben Abbott <bpabbott@mac.com>
parents:
11523
diff
changeset
|
736 "output", "-"); |
11009 | 737 else |
738 cmd = " cat "; | |
739 endif | |
740 elseif (pipein && ! pipeout) | |
741 if (dos_shell) | |
11551
84fa2ba414ee
print.m: Fix printing to eps for DOS.
Ben Abbott <bpabbott@mac.com>
parents:
11523
diff
changeset
|
742 ## ghostscript expects double, not single, quotes |
24370
b1d1229d9e83
maint: Use single quotes to simplify excessive backslash escapes in code.
Rik <rik@octave.org>
parents:
24208
diff
changeset
|
743 fileout(fileout=="'") = '"'; |
11551
84fa2ba414ee
print.m: Fix printing to eps for DOS.
Ben Abbott <bpabbott@mac.com>
parents:
11523
diff
changeset
|
744 cmd = __ghostscript__ ("binary", opts.ghostscript.binary, |
19724
abc158e7122e
Use epswrite/eps2write depending on capabilities of ghostscript (bug #44186).
Rik <rik@octave.org>
parents:
19706
diff
changeset
|
745 "device", epsdevice, |
11551
84fa2ba414ee
print.m: Fix printing to eps for DOS.
Ben Abbott <bpabbott@mac.com>
parents:
11523
diff
changeset
|
746 "source", "-", |
84fa2ba414ee
print.m: Fix printing to eps for DOS.
Ben Abbott <bpabbott@mac.com>
parents:
11523
diff
changeset
|
747 "output", fileout); |
11009 | 748 else |
749 cmd = sprintf (" cat > %s ", fileout); | |
750 endif | |
751 elseif (! pipein && pipeout) | |
752 if (dos_shell) | |
753 cmd = sprintf (" type %s ", filein); | |
754 else | |
755 cmd = sprintf (" cat %s ", filein); | |
756 endif | |
757 else | |
758 if (dos_shell) | |
759 cmd = sprintf (" copy %s %s ", filein, fileout); | |
760 else | |
761 cmd = sprintf (" cp %s %s ", filein, fileout); | |
762 endif | |
763 endif | |
764 endif | |
765 if (opts.debug) | |
11589
b0084095098e
missing semicolons in script files
John W. Eaton <jwe@octave.org>
parents:
11587
diff
changeset
|
766 fprintf ("epstool command: '%s'\n", cmd); |
11009 | 767 endif |
21758
ffad2baa90f7
maint: Use newlines to make code more readable.
Rik <rik@octave.org>
parents:
21751
diff
changeset
|
768 |
11009 | 769 endfunction |
770 | |
771 function cmd = fig2dev (opts, devopt) | |
21758
ffad2baa90f7
maint: Use newlines to make code more readable.
Rik <rik@octave.org>
parents:
21751
diff
changeset
|
772 |
11009 | 773 if (nargin < 2) |
19833
9fc020886ae9
maint: Clean up m-files to follow Octave coding conventions.
Rik <rik@octave.org>
parents:
19725
diff
changeset
|
774 devopt = opts.devopt; |
11009 | 775 endif |
21758
ffad2baa90f7
maint: Use newlines to make code more readable.
Rik <rik@octave.org>
parents:
21751
diff
changeset
|
776 |
23991
fcf7543e0d49
Only print warning messages about missing print tools when needed (bug #44152).
Rik <rik@octave.org>
parents:
23486
diff
changeset
|
777 if (isempty (opts.fig2dev_binary)) |
fcf7543e0d49
Only print warning messages about missing print tools when needed (bug #44152).
Rik <rik@octave.org>
parents:
23486
diff
changeset
|
778 error ("print:nofig2dev", "print.m: 'fig2dev' is required for specified output format, but binary is not available in PATH"); |
fcf7543e0d49
Only print warning messages about missing print tools when needed (bug #44152).
Rik <rik@octave.org>
parents:
23486
diff
changeset
|
779 endif |
fcf7543e0d49
Only print warning messages about missing print tools when needed (bug #44152).
Rik <rik@octave.org>
parents:
23486
diff
changeset
|
780 |
11009 | 781 dos_shell = (ispc () && ! isunix ()); |
23991
fcf7543e0d49
Only print warning messages about missing print tools when needed (bug #44152).
Rik <rik@octave.org>
parents:
23486
diff
changeset
|
782 if (dos_shell) |
fcf7543e0d49
Only print warning messages about missing print tools when needed (bug #44152).
Rik <rik@octave.org>
parents:
23486
diff
changeset
|
783 ## FIXME: Is this the right thing to do for DOS? |
fcf7543e0d49
Only print warning messages about missing print tools when needed (bug #44152).
Rik <rik@octave.org>
parents:
23486
diff
changeset
|
784 cmd = sprintf ("%s -L %s 2> NUL", opts.fig2dev_binary, devopt); |
fcf7543e0d49
Only print warning messages about missing print tools when needed (bug #44152).
Rik <rik@octave.org>
parents:
23486
diff
changeset
|
785 else |
fcf7543e0d49
Only print warning messages about missing print tools when needed (bug #44152).
Rik <rik@octave.org>
parents:
23486
diff
changeset
|
786 cmd = sprintf ("%s -L %s 2> /dev/null", opts.fig2dev_binary, devopt); |
11009 | 787 endif |
23991
fcf7543e0d49
Only print warning messages about missing print tools when needed (bug #44152).
Rik <rik@octave.org>
parents:
23486
diff
changeset
|
788 |
11009 | 789 if (opts.debug) |
11589
b0084095098e
missing semicolons in script files
John W. Eaton <jwe@octave.org>
parents:
11587
diff
changeset
|
790 fprintf ("fig2dev command: '%s'\n", cmd); |
11009 | 791 endif |
21758
ffad2baa90f7
maint: Use newlines to make code more readable.
Rik <rik@octave.org>
parents:
21751
diff
changeset
|
792 |
11009 | 793 endfunction |
794 | |
12199
3fc07861449b
Fix {eps,ps,pdf}latexstandalone printing for fltk, bug 32262.
Ben Abbott <bpabbott@mac.com>
parents:
11589
diff
changeset
|
795 function latex_standalone (opts) |
21758
ffad2baa90f7
maint: Use newlines to make code more readable.
Rik <rik@octave.org>
parents:
21751
diff
changeset
|
796 |
12199
3fc07861449b
Fix {eps,ps,pdf}latexstandalone printing for fltk, bug 32262.
Ben Abbott <bpabbott@mac.com>
parents:
11589
diff
changeset
|
797 n = find (opts.name == ".", 1, "last"); |
3fc07861449b
Fix {eps,ps,pdf}latexstandalone printing for fltk, bug 32262.
Ben Abbott <bpabbott@mac.com>
parents:
11589
diff
changeset
|
798 if (! isempty (n)) |
3fc07861449b
Fix {eps,ps,pdf}latexstandalone printing for fltk, bug 32262.
Ben Abbott <bpabbott@mac.com>
parents:
11589
diff
changeset
|
799 opts.name = opts.name(1:n-1); |
3fc07861449b
Fix {eps,ps,pdf}latexstandalone printing for fltk, bug 32262.
Ben Abbott <bpabbott@mac.com>
parents:
11589
diff
changeset
|
800 endif |
20778
8513c84a13cb
Use parser string concatenation rather than strcat() for performance in m-files.
Rik <rik@octave.org>
parents:
20713
diff
changeset
|
801 latexfile = [opts.name ".tex"]; |
21758
ffad2baa90f7
maint: Use newlines to make code more readable.
Rik <rik@octave.org>
parents:
21751
diff
changeset
|
802 |
16933
e39f00a32dc7
maint: Use parentheses around condition for switch(),while(),if() statements.
Rik <rik@octave.org>
parents:
16826
diff
changeset
|
803 switch (opts.devopt) |
17174
c3c1ebfaa7dc
maint: Use common indentation for switch statement.
Rik <rik@octave.org>
parents:
17146
diff
changeset
|
804 case {"pdflatexstandalone"} |
c3c1ebfaa7dc
maint: Use common indentation for switch statement.
Rik <rik@octave.org>
parents:
17146
diff
changeset
|
805 packages = "\\usepackage{graphicx,color}"; |
20778
8513c84a13cb
Use parser string concatenation rather than strcat() for performance in m-files.
Rik <rik@octave.org>
parents:
20713
diff
changeset
|
806 graphicsfile = [opts.name "-inc.pdf"]; |
17174
c3c1ebfaa7dc
maint: Use common indentation for switch statement.
Rik <rik@octave.org>
parents:
17146
diff
changeset
|
807 case {"pslatexstandalone"} |
c3c1ebfaa7dc
maint: Use common indentation for switch statement.
Rik <rik@octave.org>
parents:
17146
diff
changeset
|
808 packages = "\\usepackage{epsfig,color}"; |
20778
8513c84a13cb
Use parser string concatenation rather than strcat() for performance in m-files.
Rik <rik@octave.org>
parents:
20713
diff
changeset
|
809 graphicsfile = [opts.name "-inc.ps"]; |
17174
c3c1ebfaa7dc
maint: Use common indentation for switch statement.
Rik <rik@octave.org>
parents:
17146
diff
changeset
|
810 otherwise |
c3c1ebfaa7dc
maint: Use common indentation for switch statement.
Rik <rik@octave.org>
parents:
17146
diff
changeset
|
811 packages = "\\usepackage{epsfig,color}"; |
20778
8513c84a13cb
Use parser string concatenation rather than strcat() for performance in m-files.
Rik <rik@octave.org>
parents:
20713
diff
changeset
|
812 graphicsfile = [opts.name "-inc.eps"]; |
12199
3fc07861449b
Fix {eps,ps,pdf}latexstandalone printing for fltk, bug 32262.
Ben Abbott <bpabbott@mac.com>
parents:
11589
diff
changeset
|
813 endswitch |
21758
ffad2baa90f7
maint: Use newlines to make code more readable.
Rik <rik@octave.org>
parents:
21751
diff
changeset
|
814 |
12199
3fc07861449b
Fix {eps,ps,pdf}latexstandalone printing for fltk, bug 32262.
Ben Abbott <bpabbott@mac.com>
parents:
11589
diff
changeset
|
815 papersize = sprintf ("\\usepackage[papersize={%.2fbp,%.2fbp},text={%.2fbp,%.2fbp}]{geometry}", |
19725
5f2c0ca0ef51
Ensure that numbers passed to integer *printf format codes are integers (bug #44245).
Rik <rik@octave.org>
parents:
19724
diff
changeset
|
816 fix (opts.canvas_size), fix (opts.canvas_size)); |
11009 | 817 prepend = {"\\documentclass{minimal}"; |
12199
3fc07861449b
Fix {eps,ps,pdf}latexstandalone printing for fltk, bug 32262.
Ben Abbott <bpabbott@mac.com>
parents:
11589
diff
changeset
|
818 packages; |
3fc07861449b
Fix {eps,ps,pdf}latexstandalone printing for fltk, bug 32262.
Ben Abbott <bpabbott@mac.com>
parents:
11589
diff
changeset
|
819 papersize; |
11009 | 820 "\\begin{document}"; |
821 "\\centering"}; | |
822 postpend = {"\\end{document}"}; | |
21758
ffad2baa90f7
maint: Use newlines to make code more readable.
Rik <rik@octave.org>
parents:
21751
diff
changeset
|
823 |
11009 | 824 fid = fopen (latexfile, "r"); |
21759
b002b4331a12
maint: Use two newlines after endfunction and start of BIST tests.
Rik <rik@octave.org>
parents:
21758
diff
changeset
|
825 if (fid < 0) |
11009 | 826 error ("print:erroropeningfile", |
11589
b0084095098e
missing semicolons in script files
John W. Eaton <jwe@octave.org>
parents:
11587
diff
changeset
|
827 "print.m: error opening file '%s'", latexfile); |
11009 | 828 endif |
21759
b002b4331a12
maint: Use two newlines after endfunction and start of BIST tests.
Rik <rik@octave.org>
parents:
21758
diff
changeset
|
829 latex = fscanf (fid, "%c", Inf); |
b002b4331a12
maint: Use two newlines after endfunction and start of BIST tests.
Rik <rik@octave.org>
parents:
21758
diff
changeset
|
830 status = fclose (fid); |
b002b4331a12
maint: Use two newlines after endfunction and start of BIST tests.
Rik <rik@octave.org>
parents:
21758
diff
changeset
|
831 if (status != 0) |
b002b4331a12
maint: Use two newlines after endfunction and start of BIST tests.
Rik <rik@octave.org>
parents:
21758
diff
changeset
|
832 error ("print:errorclosingfile", |
b002b4331a12
maint: Use two newlines after endfunction and start of BIST tests.
Rik <rik@octave.org>
parents:
21758
diff
changeset
|
833 "print.m: error closing file '%s'", latexfile); |
b002b4331a12
maint: Use two newlines after endfunction and start of BIST tests.
Rik <rik@octave.org>
parents:
21758
diff
changeset
|
834 endif |
b002b4331a12
maint: Use two newlines after endfunction and start of BIST tests.
Rik <rik@octave.org>
parents:
21758
diff
changeset
|
835 ## FIXME: should this be fixed in GL2PS? |
b002b4331a12
maint: Use two newlines after endfunction and start of BIST tests.
Rik <rik@octave.org>
parents:
21758
diff
changeset
|
836 latex = strrep (latex, "\\includegraphics{}", |
b002b4331a12
maint: Use two newlines after endfunction and start of BIST tests.
Rik <rik@octave.org>
parents:
21758
diff
changeset
|
837 sprintf ("\\includegraphics{%s}", graphicsfile)); |
21758
ffad2baa90f7
maint: Use newlines to make code more readable.
Rik <rik@octave.org>
parents:
21751
diff
changeset
|
838 |
11009 | 839 fid = fopen (latexfile, "w"); |
840 if (fid >= 0) | |
841 fprintf (fid, "%s\n", prepend{:}); | |
842 fprintf (fid, "%s", latex); | |
843 fprintf (fid, "%s\n", postpend{:}); | |
844 status = fclose (fid); | |
845 if (status != 0) | |
846 error ("print:errorclosingfile", | |
11589
b0084095098e
missing semicolons in script files
John W. Eaton <jwe@octave.org>
parents:
11587
diff
changeset
|
847 "print.m: error closing file '%s'", latexfile); |
11009 | 848 endif |
849 else | |
850 error ("print:erroropeningfile", | |
11589
b0084095098e
missing semicolons in script files
John W. Eaton <jwe@octave.org>
parents:
11587
diff
changeset
|
851 "print.m: error opening file '%s'", latexfile); |
11009 | 852 endif |
21758
ffad2baa90f7
maint: Use newlines to make code more readable.
Rik <rik@octave.org>
parents:
21751
diff
changeset
|
853 |
11009 | 854 endfunction |
855 | |
856 function cmd = lpr (opts) | |
21758
ffad2baa90f7
maint: Use newlines to make code more readable.
Rik <rik@octave.org>
parents:
21751
diff
changeset
|
857 |
11009 | 858 if (nargin < 2) |
19833
9fc020886ae9
maint: Clean up m-files to follow Octave coding conventions.
Rik <rik@octave.org>
parents:
19725
diff
changeset
|
859 devopt = opts.devopt; |
11009 | 860 endif |
21758
ffad2baa90f7
maint: Use newlines to make code more readable.
Rik <rik@octave.org>
parents:
21751
diff
changeset
|
861 |
11009 | 862 if (! isempty (opts.lpr_binary)) |
863 cmd = opts.lpr_binary; | |
864 if (! isempty (opts.lpr_options)) | |
865 cmd = sprintf ("%s %s", cmd, opts.lpr_options); | |
11113
a8ac114ec9ab
Stylefixes, replace end by endif.
Thorsten Meyer <thorsten.meyier@gmx.de>
parents:
11107
diff
changeset
|
866 endif |
11009 | 867 if (! isempty (opts.printer)) |
19026
d6f1f46e5b8f
Fix double '-P' in print command to printer (bug #41957).
Michael Godfrey <michaeldgodfrey@gmail.com>
parents:
17751
diff
changeset
|
868 cmd = sprintf ("%s %s", cmd, opts.printer); |
11113
a8ac114ec9ab
Stylefixes, replace end by endif.
Thorsten Meyer <thorsten.meyier@gmx.de>
parents:
11107
diff
changeset
|
869 endif |
11009 | 870 elseif (isempty (opts.lpr_binary)) |
11589
b0084095098e
missing semicolons in script files
John W. Eaton <jwe@octave.org>
parents:
11587
diff
changeset
|
871 error ("print:nolpr", "print.m: 'lpr' not found in PATH"); |
11009 | 872 endif |
873 if (opts.debug) | |
11589
b0084095098e
missing semicolons in script files
John W. Eaton <jwe@octave.org>
parents:
11587
diff
changeset
|
874 fprintf ("lpr command: '%s'\n", cmd); |
11009 | 875 endif |
21758
ffad2baa90f7
maint: Use newlines to make code more readable.
Rik <rik@octave.org>
parents:
21751
diff
changeset
|
876 |
11009 | 877 endfunction |
878 | |
879 function cmd = pstoedit (opts, devopt) | |
21758
ffad2baa90f7
maint: Use newlines to make code more readable.
Rik <rik@octave.org>
parents:
21751
diff
changeset
|
880 |
11009 | 881 if (nargin < 2) |
19833
9fc020886ae9
maint: Clean up m-files to follow Octave coding conventions.
Rik <rik@octave.org>
parents:
19725
diff
changeset
|
882 devopt = opts.devopt; |
11009 | 883 endif |
21758
ffad2baa90f7
maint: Use newlines to make code more readable.
Rik <rik@octave.org>
parents:
21751
diff
changeset
|
884 |
23991
fcf7543e0d49
Only print warning messages about missing print tools when needed (bug #44152).
Rik <rik@octave.org>
parents:
23486
diff
changeset
|
885 if (isempty (opts.pstoedit_binary)) |
fcf7543e0d49
Only print warning messages about missing print tools when needed (bug #44152).
Rik <rik@octave.org>
parents:
23486
diff
changeset
|
886 error ("print:nopstoedit", "print.m: 'pstoedit' is required for specified output format, but binary is not available in PATH"); |
fcf7543e0d49
Only print warning messages about missing print tools when needed (bug #44152).
Rik <rik@octave.org>
parents:
23486
diff
changeset
|
887 endif |
fcf7543e0d49
Only print warning messages about missing print tools when needed (bug #44152).
Rik <rik@octave.org>
parents:
23486
diff
changeset
|
888 |
11009 | 889 dos_shell = (ispc () && ! isunix ()); |
23991
fcf7543e0d49
Only print warning messages about missing print tools when needed (bug #44152).
Rik <rik@octave.org>
parents:
23486
diff
changeset
|
890 if (dos_shell) |
fcf7543e0d49
Only print warning messages about missing print tools when needed (bug #44152).
Rik <rik@octave.org>
parents:
23486
diff
changeset
|
891 cmd = sprintf ("%s -f %s 2> NUL", opts.pstoedit_binary, devopt); |
fcf7543e0d49
Only print warning messages about missing print tools when needed (bug #44152).
Rik <rik@octave.org>
parents:
23486
diff
changeset
|
892 else |
fcf7543e0d49
Only print warning messages about missing print tools when needed (bug #44152).
Rik <rik@octave.org>
parents:
23486
diff
changeset
|
893 ## FIXME: Is this the right thing to do for DOS? |
fcf7543e0d49
Only print warning messages about missing print tools when needed (bug #44152).
Rik <rik@octave.org>
parents:
23486
diff
changeset
|
894 cmd = sprintf ("%s -f %s 2> /dev/null", opts.pstoedit_binary, devopt); |
11009 | 895 endif |
23991
fcf7543e0d49
Only print warning messages about missing print tools when needed (bug #44152).
Rik <rik@octave.org>
parents:
23486
diff
changeset
|
896 |
11009 | 897 if (opts.debug) |
11589
b0084095098e
missing semicolons in script files
John W. Eaton <jwe@octave.org>
parents:
11587
diff
changeset
|
898 fprintf ("pstoedit command: '%s'\n", cmd); |
11009 | 899 endif |
21758
ffad2baa90f7
maint: Use newlines to make code more readable.
Rik <rik@octave.org>
parents:
21751
diff
changeset
|
900 |
11009 | 901 endfunction |