From: Cottrell, A. <cot...@wf...> - 2025-05-08 15:38:07
|
In some contexts I prefer to set "noenhanced" as an initial terminal option (to avoid turning underscores in identifiers into subscript markers), but show certain labels in enhanced mode. The doc for (e.g.) xlabel says "noenhanced requests that the label text not be processed by the enhanced text mode parser, even if enhanced text mode is currently active." That works fine, but I'm looking for the converse, namely (e.g.) set xlabel "s = λ/λ_{max}" enhanced when noenhanced has been set initially, and that doesn't work, or at least not with gnuplot 6.0 p2. Would it be difficult to support? Allin Cottrell |
From: Ethan A M. <me...@uw...> - 2025-05-08 23:47:59
|
On Thursday, 8 May 2025 08:11:12 PDT Cottrell, Allin via gnuplot-beta wrote: > In some contexts I prefer to set "noenhanced" as an initial terminal > option (to avoid turning underscores in identifiers into subscript > markers), but show certain labels in enhanced mode. The doc for (e.g.) > xlabel says "noenhanced requests that the label text not be processed > by the enhanced text mode parser, even if enhanced text mode is > currently active." That works fine, but I'm looking for the converse, > namely (e.g.) > > set xlabel "s = λ/λ_{max}" enhanced > > when noenhanced has been set initially, and that doesn't work, or at > least not with gnuplot 6.0 p2. Would it be difficult to support? I think it would be difficult, or at least tedious. At the very least it would require new code in every terminal driver that supports enhanced text. As it stands now, the terminal driver API provides only one entry point for sending text. When the terminal is initialized, this entry point is either set to the enhanced text routine or to the plain text routine. The "noenhanced" attribute works by temporarily setting a global flag that can be seen by the terminal's enhanced text routine [see below]. If the flag is set, the terminal just ignores all the markup characters. Going the other way is I suppose possible, but would require new code in the plain text routine that knows to check some flag or other global condition and redirect the call to the enhanced text routine instead, possibly having to deal with initiallization of state variables (mostly font-related stuff) that would otherwise have been done when the terminal was first set to enhanced text mode. Use of a global flag was a hack to minimize change to the core code back when enhanced text mode was extended to be a general option rather than a special feature of the PostScript terminal. In retrospect it might have been better to accept the pain of changing the terminal API. In any case if we were to aim for flipping enhanced text on and off as you suggest, I think it would be time to change the API by adding a term->enhanced_mode(TBOOLEAN state) entry point that the core routine write_label() could use rather than dealing with multiple global flags that violate the API boundary between the core code and the terminal code. Ethan Merritt > > Allin Cottrell -- Ethan A Merritt Department of Biochemistry University of Washington, Seattle |
From: Jeremy N. - ml g. <jn....@wi...> - 2025-05-10 09:07:44
|
On 2025-05-09 00:47, Ethan A Merritt wrote: > As it stands now, the terminal driver API provides only one entry point > for > sending text. When the terminal is initialized, this entry point is > either > set to the enhanced text routine or to the plain text routine. > The "noenhanced" attribute works by temporarily setting a global flag > that can be seen by the terminal's enhanced text routine [see below]. > If the flag is set, the terminal just ignores all the markup > characters. > Going the other way is I suppose possible, but would require new code > in the plain text routine that knows to check some flag or other global > condition and redirect the call to the enhanced text routine instead, > possibly having to deal with initiallization of state variables > (mostly font-related stuff) that would otherwise have been done > when the terminal was first set to enhanced text mode. If the state vars are only used by the enhanced mode then maybe you could sometimes initialise the terminal twice? That is, first always initialise the enhanced routine (to do the font stuff etc), then as if that had not been done (but only if noenhanced was set initially) initialise the plain text routine? Would that leave plain-text in effect exactly as it works now, but mean that temporary switches into enhanced would work? -- Jeremy Nicoll - my opinions are my own |
From: Ethan A M. <me...@uw...> - 2025-05-11 04:31:08
|
On Sat, May 10, 2025 at 2:07 AM Jeremy Nicoll - ml gnuplot < jn....@wi...> wrote: > > If the state vars are only used by the enhanced mode then maybe you could > sometimes initialise the terminal twice? That is, first always initialise > the enhanced routine (to do the font stuff etc), then as if that had not > been done (but only if noenhanced was set initially) initialise the > plain text routine? Would that leave plain-text in effect exactly as it > works > now, but mean that temporary switches into enhanced would work? > -- > Jeremy Nicoll - my opinions are my own > Yes, making sure that enhanced text fonts are always set up is certainly possible. Every terminal driver would have to be audited and possibly modified. But they'd have to be modified anyhow if they are supposed to somehow detect that a switch to one text routine from another is needed. I'm not arguing against the proposed feature. It's a perfectly reasonable thing to propose. I'm just pointing out that implementing it would take more than a simple change to a couple of places in the core code. The change would extend into every terminal driver, which is a pain. Ethan |