() Eli Zaretskii () Thu, 16 Oct 2014 13:15:24 +0300 > The XDrawRectangle and XDrawRectangles functions draw the > outlines of the specified rectangle or rectangles as if a > five-point PolyLine protocol request were specified for > each rectangle: > > [x,y] [x+width,y] [x+width,y+height] [x,y+height] [x,y] > > So if you use the glyph width directly, the resulting rectangle > drawn will invade the next character cell by one pixel. The last sentence is your interpretation, because the documentation you cite does not explain what exactly it means by "the outlines of the rectangle". That is, it doesn't say whether the 1-pixel border of the outline exceeds the x+width coordinate, or ends at it. And that's the crucial point here. My interpretation is informed by the word "PolyLine" (and general experience playing w/ the X protocol[0], but that is tangential); i ignore the word "outline" as noise. XDrawline(3) explains things in gory detail, but to summarize, pixels "around" each point in a "polyline" are "rendered", so the upshot (of my example) is if ‘x’ is 20, ‘w’ is 10, and the "line width" is 1, then the pixel at 30,y will be rendered (undesirable) instead of the one at 29,y (desirable). > Probably (i don't have docs handy) the other toolkits' > rectangle-drawing primitives draw from X,Y to X+W-1,Y+H-1 I don't think so, at least not the w32 toolkit, whose documentation (http://msdn.microsoft.com/en-us/library/dd144838%28v=vs.85%29.aspx) says: The FrameRect function draws a border around the specified rectangle by using the specified brush. The width and height of the border are always one logical unit. This is equivalent to what you cited from the X docs, AFAIU. I think it hinges on what how "the specified rectangle" is specified. Also, here the "around" does indeed cast ambiguity in my mind. ___________________________________________________ [0] that is, directly scheming on a socket (http://www.gnuvola.org/software/ttn-do/). See modules ‘(ttn-do zzz x-protocol)’ et al and program xout (xout.scm), proc ‘xout frame!’, specifically line 127 where the -1 occurs for the "manual XDrawRectangle", i.e., 4-segment (5 points) PolyLine protocol, call. -- Thien-Thi Nguyen GPG key: 4C807502 (if you're human and you know it) read my lisp: (responsep (questions 'technical) (not (via 'mailing-list))) => nil