# HG changeset patch # User John Hunt # Date 1339809228 14400 # Node ID 0d6dae0f6bc22556c4b73751fc70b959a71a8aea # Parent 5c269b73f467849e451d32e1d64d8c0641e18212 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. diff --git a/scripts/plot/print.m b/scripts/plot/print.m --- 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 diff --git a/scripts/plot/private/__ghostscript__.m b/scripts/plot/private/__ghostscript__.m --- 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); diff --git a/scripts/plot/private/__print_parse_opts__.m b/scripts/plot/private/__print_parse_opts__.m --- 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))