octave-maintainers
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Treat TeX in plot text in a Matlab compatible matter with gnuplot enhanc


From: David Bateman
Subject: Treat TeX in plot text in a Matlab compatible matter with gnuplot enhanced mode
Date: Fri, 16 Nov 2007 23:42:20 +0100
User-agent: Thunderbird 1.5.0.7 (X11/20060921)

Matlab supports three different renderings modes for text, labels and
title, determined by the "interpreter" property of the text objects.
These three modes are "tex", "latex" and "none". The "tex" mode allows a
selection of standard TeX commands to be passed in the strings and is
described on the page

http://www.mathworks.com/access/helpdesk/help/techdoc/ref/text_props.html#String

The "latex" mode passes the text through a full LaTeX compiler to render
the text, and "none" obviously renders the raw text. Its not easy to
implement the "latex" mode with gnuplot, but there is a direct mapping
between most of the TeX commands supported by matlab and the gnuplot
enhanced modes.

The attached patch adds the ability to treat embedded TeX commands in
text, labels and titles of plots in a near matlab compatible manner. The
only things not implemented are the \bf, \it, \rm, \sl and \color
commands as I see no way to implement these in the gnuplot enhanced
mode. The rest of the functionality on the page above for the matlab
"tex" is added with this patch.

Note that as far as I can see the supported terminals with gnuplot 4.2
are {"aqua", "dumb", "png", "jpeg", "gif", "pm", "windows", "wxt",
"svg", "pstex", "pslatex", "epslatex", "postscript", "x11"} and with
gnuplot 4.0 they are only {"pstex", "pslatex", "epslatex",
"postscript"}. The "x11" terminal in gnuplot 4.0 accepts the enhanced
option, but seems to have too many rendering bugs to make it useful. For
the terminal types that don't support enhanced mode, the interpreter
property is ignored.

I tested the patch with the example from mathworks page for plot. That is

y = sin(x);
plot(x,y)
set(gca,'XTick',-pi:pi/2:pi)
set(gca,'XTickLabel',{'-pi','-pi/2','0','pi/2','pi'})
xlabel('-\pi \leq \Theta \leq \pi')
ylabel('sin(\Theta)')
title('Plot of sin(\Theta)')
text(-pi/4,sin(-pi/4),'\leftarrow sin(-\pi\div4)',...
     'HorizontalAlignment','left')
set(findobj(gca,'Type','line','Color',[0 0 1]),...
    'Color','red',...
    'LineWidth',2)

and gnuplot 4.2.2 and the rendering was perfect on the terminals I tried.

D.
*** ./scripts/plot/drawnow.m.orig12     2007-11-16 21:54:30.884138910 +0100
--- ./scripts/plot/drawnow.m    2007-11-16 22:24:51.993560378 +0100
***************
*** 45,56 ****
        plot_stream = [];
        fid = [];
        unwind_protect
!         plot_stream = open_gnuplot_stream ([], term, file);
!         __go_draw_figure__ (f, plot_stream);
          if (nargin == 3)
            fid = fopen (debug_file, "wb");
!           init_plot_stream (fid, [], term, file);
!           __go_draw_figure__ (f, fid);
          endif
        unwind_protect_cleanup
          if (! isempty (plot_stream))
--- 45,56 ----
        plot_stream = [];
        fid = [];
        unwind_protect
!         [plot_stream, enhanced] = open_gnuplot_stream ([], term, file);
!         __go_draw_figure__ (f, plot_stream, enhanced);        
          if (nargin == 3)
            fid = fopen (debug_file, "wb");
!           enhanced = init_plot_stream (fid, [], term, file);
!           __go_draw_figure__ (f, fid, enhanced);
          endif
        unwind_protect_cleanup
          if (! isempty (plot_stream))
***************
*** 72,83 ****
            figure_is_visible = strcmp (f.visible, "on");
            if (figure_is_visible)
              if (isempty (plot_stream))
!               plot_stream = open_gnuplot_stream (h);
              endif
!             __go_draw_figure__ (f, plot_stream);
            elseif (! isempty (plot_stream))
              pclose (plot_stream);
              set (h, "__plot_stream__", []);
            endif
            set (h, "__modified__", false);
          endif
--- 72,87 ----
            figure_is_visible = strcmp (f.visible, "on");
            if (figure_is_visible)
              if (isempty (plot_stream))
!               [plot_stream, enhanced] = open_gnuplot_stream (h);
!               set (h, "__enhanced__", enhanced);
!             else
!               enhanced = f.__enhanced__;
              endif
!             __go_draw_figure__ (f, plot_stream, enhanced);
            elseif (! isempty (plot_stream))
              pclose (plot_stream);
              set (h, "__plot_stream__", []);
+             set (h, "__enhanced__", false);
            endif
            set (h, "__modified__", false);
          endif
***************
*** 96,102 ****
  
  endfunction
  
! function plot_stream = open_gnuplot_stream (h, varargin)
  
    ## If drawnow is cleared, it is possible to register __go_close_all__
    ## more than once, but that is not fatal.
--- 100,106 ----
  
  endfunction
  
! function [plot_stream, enhanced] = open_gnuplot_stream (h, varargin)
  
    ## If drawnow is cleared, it is possible to register __go_close_all__
    ## more than once, but that is not fatal.
***************
*** 114,120 ****
        set (h, "__plot_stream__", plot_stream);
      endif
  
!     init_plot_stream (plot_stream, h, varargin{:})
  
      if (isempty (__go_close_all_registered__))
        atexit ("__go_close_all__");
--- 118,124 ----
        set (h, "__plot_stream__", plot_stream);
      endif
  
!     enhanced = init_plot_stream (plot_stream, h, varargin{:});
  
      if (isempty (__go_close_all_registered__))
        atexit ("__go_close_all__");
***************
*** 125,135 ****
  
  endfunction
  
! function init_plot_stream (plot_stream, h, term, file)
  
    if (nargin == 4)
      if (! isempty (term))
!       fprintf (plot_stream, "set terminal %s;\n", term);
      endif
      if (! isempty (file))
        fprintf (plot_stream, "set output \"%s\";\n", file);
--- 129,144 ----
  
  endfunction
  
! function enhanced = init_plot_stream (plot_stream, h, term, file)
  
    if (nargin == 4)
+     enhanced = enhanced_term (term);
      if (! isempty (term))
!       if (enhanced)
!       fprintf (plot_stream, "set terminal %s enhanced;\n", term);
!       else
!       fprintf (plot_stream, "set terminal %s;\n", term);
!       endif
      endif
      if (! isempty (file))
        fprintf (plot_stream, "set output \"%s\";\n", file);
***************
*** 153,176 ****
        endif
      endif
  
      ## If no 'h' (why not?) then open the terminal as Figure 0.
      if (isempty (h))
        h = 0;
      endif
  
      if (strcmp (term, "x11"))
!       fprintf (plot_stream, "set terminal x11 title \"Figure %d\"\n", h);
      elseif (strcmp (term, "aqua"))
        ## Aqua doesn't understand the 'title' option despite what the
        ## gnuplot 4.2 documentation says.
!       fprintf (plot_stream, "set terminal aqua %d\n", h);
      elseif (strcmp (term, "wxt"))
!       fprintf (plot_stream, "set terminal wxt title \"Figure %d\"\n", h);
      endif
      ## gnuplot will pick up the GNUTERM environment variable itself
      ## so no need to set the terminal type if not also setting the
!     ## figure title.
  
    endif
  
  endfunction
--- 162,222 ----
        endif
      endif
  
+     enhanced = enhanced_term (term);
+     if (enhanced)
+       enh_str = "enhanced";
+     else
+       enh_str = "";
+     endif
+ 
      ## If no 'h' (why not?) then open the terminal as Figure 0.
      if (isempty (h))
        h = 0;
      endif
  
      if (strcmp (term, "x11"))
!       fprintf (plot_stream, "set terminal x11 %s title \"Figure %d\"\n",
!              enh_str, h);
      elseif (strcmp (term, "aqua"))
        ## Aqua doesn't understand the 'title' option despite what the
        ## gnuplot 4.2 documentation says.
!       fprintf (plot_stream, "set terminal aqua %d %s\n", h, enh_str);
      elseif (strcmp (term, "wxt"))
!       fprintf (plot_stream, "set terminal wxt %s title \"Figure %d\"\n", 
!              enh_str, h);
! 
!     elseif (enhanced)
!       fprintf (plot_stream "set terminal %s %s\n", term, enh_str);
      endif
      ## gnuplot will pick up the GNUTERM environment variable itself
      ## so no need to set the terminal type if not also setting the
!     ## figure title or enhanced mode.
! 
!   endif
! 
! endfunction
! 
! function have_enhanced = enhanced_term (term)
!   persistent enhanced_terminals;
  
+   if (isempty (enhanced_terminals))
+     if (compare_versions (__gnuplot_version__ (), "4.0", ">"))
+       enhanced_terminals = {"aqua", "dumb", "png", "jpeg", "gif", "pm", ...
+                           "windows", "wxt", "svg", "pstex", "pslatex", ...
+                           "epslatex", "postscript", "x11"};
+     else 
+       enhanced_terminals = {"pstex", "pslatex", "epslatex", "postscript"};
+     endif
    endif
  
+   term = tolower (term);
+ 
+   have_enhanced = false;
+   for i = 1 : length (enhanced_terminals)
+     t = enhanced_terminals{i};
+     if (strncmp (term, t, min (length (term), length(t))))
+       have_enhanced = true;
+       break;
+     endif
+   endfor
  endfunction
*** ./scripts/plot/__go_draw_figure__.m.orig12  2007-11-16 21:54:03.252558771 
+0100
--- ./scripts/plot/__go_draw_figure__.m 2007-11-16 21:57:43.661232972 +0100
***************
*** 20,28 ****
  
  ## Author: jwe
  
! function __go_draw_figure__ (f, plot_stream)
  
!   if (nargin == 2)
      if (strcmp (f.type, "figure"))
  
        ## Set figure properties here?
--- 20,28 ----
  
  ## Author: jwe
  
! function __go_draw_figure__ (f, plot_stream, enhanced)
  
!   if (nargin == 3)
      if (strcmp (f.type, "figure"))
  
        ## Set figure properties here?
***************
*** 52,58 ****
          obj = get (kids(i));
          switch (obj.type)
            case "axes"
!             __go_draw_axes__ (kids(i), plot_stream);
  
            otherwise
              error ("__go_draw_figure__: unknown object class, %s",
--- 52,58 ----
          obj = get (kids(i));
          switch (obj.type)
            case "axes"
!             __go_draw_axes__ (kids(i), plot_stream, enhanced);
  
            otherwise
              error ("__go_draw_figure__: unknown object class, %s",
*** ./scripts/plot/__go_draw_axes__.m.orig12    2007-11-16 17:14:38.903450043 
+0100
--- ./scripts/plot/__go_draw_axes__.m   2007-11-16 23:40:44.690617978 +0100
***************
*** 20,28 ****
  
  ## Author: jwe
  
! function __go_draw_axes__ (h, plot_stream)
  
!   if (nargin == 2)
  
      axis_obj = get (h);
  
--- 20,28 ----
  
  ## Author: jwe
  
! function __go_draw_axes__ (h, plot_stream, enhanced)
  
!   if (nargin == 3)
  
      axis_obj = get (h);
  
***************
*** 59,67 ****
        if (isempty (t.string))
        fputs (plot_stream, "unset title;\n");
        else
        [f, s] = get_fontname_and_size (t);
        fprintf (plot_stream, "set title \"%s\" font \"%s,%d\";\n",
!                undo_string_escapes (t.string), f, s);
        endif
      endif
  
--- 59,68 ----
        if (isempty (t.string))
        fputs (plot_stream, "unset title;\n");
        else
+       tt = __maybe_munge_text__ (enhanced, t);
        [f, s] = get_fontname_and_size (t);
        fprintf (plot_stream, "set title \"%s\" font \"%s,%d\";\n",
!                undo_string_escapes (tt), f, s);
        endif
      endif
  
***************
*** 71,79 ****
        if (isempty (t.string))
        fputs (plot_stream, "unset xlabel;\n");
        else
        [f, s] = get_fontname_and_size (t);
        fprintf (plot_stream, "set xlabel \"%s\" font \"%s,%d\"",
!                undo_string_escapes (t.string), f, s);
        if (have_newer_gnuplot)
          ## Rotation of xlabel not yet support by gnuplot as of 4.2, but
          ## there is no message about it.
--- 72,81 ----
        if (isempty (t.string))
        fputs (plot_stream, "unset xlabel;\n");
        else
+       tt = __maybe_munge_text__ (enhanced, t);
        [f, s] = get_fontname_and_size (t);
        fprintf (plot_stream, "set xlabel \"%s\" font \"%s,%d\"",
!                undo_string_escapes (tt), f, s);
        if (have_newer_gnuplot)
          ## Rotation of xlabel not yet support by gnuplot as of 4.2, but
          ## there is no message about it.
***************
*** 89,97 ****
        if (isempty (t.string))
        fputs (plot_stream, "unset ylabel;\n");
        else
        [f, s] = get_fontname_and_size (t);
        fprintf (plot_stream, "set ylabel \"%s\" font \"%s,%d\"",
!                undo_string_escapes (t.string), f, s);
        if (have_newer_gnuplot)
          fprintf (plot_stream, " rotate by %f;\n", angle);
        endif
--- 91,100 ----
        if (isempty (t.string))
        fputs (plot_stream, "unset ylabel;\n");
        else
+       tt = __maybe_munge_text__ (enhanced, t);
        [f, s] = get_fontname_and_size (t);
        fprintf (plot_stream, "set ylabel \"%s\" font \"%s,%d\"",
!                undo_string_escapes (tt), f, s);
        if (have_newer_gnuplot)
          fprintf (plot_stream, " rotate by %f;\n", angle);
        endif
***************
*** 105,112 ****
        if (isempty (t.string))
        fputs (plot_stream, "unset zlabel;\n");
        else
!       fprintf (plot_stream, "set zlabel \"%s\"",
!                undo_string_escapes (t.string));
        if (have_newer_gnuplot)
          ## Rotation of zlabel not yet support by gnuplot as of 4.2, but
          ## there is no message about it.
--- 108,117 ----
        if (isempty (t.string))
        fputs (plot_stream, "unset zlabel;\n");
        else
!       tt = __maybe_munge_text__ (enhanced, t);
!       [f, s] = get_fontname_and_size (t);
!       fprintf (plot_stream, "set zlabel \"%s\" font \"%s,%d\"",
!                undo_string_escapes (tt), f, s);
        if (have_newer_gnuplot)
          ## Rotation of zlabel not yet support by gnuplot as of 4.2, but
          ## there is no message about it.
***************
*** 851,858 ****
          endif
  
        case "text"
          lpos = obj.position;
-         label = obj.string;
          halign = obj.horizontalalignment;
          angle = obj.rotation;
            units = obj.units;
--- 856,863 ----
          endif
  
        case "text"
+         label = __maybe_munge_text__ (enhanced, obj);
          lpos = obj.position;
          halign = obj.horizontalalignment;
          angle = obj.rotation;
            units = obj.units;
***************
*** 1479,1481 ****
--- 1484,1656 ----
      s = t.fontsize;
    endif
  endfunction
+ 
+ function str = __maybe_munge_text__ (enhanced, obj)
+   persistent warned_latex = false;
+ 
+   str = obj.string;
+   if (enhanced)
+     if (strcmp (obj.interpreter, "tex"))
+       str = __tex2enhanced__ (str);
+     elseif (strcmp (obj.interpreter, "latex"))
+       if (! warned_latex)
+       warning ("latex text objects not supported");
+       warned_latex = true;
+       endif
+     endif
+   endif
+ endfunction
+ 
+ function str = __tex2enhanced__ (str)
+   persistent sym = __setup_sym_table__ ();
+ 
+   [s, e, m] = regexp(str,'\\([a-zA-Z]+|0)','start','end','matches');
+ 
+   for i = length (s) : -1 : 1
+     ## special case for "\0"  and replace with "{/Symbol \306}'
+     if (strcmp (m{i}, '\0'))
+       str = strcat (str(1:s(i) - 1), '{\Symbol \306}', str(e(i) + 1:end));
+     else
+       f = m{i}(2:end);
+       if (isfield (sym, f))
+         str = strcat (str(1:s(i) - 1), getfield(sym, f), str(e(i) + 1:end));
+       elseif (strcmp (f, "rm") || strcmp (f, "bf") ||
+             strcmp (f, "it") || strcmp (f, "sl"))
+       ## FIXME
+       ## Ignore and remove \rm, \bf \sl \it as we can't treat them
+       str = strcat (str(1:s(i) - 1), str(e(i) + 1:end));
+       elseif (strcmp (f, "color"))
+       ## FIXME
+       ## Ignore \color too but remove trailing {} block as well
+       d = strfind(str(e(i) + 1:end),'}');
+         if (isempty (d))
+         warning ('syntax error in \color argument');
+       else
+         str = strcat (str(1:s(i) - 1), str(e(i) + d + 1:end));
+         endif
+       elseif(strcmp (f, "fontname"))
+       b1 = strfind(str(e(i) + 1:end),'{');
+       b2 = strfind(str(e(i) + 1:end),'}');
+         if (isempty(b1) || isempty(b2))
+         warning ('syntax error in \fontname argument');
+       else
+           str = strcat (str(1:s(i) - 1), '/', 
+                       str(e(i)+b1(1) + 1:e(i)+b2(1)-1), ...
+                       str(e(i) + b2(1) + 1:end));
+         endif
+       elseif(strcmp (f, "fontsize"))
+       b1 = strfind(str(e(i) + 1:end),'{');
+       b2 = strfind(str(e(i) + 1:end),'}');
+         if (isempty(b1) || isempty(b2))
+         warning ('syntax error in \fontname argument');
+       else
+           str = strcat (str(1:s(i) - 1), '/=', 
+                       str(e(i)+b1(1) + 1:e(i)+b2(1)-1), ...
+                       str(e(i) + b2(1) + 1:end));
+         endif
+       endif
+     endif
+   endfor
+ endfunction
+ 
+ function sym = __setup_sym_table__ ()
+   ## Setup the translation table for TeX to gnuplot enhanced mode.
+   ## FIXME we have to be in an extended code page for the next 4 symbols
+   sym.rfloor = '{\353}';
+   sym.lceil  = '{\351}';
+   sym.lfloor = '{\373}';
+   sym.rceil  = '{\371}';
+   sym.forall = '{/Symbol \042}';
+   sym.exists = '{/Symbol \044}';
+   sym.ni = '{/Symbol \047}';
+   sym.cong = '{/Symbol \100}';
+   sym.Delta = '{/Symbol D}';
+   sym.Phi = '{/Symbol F}';
+   sym.Gamma = '/Symbol G}';
+   sym.vartheta = '{\Symbol J}';
+   sym.Lambda = '{/Symbol L}';
+   sym.Pi = '{/Symbol P}';
+   sym.Theta = '{/Symbol Q}';
+   sym.Sigma = '{/Symbol S}';
+   sym.varsigma = '{/Symbol V}';
+   sym.Omega = '{/Symbol O}';
+   sym.Xi = '{/Symbol X}';
+   sym.Psi = '{/Symbol Y}';
+   sym.perp = '{/Symbol \136}';
+   sym.alpha = '{/Symbol a}';
+   sym.beta = '{/Symbol b}';
+   sym.chi = '{/Symbol c}';
+   sym.delta = '{/Symbol d}';
+   sym.epsilon = '{/Symbol e}';
+   sym.phi = '{/Symbol f}';
+   sym.gamma = '/Symbol g}';
+   sym.eta = '{/Symbol h}';
+   sym.iota = '{/Symbol i}';
+   sym.kappa = '{/Symbol k}';
+   sym.lambda = '{/Symbol l}';
+   sym.mu = '{/Symbol m}';
+   sym.nu = '{/Symbol n}';
+   sym.o =  '{o}';
+   sym.pi = '{/Symbol p}';
+   sym.theta = '{/Symbol q}';
+   sym.rho = '{/Symbol r}';
+   sym.sigma = '{/Symbol s}';
+   sym.tau = '{/Symbol t}';
+   sym.varpi = '{/Symbol v}';
+   sym.omega = '{/Symbol w}';
+   sym.xi = '{/Symbol x}';
+   sym.psi = '{/Symbol y}';
+   sym.zeta = '{/Symbol z}';
+   sym.sim = '{/Symbol \176}';
+   sym.Upsilon = '{/Symbol \241}';
+   sym.prime = '{/Symbol \242}';
+   sym.leq = '{/Symbol \243}';
+   sym.infty = '{/Symbol \245}';
+   sym.clubsuit = '{/Symbol \247}';
+   sym.diamondsuit = '{/Symbol \250}';
+   sym.heartsuit = '{/Symbol \251}';
+   sym.spadesuit = '{/Symbol \252}';
+   sym.leftrightarrow = '{/Symbol \3253}';
+   sym.leftarrow = '{/Symbol \254}';
+   sym.uparrow = '{/Symbol \255}';
+   sym.rightarrow = '{/Symbol \256}';
+   sym.downarrow = '{/Symbol \257}';
+   sym.circ = '{/Symbol \260}';
+   sym.pm = '{/Symbol \261}';
+   sym.geq = '{/Symbol \263}';
+   sym.times = '{/Symbol \264}';
+   sym.propto = '{/Symbol \265}';
+   sym.partial = '{/Symbol \266}';
+   sym.bullet = '{/Symbol \267}';
+   sym.div = '{/Symbol \270}';
+   sym.neq = '{/Symbol \271}';
+   sym.equiv = '{/Symbol \272}';
+   sym.approx = '{/Symbol \273}';
+   sym.ldots = '{/Symbol \274}';
+   sym.mid = '{/Symbol \275}';
+   sym.aleph = '{/Symbol \300}';
+   sym.Im = '{/Symbol \301}';
+   sym.Re = '{/Symbol \302}';
+   sym.wp = '{/Symbol \303}';
+   sym.otimes = '{/Symbol \304}';
+   sym.oplus = '{/Symbol \305}';
+   sym.oslash = '{/Symbol \306}';
+   sym.cap = '{/Symbol \307}';
+   sym.upsilon = '{/Symbol \307}'; ## FIXME: This is incorrect but close 
+   sym.cup = '{/Symbol \310}';
+   sym.supset = '{/Symbol \311}';
+   sym.supseteq = '{/Symbol \312}';
+   sym.subset = '{/Symbol \314}';
+   sym.subseteq = '{/Symbol \315}';
+   sym.in = '{/Symbol \316}';
+   sym.langle = '{/Symbol \320}';
+   sym.rangle = '{/Symbol \320}';
+   sym.nabla = '{/Symbol \321}';
+   sym.surd = '{/Symbol \326}';
+   sym.cdot = '{/Symbol \327}';
+   sym.neg = '{/Symbol \330}';
+   sym.wedge = '{/Symbol \331}';
+   sym.vee = '{/Symbol \332}';
+   sym.copyright = '{/Symbol \343}';
+   sym.int = '{/Symbol \362}';
+ endfunction
*** ./src/graphics.cc.orig12    2007-11-16 17:11:29.820077685 +0100
--- ./src/graphics.cc   2007-11-16 22:11:20.352266933 +0100
***************
*** 844,849 ****
--- 844,850 ----
                                const graphics_handle& p)
    : base_properties (go_name, mh, p),
      __plot_stream__ (Matrix ()),
+     __enhanced__ (false),
      nextplot ("replace"),
      closerequestfcn (make_fcn_handle ("closereq")),
      currentaxes (octave_NaN),
***************
*** 894,899 ****
--- 895,902 ----
      }
    else if (name.compare ("__plot_stream__"))
      set___plot_stream__ (val);
+   else if (name.compare ("__enhanced__"))
+     set___enhanced__ (val);
    else if (name.compare ("nextplot"))
      set_nextplot (val);
    else if (name.compare ("closerequestfcn"))
***************
*** 927,932 ****
--- 930,936 ----
    m.assign ("children", children);
    m.assign ("__modified__", __modified__);
    m.assign ("__plot_stream__", __plot_stream__);
+   m.assign ("__enhanced__", __enhanced__);
    m.assign ("nextplot", nextplot);
    m.assign ("closerequestfcn", closerequestfcn);
    m.assign ("currentaxes", currentaxes.as_octave_value ());
***************
*** 954,959 ****
--- 958,965 ----
      retval = __modified__;
    else if (name.compare ("__plot_stream__"))
      retval = __plot_stream__;
+   else if (name.compare ("__enhanced__"))
+     retval = __enhanced__;
    else if (name.compare ("nextplot"))
      retval = nextplot;
    else if (name.compare ("closerequestfcn"))
***************
*** 1952,1958 ****
      fontname ("Helvetica"),
      fontsize (10),
      fontangle (radio_values ("{normal}|italic|oblique")),
!     fontweight (radio_values ("{normal}|bold|demi|light"))
  { }
  
  void
--- 1958,1965 ----
      fontname ("Helvetica"),
      fontsize (10),
      fontangle (radio_values ("{normal}|italic|oblique")),
!     fontweight (radio_values ("{normal}|bold|demi|light")),
!     interpreter (radio_values ("{tex}|none|latex"))
  { }
  
  void
***************
*** 1991,1996 ****
--- 1998,2005 ----
      set_fontangle (val);
    else if (name.compare ("fontweight"))
      set_fontweight (val);
+   else if (name.compare ("interpreter"))
+     set_interpreter (val);
    else
      {
        modified = false;
***************
*** 2021,2026 ****
--- 2030,2036 ----
    m.assign ("fontsize", fontsize);
    m.assign ("fontangle", fontangle);
    m.assign ("fontweight", fontweight);
+   m.assign ("interpreter", interpreter);
  
    return m;
  }
***************
*** 2060,2065 ****
--- 2070,2077 ----
      retval = fontangle;
    else if (name.compare ("fontweight"))
      retval = fontweight;
+   else if (name.compare ("interpreter"))
+     retval = interpreter;
    else
      warning ("get: invalid property `%s'", name.c_str ());
  
***************
*** 2083,2088 ****
--- 2095,2102 ----
        string_property ("normal", radio_values ("{normal}|italic|oblique"));
    m["fontweight"] = 
      string_property ("normal", radio_values ("{normal}|bold|demi|light"));
+   m["interpreter"] = 
+     string_property ("tex", radio_values ("{tex}|none|latex"));
  
    return m;
  }
*** ./src/graphics.h.in.orig12  2007-11-16 17:11:36.545735301 +0100
--- ./src/graphics.h.in 2007-11-16 21:48:15.459430279 +0100
***************
*** 1098,1103 ****
--- 1098,1104 ----
  
      BEGIN_PROPERTIES
        octave_value __plot_stream__
+       octave_value __enhanced__
        octave_value nextplot
        octave_value closerequestfcn
        graphics_handle currentaxes S
***************
*** 1522,1527 ****
--- 1523,1529 ----
        octave_value fontsize
        string_property fontangle a
        string_property fontweight a
+       string_property interpreter a
      END_PROPERTIES
  
      static std::string go_name;
2007-11-16  David Bateman  <address@hidden>

        * plot/drawnow.m (open_gnuplot_stream, init_gnuplot_stream):
        Return whether the terminal supports enhanced text or not.
        (drawnow:enhanced_term): New sub-function to determine is terminal
        supported enhanced mode.
        * plot/__go_draw_figure__.m: Accept enhanced flag and pass to
        __go_draw_axes__.
        * plot/__go_draw_axes__.m: Accept enhanced flag and munge text if
        needed to support the enhanced mode.

2007-11-16  David Bateman  <address@hidden>

        * graphics.h.in (class figure): Add __enhanced__ property to cache
        whether the terminal supports enhanced mode.
        * graphics.cc (class figure): ditto.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]