|
|
1.1 root 1: #include <X/mit-copyright.h>
2:
3: /* $Header: XCharWidths.c,v 10.5 86/04/22 15:22:44 jg Rel $ */
4: /* Copyright Massachusetts Institute of Technology 1985 */
5:
6: #include "XlibInternal.h"
7: /* returns number of widths on success, NULL on error */
8:
9: int XCharWidths (chars, len, font, widths)
10: char *chars; /* not necessarily null-terminated */
11: int len;
12: Font font;
13: short *widths;
14: {
15: register Display *dpy;
16: register XReq *req;
17: XRep rep;
18:
19: GetReq(X_CharWidths, 0);
20: req->param.l[0] = font;
21: req->params2 = len;
22: Data (dpy, chars, len);
23: if (!_XReply(dpy, &rep))
24: return(NULL);
25:
26: #ifdef BIGSHORTS
27: {
28: ushort_p *proto_shorts = (ushort_p *) malloc (rep.param.l[0]);
29: _XReadPad (dpy, (char *)proto_shorts, rep.param.l[0]);
30: UnpackShorts(proto_shorts, widths, rep.param.l[0]);
31: free((char *)proto_shorts);
32: }
33: #else
34: _XReadPad (dpy, (char *)widths, rep.param.l[0]);
35: #endif
36: return(rep.param.l[0] >> 1);
37: }
38:
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.