Path: utzoo!attcan!uunet!lll-winken!ames!mailrus!ukma!gatech!bloom-beacon!TUB.BITNET!net From: net@TUB.BITNET (Oliver Laumann) Newsgroups: comp.windows.x Subject: XTextWidth broken. Message-ID: <8901091701.AA26463@tub.UUCP> Date: 9 Jan 89 17:01:33 GMT Sender: daemon@bloom-beacon.MIT.EDU Organization: The Internet Lines: 37 XTextWidth() and probably other related functions are broken; it is not possible to compute the width of a string containing characters with codes greater than 127. Therefore the upper halves of the ISO Latin-1 fonts currently cannot be used. The bugs are located in the (internal) functions GetCS and GetCS2d; `char' is used in several places where `int' should have been used instead. The line row = (chars[ind] >> 8)-firstRow; in GetCS2d() is particularly interesting; note that `chars' is a character array! One of the bugs can be reproduced with the following demonstration program. It prints "15 0"; this is certainly not right. #include main () $ Display *d; XFontStruct *f; if ((d = XOpenDisplay ((char *)0)) == 0) return 1; if ((f = XLoadQueryFont (d, "*courier-bold-r-normal--24*")) == 0) return 1; printf ("%d %d\n", f->per_char[0273].width, XTextWidth (f, "\273", 1)); return 0; Regards, -- Oliver Laumann net@TUB.BITNET net@tub.UUCP