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 |