|
From: Christoph B. <us...@be...> - 2014-06-01 17:35:02
|
Hi, I've seen, that different terminals handle the `dashlength` option differently: set termoption dashlength 1 plot x dt 2, 2*x dt '.-' pause -1 set termoption dashlength 3 replot `qt`: dashlength affects only the custom dash pattern `wxt`: both patterns are stretched `post`: only the builtin patterns are affected This behaviour should be equal for all terminals. My suggestion is to have the dashlength option apply to all dash patterns. Especially for patterns of the kind `dt '.-'` it is very helpful to have the ability to change the basic unit of the patterns. I wanted to discuss this before I submit any patches to sf. Best regards, Christoph |
|
From: sfeam <sf...@us...> - 2014-06-01 17:56:11
|
On Sunday, 01 June 2014 07:34:53 PM Christoph Bersch wrote: > I've seen, that different terminals handle the `dashlength` option > differently: > > set termoption dashlength 1 > plot x dt 2, 2*x dt '.-' > pause -1 > > set termoption dashlength 3 > replot > > `qt`: dashlength affects only the custom dash pattern > `wxt`: both patterns are stretched > `post`: only the builtin patterns are affected > > This behaviour should be equal for all terminals. Good point. I am also wondering whether the dashtype or linetype itself should include a dashlength attribute, independent of the terminal setting. Thus you could say: set dashtype 1 ".-.-" dashlength 0.5 or set linetype 1 dashtype "._._" dashlength 0.5 The first option would add a new field to struct t_dashtype. The second would instead add a new field to struct lp_style_type. I have not tried implementing either of these options. It may turn out that one option is easier/better than the other. Either way this factor would be multiplied by the terminal's own dashlength setting. Ethan > My suggestion is to have the dashlength option apply to all dash > patterns. Especially for patterns of the kind `dt '.-'` it is very > helpful to have the ability to change the basic unit of the patterns. > > I wanted to discuss this before I submit any patches to sf. > > Best regards, > Christoph |
|
From: Christoph B. <us...@be...> - 2014-06-02 09:18:16
|
Zitat von sfeam <sf...@us...>: > On Sunday, 01 June 2014 07:34:53 PM Christoph Bersch wrote: > >> I've seen, that different terminals handle the `dashlength` option >> differently: >> >> set termoption dashlength 1 >> plot x dt 2, 2*x dt '.-' >> pause -1 >> >> set termoption dashlength 3 >> replot >> >> `qt`: dashlength affects only the custom dash pattern >> `wxt`: both patterns are stretched >> `post`: only the builtin patterns are affected >> >> This behaviour should be equal for all terminals. > > Good point. I've had a quick look at the Qt-documentation, but I couldn't find an option to change the dash length for the builtin patterns. Another thing I've seen is, that for some terminals the dash pattern length depends on the linewidth, e.g. for the `qt` terminal. For others, like the `wxt` terminal it doesn't. This gives the following problem with the `wxt` terminal: With the default setting of the line cap (square, see http://cairographics.org/samples/set_line_cap/), a thick, dashed line becomes solid: plot x dt 2 lw 10 This gives a solid line for me. Using `set termoption butt` resolves this, but the dashes look strange, being more dots than dashes. So this would be another point, where we should try to have similar behavior across the terminals, or at least try to. > I am also wondering whether the dashtype or linetype itself should > include a dashlength attribute, independent of the terminal setting. > Thus you could say: > > set dashtype 1 ".-.-" dashlength 0.5 > > or > > set linetype 1 dashtype "._._" dashlength 0.5 Yes, that looks like a reasonable option. Christoph |
|
From: sfeam <sf...@us...> - 2014-06-02 15:40:43
|
On Monday, 02 June 2014 11:18:08 AM Christoph Bersch wrote: > > Zitat von sfeam <sf...@us...>: > > > On Sunday, 01 June 2014 07:34:53 PM Christoph Bersch wrote: > > > >> I've seen, that different terminals handle the `dashlength` option > >> differently: > >> > >> set termoption dashlength 1 > >> plot x dt 2, 2*x dt '.-' > >> pause -1 > >> > >> set termoption dashlength 3 > >> replot > >> > >> `qt`: dashlength affects only the custom dash pattern > >> `wxt`: both patterns are stretched > >> `post`: only the builtin patterns are affected > >> > >> This behaviour should be equal for all terminals. > > > > Good point. > > I've had a quick look at the Qt-documentation, but I couldn't find an > option to change the dash length for the builtin patterns. Correct. > Another thing I've seen is, that for some terminals the dash pattern > length depends on the linewidth, e.g. for the `qt` terminal. For > others, like the `wxt` terminal it doesn't. Qt docs: "the dash pattern is specified in units of the pens width" > [...] we should try to have similar > behavior across the terminals, or at least try to. For output devices that really do provide their own dash types we can't do much other than use them as provided. But we can aim for consistent behavior of the new "custom" dashtypes. I kind of like the Qt approach of scaling the dashlength with the line width. I'm not certain that would work for all terminal types but it's something to think about. Ethan |
|
From: Mojca M. <moj...@gm...> - 2014-06-03 12:55:56
Attachments:
patch-dashlength.diff
|
On Mon, Jun 2, 2014 at 5:39 PM, sfeam wrote: > On Monday, 02 June 2014 11:18:08 AM Christoph Bersch wrote: >> >> Zitat von sfeam <sf...@us...>: >> >> > On Sunday, 01 June 2014 07:34:53 PM Christoph Bersch wrote: >> > >> >> I've seen, that different terminals handle the `dashlength` option >> >> differently: >> >> >> >> set termoption dashlength 1 >> >> plot x dt 2, 2*x dt '.-' >> >> pause -1 >> >> >> >> set termoption dashlength 3 >> >> replot >> >> >> >> `qt`: dashlength affects only the custom dash pattern >> >> `wxt`: both patterns are stretched >> >> `post`: only the builtin patterns are affected >> >> >> >> This behaviour should be equal for all terminals. >> > >> > Good point. >> >> I've had a quick look at the Qt-documentation, but I couldn't find an >> option to change the dash length for the builtin patterns. > > Correct. > >> Another thing I've seen is, that for some terminals the dash pattern >> length depends on the linewidth, e.g. for the `qt` terminal. For >> others, like the `wxt` terminal it doesn't. > > Qt docs: "the dash pattern is specified in units of the pens width" > >> [...] we should try to have similar >> behavior across the terminals, or at least try to. > > For output devices that really do provide their own dash types > we can't do much other than use them as provided. But wxt isn't a black box that simply draws dashed lines with "please give me dash type 3" and could probably be fixed. I'm attaching an example of a patch that fixes at least some cases (please note that I'm not familiar with wxt code, I haven't verified or tested the patch extensively, it's just a quick hack and it's possible that I made mistakes; use it only as a proof-of-principle for now). > But we can aim for consistent behavior of the new "custom" > dashtypes. I kind of like the Qt approach of scaling the > dashlength with the line width. I'm not certain that would > work for all terminal types but it's something to think about. I agree. Scaling the dash length with the pen width certainly makes sense. In all terminals where this can be supported. Mojca |