#include #include #include #include Display *d; Window w; Screen s; int main(void) { XEvent evt; char s[80]; clock_t clk; XTextItem items[1]; XFontStruct *fontInfo; GC gc; // XChar2b ws[] = {{0, 65}, {0x16, 0xA0}}; XChar2b ws[] = {{35, 33}, {35, 37}}; XFontSet fontSet; char **mclr; int mccr; char *def_r; setlocale(LC_ALL, ""); d = XOpenDisplay(NULL); w = XCreateSimpleWindow(d, DefaultRootWindow(d), 50, 50, 500, 375, 0, BlackPixel(d, 0), WhitePixel(d, 0)); if (! w) { printf("Error creating window!\n"); exit(1); } XMapWindow(d, w); fontInfo = XLoadQueryFont(d, "-misc-fixed-medium-r-normal--20-*-iso8859-1"); if (! fontInfo) { fprintf(stderr, "Error loading font!\n"); exit(1); } printf("min_byte1: %d\n", fontInfo->min_byte1); printf("max_byte1: %d\n", fontInfo->max_byte1); printf("min_char_or_byte2: %d\n", fontInfo->min_char_or_byte2); printf("max_char_or_byte2: %d\n", fontInfo->max_char_or_byte2); gc = XCreateGC(d, w, 0, NULL); XSetForeground(d, gc, BlackPixel(d, 0)); XSetBackground(d, gc, WhitePixel(d, 0)); XSetFont(d, gc, fontInfo->fid); // XDrawString16(d, w, gc, 5, 25, ws, 2); fontSet = XCreateFontSet(d, "-misc-fixed-medium-r-normal--20-*-iso10646-1", &mclr, &mccr, &def_r); XmbDrawString(d, w, fontSet, gc, 5, 25, "Hellåæ", 8); // Xutf8DrawString(d, w, fontSet, gc, 5, 25, "Hellåæ", 8); clk = clock(); while(1) { while(XPending(d)) XNextEvent(d, &evt); if((clock() - clk) >= 5000000) break; } XDestroyWindow(d, w); XCloseDisplay(d); } .