octave-maintainers
[Top][All Lists]
Advanced

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

Re: Treat TeX in plot text in a Matlab compatible matter with gnuplot en


From: David Bateman
Subject: Re: Treat TeX in plot text in a Matlab compatible matter with gnuplot enhanced mode
Date: Tue, 20 Nov 2007 15:50:11 +0100
User-agent: Thunderbird 1.5.0.7 (X11/20060921)

David Bateman wrote:
> Update with a couple of small fixes
>
> D.
>
>   
Here is a small supplemental patch that allows the X11 terminal to work
correctly with gnuplot 4.0. What it does is just force the font to be
respecified in the string itself with the extended syntax, rather than
in an additional argument to the gnuplot "label" command..

D.

-- 
David Bateman                                address@hidden
Motorola Labs - Paris                        +33 1 69 35 48 04 (Ph) 
Parc Les Algorithmes, Commune de St Aubin    +33 6 72 01 06 33 (Mob) 
91193 Gif-Sur-Yvette FRANCE                  +33 1 69 35 77 01 (Fax) 

The information contained in this communication has been classified as: 

[x] General Business Information 
[ ] Motorola Internal Use Only 
[ ] Motorola Confidential Proprietary

*** ./scripts/plot/__go_draw_axes__.m.orig17    2007-11-20 15:43:14.177657184 
+0100
--- ./scripts/plot/__go_draw_axes__.m   2007-11-20 15:07:12.221745320 +0100
***************
*** 59,65 ****
        if (isempty (t.string))
        fputs (plot_stream, "unset title;\n");
        else
!       [tt, f, s] = __maybe_munge_text__ (enhanced, t, "string");
        fprintf (plot_stream, "set title \"%s\" font \"%s,%d\";\n",
                 undo_string_escapes (tt), f, s);
        endif
--- 59,66 ----
        if (isempty (t.string))
        fputs (plot_stream, "unset title;\n");
        else
!       [tt, f, s] = __maybe_munge_text__ (enhanced, t, "string", 
!                                          have_newer_gnuplot);
        fprintf (plot_stream, "set title \"%s\" font \"%s,%d\";\n",
                 undo_string_escapes (tt), f, s);
        endif
***************
*** 71,77 ****
        if (isempty (t.string))
        fputs (plot_stream, "unset xlabel;\n");
        else
!       [tt, f, s] = __maybe_munge_text__ (enhanced, t, "string");
        fprintf (plot_stream, "set xlabel \"%s\" font \"%s,%d\"",
                 undo_string_escapes (tt), f, s);
        if (have_newer_gnuplot)
--- 72,79 ----
        if (isempty (t.string))
        fputs (plot_stream, "unset xlabel;\n");
        else
!       [tt, f, s] = __maybe_munge_text__ (enhanced, t, "string",
!                                          have_newer_gnuplot);
        fprintf (plot_stream, "set xlabel \"%s\" font \"%s,%d\"",
                 undo_string_escapes (tt), f, s);
        if (have_newer_gnuplot)
***************
*** 89,95 ****
        if (isempty (t.string))
        fputs (plot_stream, "unset ylabel;\n");
        else
!       [tt, f, s] = __maybe_munge_text__ (enhanced, t, "string");
        fprintf (plot_stream, "set ylabel \"%s\" font \"%s,%d\"",
                 undo_string_escapes (tt), f, s);
        if (have_newer_gnuplot)
--- 91,98 ----
        if (isempty (t.string))
        fputs (plot_stream, "unset ylabel;\n");
        else
!       [tt, f, s] = __maybe_munge_text__ (enhanced, t, "string",
!                                          have_newer_gnuplot);
        fprintf (plot_stream, "set ylabel \"%s\" font \"%s,%d\"",
                 undo_string_escapes (tt), f, s);
        if (have_newer_gnuplot)
***************
*** 105,111 ****
        if (isempty (t.string))
        fputs (plot_stream, "unset zlabel;\n");
        else
!       [tt, f, s] = __maybe_munge_text__ (enhanced, t, "string");
        fprintf (plot_stream, "set zlabel \"%s\" font \"%s,%d\"",
                 undo_string_escapes (tt), f, s);
        if (have_newer_gnuplot)
--- 108,115 ----
        if (isempty (t.string))
        fputs (plot_stream, "unset zlabel;\n");
        else
!       [tt, f, s] = __maybe_munge_text__ (enhanced, t, "string",
!                                          have_newer_gnuplot);
        fprintf (plot_stream, "set zlabel \"%s\" font \"%s,%d\"",
                 undo_string_escapes (tt), f, s);
        if (have_newer_gnuplot)
***************
*** 320,326 ****
          if (isempty (obj.keylabel))
            titlespec{data_idx} = "title \"\"";
          else
!           tmp = undo_string_escapes (__maybe_munge_text__ (enhanced, obj, 
"keylabel"));
            titlespec{data_idx} = strcat ("title \"", tmp, "\"");
          endif
          [style, typ, with] = do_linestyle_command (obj, data_idx, 
plot_stream);
--- 324,330 ----
          if (isempty (obj.keylabel))
            titlespec{data_idx} = "title \"\"";
          else
!           tmp = undo_string_escapes (__maybe_munge_text__ (enhanced, obj, 
"keylabel", have_newer_gnuplot));
            titlespec{data_idx} = strcat ("title \"", tmp, "\"");
          endif
          [style, typ, with] = do_linestyle_command (obj, data_idx, 
plot_stream);
***************
*** 494,500 ****
               if (i > 1 || isempty (obj.keylabel))
                 titlespec{data_idx} = "title \"\"";
               else
!                tmp = undo_string_escapes (__maybe_munge_text__ (enhanced, 
obj, "keylabel"));
                 titlespec{data_idx} = strcat ("title \"", tmp, "\"");
               endif
               usingclause{data_idx} = "";
--- 498,504 ----
               if (i > 1 || isempty (obj.keylabel))
                 titlespec{data_idx} = "title \"\"";
               else
!                tmp = undo_string_escapes (__maybe_munge_text__ (enhanced, 
obj, "keylabel", have_newer_gnuplot));
                 titlespec{data_idx} = strcat ("title \"", tmp, "\"");
               endif
               usingclause{data_idx} = "";
***************
*** 790,796 ****
            if (isempty (obj.keylabel))
              titlespec{data_idx} = "title \"\"";
            else
!             tmp = undo_string_escapes (__maybe_munge_text__ (enhanced, obj, 
"keylabel"));
              titlespec{data_idx} = strcat ("title \"", tmp, "\"");
            endif
            usingclause{data_idx} = "";
--- 794,800 ----
            if (isempty (obj.keylabel))
              titlespec{data_idx} = "title \"\"";
            else
!             tmp = undo_string_escapes (__maybe_munge_text__ (enhanced, obj, 
"keylabel", have_newer_gnuplot));
              titlespec{data_idx} = strcat ("title \"", tmp, "\"");
            endif
            usingclause{data_idx} = "";
***************
*** 985,991 ****
          endif
  
        case "text"
!         [label, f, s] = __maybe_munge_text__ (enhanced, obj, "string");
          lpos = obj.position;
          halign = obj.horizontalalignment;
          angle = obj.rotation;
--- 989,996 ----
          endif
  
        case "text"
!         [label, f, s] = __maybe_munge_text__ (enhanced, obj, "string",
!                                               have_newer_gnuplot);
          lpos = obj.position;
          halign = obj.horizontalalignment;
          angle = obj.rotation;
***************
*** 1619,1625 ****
    endif
  endfunction
  
! function [str, f, s] = __maybe_munge_text__ (enhanced, obj, fld)
    persistent warned_latex = false;
  
    if (strcmp (fld, "string"))
--- 1624,1631 ----
    endif
  endfunction
  
! function [str, f, s] = __maybe_munge_text__ (enhanced, obj, fld, 
!                                            have_newer_gnuplot)
    persistent warned_latex = false;
  
    if (strcmp (fld, "string"))
***************
*** 1636,1641 ****
--- 1642,1651 ----
    if (enhanced)
      if (strcmp (obj.interpreter, "tex"))
        str = __tex2enhanced__ (str, fnt, it, bld);
+       if (! have_newer_gnuplot)
+       ## Set the font to work around gnuplot 4.0 X11 enhanced terminal bug
+       str = strcat ('{/', f, ' ', str, ' }'); 
+       endif
      elseif (strcmp (obj.interpreter, "latex"))
        if (! warned_latex)
        warning ("latex text objects not supported");
2007-11-20  David Bateman  <address@hidden>

        * plot/__go_draw_axes__.m: Pass the have_newer_gnuplot arg to
        __maybe_munge_text__. Use it to reforce fontname for gnuplot 4.0
        to get enhanced mode to work correctly for the X11 terminal.


reply via email to

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