First, we have to define a variable of type Font. This is necessary for loading the font.
Font f;After that the graphic context has been created, we can load the font, and setting it to be the font of the graphic context.
/* load a font */ f=XLoadFont(dpy, "-*-helvetica-bold-r-*-*-20-*-*-*-*-*-*-*"); XSetFont(dpy, g, f);The first instruction loads a font, given its name (the string -*-helvetica-...). To choose a font, use the program xfontsel. The second instruction sets f as the font of the graphic context. This means that any subsequent call to XDrawString will draw the character using this font.