Mercurial > hg > octave-lyh
changeset 14774:0d6dae0f6bc2
Allow setting of ghostscript TextAlphaBits and GraphicsAlphaBits.
* scripts/plot/private/__print_parse_opts__.m: Add AlphaBits options for
ghostscript.
* scripts/plot/private/__ghostscript__.m: Include AlphaBits options.
* doc/interpreter/contributors.in: Add John Hunt.
author | John Hunt <huntj@gmx.us> |
---|---|
date | Fri, 15 Jun 2012 21:13:48 -0400 |
parents | 5c269b73f467 |
children | 4e86b0fa6c2d |
files | scripts/plot/print.m scripts/plot/private/__ghostscript__.m scripts/plot/private/__print_parse_opts__.m |
diffstat | 3 files changed, 32 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/scripts/plot/print.m +++ b/scripts/plot/print.m @@ -74,8 +74,18 @@ ## orientation specified. This options is equivalent to changing ## the figure's "paperorientation" property. ## +## @item -TextAlphaBits=@var{n} +## @itemx -GraphicsAlphaBits=@var{n} +## Octave is able to produce output for various printers, bitmaps, and +## vector formats by using ghostscript. +## For bitmap and printer output antialiasing is applied using +## ghostscript's TextAlphaBits and GraphicsAlphaBits options. +## The default number of bits for each is 4. +## Allowed values, for @var{N}, are 1, 2, or 4. +## ## @item -d@var{device} -## Output device, where @var{device} is one of: +## The available output format is specified by the option @var{device}, +## and is one of: ## ## @table @code ## @item ps
--- a/scripts/plot/private/__ghostscript__.m +++ b/scripts/plot/private/__ghostscript__.m @@ -32,6 +32,8 @@ opts.device = ""; opts.epscrop = false; opts.antialiasing = false; + opts.antialiasing_textalphabits = 4;, + opts.antialiasing_graphicsalphabits = 4; opts.resolution = 150; opts.papersize = ""; opts.pageoffset = [0 0]; @@ -70,7 +72,9 @@ if (opts.antialiasing && isempty (strfind (opts.device, "write"))) ## Apply anti-aliasing to all bitmap formats/devices - gs_opts = sprintf ("%s -dTextAlphaBits=4 -dGraphicsAlphaBits=4", gs_opts); + gs_opts = sprintf ("%s -dTextAlphaBits=%d -dGraphicsAlphaBits=%d", + gs_opts, opts.antialiasing_textalphabits, + opts.antialiasing_graphicsalphabits); gs_opts = sprintf ("%s -r%dx%d", gs_opts, [1, 1] * opts.resolution); elseif (any (strcmp (opts.device, {"pswrite", "ps2write", "pdfwrite"}))) gs_opts = sprintf ("%s -dEmbedAllFonts=true", gs_opts);
--- a/scripts/plot/private/__print_parse_opts__.m +++ b/scripts/plot/private/__print_parse_opts__.m @@ -49,6 +49,8 @@ arg_st.ghostscript.pageoffset = []; arg_st.ghostscript.resolution = 150; arg_st.ghostscript.antialiasing = false; + arg_st.ghostscript.antialiasing_textalphabits = 4; + arg_st.ghostscript.antialiasing_graphicsalphabits = 4; arg_st.loose = false; arg_st.lpr_binary = __quote_path__ (__find_binary__ ("lpr")); arg_st.name = ""; @@ -118,6 +120,20 @@ arg_st.fig2dev_binary = arg{10:end}; elseif (strncmp (arg, "-PSTOEDIT:", 9)) arg_st.pstoedit_binary = arg{10:end}; + elseif (strncmpi (arg, "-textalphabits=", 15)) + n = find (arg == "="); + if (! isempty (n) && n == numel (arg) - 1 && ismember (arg(end), "124")) + arg_st.ghostscript.antialiasing_textalphabits = str2num (arg(end)); + else + error ("print: improper syntax, or value, for TextAlphaBits") + endif + elseif (strncmpi (arg, "-graphicsalphabits=", 19)) + n = find (arg == "="); + if (! isempty (n) && n == numel (arg) - 1 && ismember (arg(end), "124")) + arg_st.ghostscript.antialiasing_graphicsalphabits = str2num (arg(end)); + else + error ("print: improper syntax, or value, for GraphicsAlphaBits") + endif elseif ((length (arg) > 2) && arg(1:2) == "-G") arg_st.ghostscript.binary = file_in_path (getenv ("PATH"), arg(3:end)); if (isempty (arg_st.ghostscript.binary))