1: #include <X/mit-copyright.h> 2: 3: /* $Header: XQueryWidth.c,v 10.5 86/02/01 15:39:12 tony Rel $ */ 4: /* Copyright Massachusetts Institute of Technology 1985 */ 5: 6: #include "XlibInternal.h" 7: 8: int XQueryWidth (str, font) 9: char *str; 10: Font font; 11: { 12: register Display *dpy; 13: register XReq *req; 14: XRep rep; 15: int len; 16: 17: if (str == NULL) return(0); 18: len = strlen (str); 19: 20: GetReq(X_StringWidth, 0); 21: req->param.l[0] = font; 22: req->param.s[2] = len; 23: Data (dpy, str, len); 24: if (!_XReply(dpy, &rep)) 25: return(0); 26: return(rep.param.s[0]); 27: }