From: Daniel J S. <dan...@ie...> - 2004-08-12 17:10:36
|
Ethan Merritt wrote: >On Thursday 12 August 2004 03:44 am, Dave Denholm wrote: > > >> if (type != LineSolid || width != 0) { /* select solid line */ >> XSetLineAttributes(dpy, gc, 0, LineSolid, CapButt, JoinBevel); >> } >> >>- try setting the linewidth param to 1 in the XSetLineAttributes call. >> >> > >Thanks for the tip. The change I actually made was to unconditionally call > > /* Force line type to solid, with round ends */ > XSetLineAttributes(dpy, *current_gc, plot->lwidth, LineSolid, CapRound, JoinRound); > >I was under the impression that passing plot->lwidth was essentially a no-op, >since that should have been the current state anyhow. I made it unconditional >in order to force the CapRound attribute. But if I understand your summary of >X oddities, it may actually be the explicit linewidth rather than the CapRound >that causes the observed problem to go away. > >Daniel, do you care enough to investigate further? >I'm happy just to leave it as it is, since it seems to work. > Well, I looked at this. The value that gnuplot_x11 was putting in for plot->lwidth is 1, not zero. So that means the following property of CapNotLast should *not* apply. CapNotLast This is equivalent to CapButt except that for a line-width of zero the final endpoint is not drawn. Still, originally it was CapButt, which shouldn't have this "final endpoint is not drawn" property, anyway. I also tried "XDrawLine" instead of the "XDrawSegments". That worked the same way. But I see that if one sets the "ps 2", it appears to fix the problem. So again, I'm confused (very) and I agree with Ethan that there is a bug in the X11 software. CapButt is not being interpretted according to documentation, and a the line width of one is treated as though it were line width zero. Anyway, if you want to get an idea of what Ethan's change has done, try plot '-' w points lw 10 pt 1 ps 10 0 0 end And try it with "pt 2". I'm fine with that rounding (although the X11 routines don't seem to have the radius around the ends of lines just right), unless someone wants to argue the WYSIWYG principle that it should match the style the other terminals use. With a line size of 1 or 2, these effects are hardly noticable. However, if the rounded line ends are not acceptable, another alternative to get around this bug would be the "CapProjecting" option. That has square line ends that extend half line width past the end point. It doesn't appear to have this problem that line width of 1 that is occuring with CapButt. I've a feeling that most will prefer the CapProjecting option over CapRound because, as I've noticed, the rounded part seems a little askew for some reason. Dan |