Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!ncar!boulder!stan!garya From: garya@Solbourne.COM (Gary Aitken) Newsgroups: comp.windows.x Subject: XDrawImageString bug Keywords: XDrawImageString Message-ID: <1850@garya.Solbourne.COM> Date: 3 Aug 89 23:14:27 GMT Organization: Solbourne Computer Inc., Longmont, Co. Lines: 63 XDrawImageString has a bug in it for fonts like .../75dpi/courR14.snf which have pixels at the top of the font for things like umlauts. The font height, as measured by maxbounds ascent+descent, is 16. A font property, PIXEL_SIZE, is 14. XDrawImageString does not draw the top two pixels in some cases. I'm guessing it's using the property somehow to determine a clip region? Here's a demo: Fails on X11R3 and the pre release R4 Xlib ================================== cut here ======================================== #include main(argc,argv) int argc ; char **argv ; { Display *dpy ; Window rt,win1,win2 ; int x,y ; char *fnp ; /* font name */ XFontStruct *fp ; /* ptr to X font structure for new font */ XGCValues tempgc ; /* temporary X graphics context for creating GC's */ GC gc1,gc2 ; unsigned long mask ; static char string[] = "H\305" ; /* H, A with a circle over it in courR14.snf */ XEvent event ; dpy = XOpenDisplay("unix:0.0") ; XSynchronize(dpy,1) ; rt = XDefaultRootWindow(dpy) ; fp = XLoadQueryFont(dpy,"-adobe-courier-medium-r-normal--14-140-75-75-m-90-iso8859-1") ; tempgc.graphics_exposures = False ; tempgc.foreground = XBlackPixel(dpy,0) ; tempgc.background = XWhitePixel(dpy,0) ; tempgc.font = fp->fid ; mask = GCForeground | GCBackground | GCGraphicsExposures | GCFont ; gc1 = XCreateGC(dpy,rt,mask,&tempgc) ; win1 = XCreateSimpleWindow(dpy,rt,100,100,300,200,4,tempgc.foreground,tempgc.background) ; win2 = XCreateSimpleWindow(dpy,rt,200,100,300,200,4,tempgc.foreground,tempgc.foreground) ; XSelectInput(dpy,win1,StructureNotifyMask) ; XSelectInput(dpy,win2,StructureNotifyMask) ; XMapWindow(dpy,win1) ; XMapWindow(dpy,win2) ; while (!XCheckTypedWindowEvent(dpy,win1,MapNotify,&event)) ; while (!XCheckTypedWindowEvent(dpy,win2,MapNotify,&event)) ; tempgc.foreground = XWhitePixel(dpy,0) ; tempgc.background = XBlackPixel(dpy,0) ; gc2 = XCreateGC(dpy,rt,mask,&tempgc) ; XDrawImageString(dpy,win1,gc1,50,50,string,2) ; XDrawImageString(dpy,win1,gc2,100,50,string,2) ; XDrawImageString(dpy,win2,gc1,50,50,string,2) ; XDrawImageString(dpy,win2,gc2,100,50,string,2) ; while (1) ; } -- Gary Aitken Solbourne Computer Inc. ARPA: garya@Solbourne.COM Longmont, CO UUCP: !{boulder,nbires,sun}!stan!garya