Menu

#696 enable global setting of enhanced/noenhanced

Version 5
open
nobody
None
5
2014-07-04
2014-07-01
No

I'm attaching a patch to gnuplot CVS as of 2014-07-01 which enables switching the global default between enhanced and non-enhanced text. I've restricted my modifications to "mainline" terminals and have not touched a few that I was unsure about (pm.trm, post.trm, lua.trm).

My strategy was to add a static boolean variable in term.c, along with getter and setter functions which are "published" in term_api.h. Most terminals then consult this boolean in their _options() function.

Discussion

  • Allin Cottrell

    Allin Cottrell - 2014-07-01

    Here's the patch

     
  • Ethan Merritt

    Ethan Merritt - 2014-07-01

    An overall goal of terminal changes in version 5 is to make all gnuplot options accessible without having to change the terminal settings. E.g. terminals have been changed so that "dashed mode" is always enabled rather than "solid" and "color" rather than "mono". The point is that you can still draw a solid line in "dashed" mode but not vice versa; you can still draw all black lines in color mode but not vice versa. Following the same principle, all terminals should be set to enable enhanced text. Whether enhanced text is actually used or not is left to later commands.

    So if you want to add some flavor of global "noenhanced" options, I would rather see it tied to the plot elements rather than to terminal settings. Perhaps something like:
    {un}set enhanced labels

    This would change the default enhanced/noenhanced property of future "set label" or "plot with labels" commands. Unlike your proposed patch it would not prevent use of enhanced text other places like tic labels, plot titles, etc.

     
  • Ethan Merritt

    Ethan Merritt - 2014-07-03

    More thoughts:

    It would take some work, but I wonder if we should reorganize the internal structure of the enhanced/noenhanced code paths. Right now the organization is:
    1) Each terminal publishes a single term->put_text() entry point.
    2) Terminals that implement enhanced text mode use the "set term {no}enhanced" option to replace the contents term->put_text() with one of two separate routines, one for normal text and one for enhanced text. So at any given moment either all text sent to the terminal goes through the enhanced text routine or the noenhanced routine.
    3) This necessitates a global flag "ignore_enhanced_text" that is set in the core code and is used by enhanced text terminals to bail out of enhanced text processing and fall back to the [unpublished] nonenhanced put_text() routine.

    We could reorganize this so that:
    1) All terminals publish a term->put_text() entry point
    2) Enhanced text terminals publish also a term->put_enhanced_text() entry point
    3) The core code calls one or the other entry point directly rather than fooling with a global flag.

    This would make it easier to reconcile your desire to disable enhanced text for, e.g., labels without disabling it altogether for other plot elements. A new command like
    set [no]enhanced labels
    would control which of two terminal entry points is called by default when a label is printed.

     
  • Allin Cottrell

    Allin Cottrell - 2014-07-04

    Thank you for your thoughts on this. But in fact I have since reconsidered a suggestion you gave me some time ago, namely adding the "noenhanced" flag when selecting a terminal. I believe this meets my needs. (At this point I'm committed to supporting gnuplot >= 4.4.0, and I didn't realize until recently that this flag is supported for 4.4.0; so I can use it even if, for earlier versions, it may be redundant).

     

Log in to post a comment.