|
|
1.1 root 1: #include "copyright.h"
2:
3: /* $Header: XImText16.c,v 11.13 87/09/01 14:52:38 toddb Exp $ */
4: /* Copyright Massachusetts Institute of Technology 1986 */
5:
6: #include "Xlibint.h"
7:
8: XDrawImageString16(dpy, d, gc, x, y, string, length)
9: register Display *dpy;
10: Drawable d;
11: GC gc;
12: int x, y;
13: XChar2b *string;
14: int length;
15: {
16: register xImageText16Req *req;
17: XChar2b *CharacterOffset = string;
18: int FirstTimeThrough = True;
19: int lastX = 0;
20:
21: LockDisplay(dpy);
22: FlushGC(dpy, gc);
23:
24: while (length > 0)
25: {
26: int Unit, Datalength;
27:
28: if (length > 255) Unit = 255;
29: else Unit = length;
30:
31: if (FirstTimeThrough)
32: {
33: FirstTimeThrough = False;
34: }
35: else
36: {
37: int direction, ascent, descent;
38: XCharStruct overall;
39: XFontStruct *FontStruct;
40:
41: UnlockDisplay(dpy);
42:
43: FontStruct = XQueryFont(dpy, gc->gid);
44:
45: XTextExtents16(FontStruct, CharacterOffset - 255, 255,
46: &direction, &ascent, &descent, &overall);
47:
48: Xfree(FontStruct);
49:
50: LockDisplay(dpy);
51:
52: x = lastX + overall.width;
53: }
54:
55:
56: GetReq (ImageText16, req);
57: req->length += ((Unit << 1) + 3) >> 2;
58: req->nChars = Unit;
59: req->drawable = d;
60: req->gc = gc->gid;
61: req->y = y;
62:
63: lastX = req->x = x;
64: Datalength = Unit << 1;
65: Data (dpy, (char *)CharacterOffset, (long)Datalength);
66: CharacterOffset += Unit;
67: length -= Unit;
68: }
69: UnlockDisplay(dpy);
70: SyncHandle();
71: }
72:
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.