9 getFontInfo(int32_t fontid)
14 if ((fs = hashLookup(fontid, HASH_FONTINFO, &mtx)) == NULL) {
15 fs = XQueryFont(SaveDisplay, fontid);
17 hashEnter(fs, HASH_FONTINFO, fontid);
19 threadMutexUnlock(mtx);
25 RuneSysCall_xDrawString(void *args, int *res)
37 threadMutexLock(&XMtx);
39 *res = XDrawString(SaveDisplay, rhs->xid,
40 hashLookup(rhs->gcid, HASH_GC, &mtx),
42 rhs->buf.s_Addr, rhs->len);
43 threadMutexUnlock(mtx);
44 threadMutexUnlock(&XMtx);
48 RuneSysCall_xDrawImageString(void *args, int *res)
60 threadMutexLock(&XMtx);
62 *res = XDrawImageString(SaveDisplay, rhs->xid,
63 hashLookup(rhs->gcid, HASH_GC, &mtx),
65 rhs->buf.s_Addr, rhs->len);
66 threadMutexUnlock(mtx);
67 threadMutexUnlock(&XMtx);
71 RuneSysCall_xTextWidth(void *args, int *res)
80 threadMutexLock(&XMtx);
82 fs = getFontInfo(rhs->fontid);
84 *res = XTextWidth(fs, rhs->buf.s_Addr, rhs->len);
85 threadMutexUnlock(&XMtx);
89 RuneSysCall_xTextHeight(void *args, int *res)
96 threadMutexLock(&XMtx);
98 fs = getFontInfo(rhs->fontid);
100 *res = fs->ascent + fs->descent;
101 threadMutexUnlock(&XMtx);
105 RuneSysCall_xTextDescent(void *args, int *res)
112 threadMutexLock(&XMtx);
114 fs = getFontInfo(rhs->fontid);
117 threadMutexUnlock(&XMtx);
121 RuneSysCall_xLoadFont(void *args, int *res)
127 if (SaveDisplay == NULL)
129 threadMutexLock(&XMtx);
131 *res = XLoadFont(SaveDisplay, rhs->buf.s_Addr);
132 threadMutexUnlock(&XMtx);
136 RuneSysCall_xUnloadFont(void *args, int *res)
143 threadMutexLock(&XMtx);
145 if ((fs = hashRemove(rhs->fontid, HASH_FONTINFO)) != NULL)
146 XFreeFontInfo(NULL, fs, 1);
147 *res = XUnloadFont(SaveDisplay, rhs->fontid);
148 threadMutexUnlock(&XMtx);