void drawText(XPoint position, string message, Color clr){ XGCValues local_gc_vals; local_gc_vals.foreground = clr; local_gc_vals.font = xfs->fid; // Create gc for current drawable GC local_gc = XCreateGC(display, curr_d, GCForeground |GCFont, &local_gc_vals); char *cstr = new char [message.size()+1]; strcpy (cstr, message.c_str()); XTextItem ti; ti.chars = cstr; ti.nchars = strlen(cstr); ti.delta = 0; ti.font = None; XSync(display, false); XDrawText(display, curr_d, local_gc, position.x-textWidth(message)/2, position.y+textHeight()/2 - textDescent(), &ti, 1); XSync(display, false); // Free temporary GC XFreeGC(display, local_gc); }
INLINELINKAGE int MSPrimitiveText::textHeight(void) const { return (textAscent()+textDescent()); }