Path: utzoo!censor!geac!jtsv16!uunet!tut.cis.ohio-state.edu!bloom-beacon!ATHENA.MIT.EDU!wdc From: wdc@ATHENA.MIT.EDU (Bill Cattey) Newsgroups: comp.windows.x Subject: Re: XDrawImageString bug Message-ID: Date: 5 Aug 89 06:26:26 GMT References: <8908041322.AA00498@expire.lcs.mit.edu> Organization: The Internet Lines: 39 I think more clarification is needed with XDrawImageString. I have had the advantage of being able to pick the brains of Ralph Swick who worked with me for a long time before I got the underlying concept of XDrawImageString. I _think_ I have it right now. Ralph, correct me if I still mis-understand. Here goes: Whereas XDrawString and XDrawText are for applications that allow text drawing to be totally unconstrained, XDrawImageString is for those applications where the drawing is "well-behaved". The definition of well-behaved is that all characters drawn have vertical bounds within the bounding box of the font, and no characters have a negative left bearing. This enables simplifying assumptions to be made on redisplay: Since the bounding box constrains the height and descent of characters, line spacing is done by looking at the bounding box of the font, and the application never has to worry about redrawing text above or below the current line. Characters need not be erased, and redrawn, they need only be overwritten. Simple bit blit'ing of rectangular regions move the lines and other characters out of the way. As soon as you permit the more general case, of characters that can bleed into previous characters, and lines above and below the current line, you must write a redisplay that knows what characters it drew, knows to erase and redraw them, and to repair any damage on lines above, below, or to the left of what is drawn. XDrawImageString is, NOT for the general case. When you look at what has to be done for such simple drawing, you understand that the background must be drawn in the constrained rectangle, and that fonts that are not "well-behaved" simply can't be used by applications making the simplifying assumptions. To summarize: you can't write a redisplay algorithm for text that could bleed into nearby bounding boxes without performing erase and redraw operations. A redisply that just pours rectangles of characters and their background onto the screen must be well-behaved. -wdc