|
|
1.1 ! root 1: #include "copyright.h" ! 2: ! 3: /* $Header: XQuTextE16.c,v 11.7 87/09/11 08:06:10 toddb Exp $ */ ! 4: /* Copyright Massachusetts Institute of Technology 1986, 1987 */ ! 5: ! 6: #define NEED_REPLIES ! 7: #include "Xlibint.h" ! 8: ! 9: XQueryTextExtents16 (dpy, fid, string, nchars, dir, font_ascent, font_descent, ! 10: overall) ! 11: register Display *dpy; ! 12: Font fid; ! 13: register short *string; ! 14: register int nchars; ! 15: int *dir; ! 16: int *font_ascent, *font_descent; ! 17: register XCharStruct *overall; ! 18: { ! 19: int indian; ! 20: register long i; ! 21: register CARD16 *buf; ! 22: xQueryTextExtentsReply rep; ! 23: long nbytes; ! 24: register xQueryTextExtentsReq *req; ! 25: ! 26: LockDisplay(dpy); ! 27: GetReq(QueryTextExtents, req); ! 28: req->fid = fid; ! 29: nbytes = nchars << 1; ! 30: req->length += (nbytes + 3)>>2; ! 31: req->oddLength = nchars & 1; ! 32: buf = (CARD16 *) _XAllocScratch (dpy, ! 33: (unsigned long)nchars * sizeof(CARD16)); ! 34: /* ! 35: * this call does not have to be all that swift, as it is doing round ! 36: * trip; have to expand to 16 bit anyway. ! 37: */ ! 38: for (i = 0; i < nchars; i++) { ! 39: buf[i] = (unsigned)*string++; ! 40: } ! 41: /* ! 42: * always send big indian.... ! 43: */ ! 44: indian = 1; ! 45: if (*(char *) & indian) _swapshort ((char *)buf, nbytes); ! 46: Data (dpy, (char *) buf, nbytes); ! 47: if (!_XReply (dpy, (xReply *)&rep, 0, xTrue)) ! 48: return (0); ! 49: *dir = rep.drawDirection; ! 50: *font_ascent = rep.fontAscent; ! 51: *font_descent = rep.fontDescent; ! 52: overall->ascent = rep.overallAscent; ! 53: overall->descent = rep.overallDescent; ! 54: overall->width = rep.overallWidth; ! 55: overall->lbearing = rep.overallLeft; ! 56: overall->rbearing = rep.overallRight; ! 57: UnlockDisplay(dpy); ! 58: SyncHandle(); ! 59: return (1); ! 60: } ! 61:
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.