|
|
1.1 root 1: #include "copyright.h"
2:
3: /* $Header: XImText.c,v 11.11 87/09/01 14:51:56 toddb Exp $ */
4: /* Copyright Massachusetts Institute of Technology 1986 */
5:
6: #include "Xlibint.h"
7:
8: XDrawImageString(dpy, d, gc, x, y, string, length)
9: register Display *dpy;
10: Drawable d;
11: GC gc;
12: int x, y;
13: char *string;
14: int length;
15: {
16: register xImageText8Req *req;
17: char *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;
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: XTextExtents(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 (ImageText8, req);
57: req->length += (Unit + 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: Data (dpy, CharacterOffset, (long)Unit);
65: CharacterOffset += Unit;
66: length -= Unit;
67: }
68: UnlockDisplay(dpy);
69: SyncHandle();
70: }
71:
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.