mirror of https://github.com/0intro/wmii
implemented Xutf8DrawString behavior
This commit is contained in:
parent
3931fe18f4
commit
956b52bb2a
|
@ -102,7 +102,11 @@ xdrawtext(Display *dpy, BlitzDraw *d)
|
|||
}
|
||||
XSetBackground(dpy, d->gc, d->color.bg);
|
||||
XSetForeground(dpy, d->gc, d->color.fg);
|
||||
#ifdef X_HAVE_UTF8_STRING
|
||||
Xutf8DrawString(dpy, d->drawable, d->font.set, d->gc, x, y, text, len);
|
||||
#else
|
||||
XDrawString(dpy, d->drawable, d->gc, x, y, text, len);
|
||||
#endif
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
@ -5,20 +5,31 @@
|
|||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <cext.h>
|
||||
|
||||
#include "blitz.h"
|
||||
|
||||
void
|
||||
blitz_loadfont(Display *dpy, BlitzFont *font, char *fontstr)
|
||||
{
|
||||
char *fontname = fontstr;
|
||||
char **missing = nil, *def = "?";
|
||||
int nmissing;
|
||||
if(font->set)
|
||||
XFreeFontSet(dpy, font->set);
|
||||
if(font->font)
|
||||
XFreeFont(dpy, font->font);
|
||||
font->font = XLoadQueryFont(dpy, fontstr);
|
||||
font->font = XLoadQueryFont(dpy, fontname);
|
||||
if (!font->font) {
|
||||
font->font = XLoadQueryFont(dpy, "fixed");
|
||||
fontname = "fixed";
|
||||
font->font = XLoadQueryFont(dpy, fontname);
|
||||
if (!font->font) {
|
||||
fprintf(stderr, "%s", "liblitz: error, cannot load fixed font\n");
|
||||
fprintf(stderr, "%s", "liblitz: error, cannot load 'fixed' font\n");
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
font->set = XCreateFontSet(dpy, fontname, &missing, &nmissing, &def);
|
||||
|
||||
if(missing)
|
||||
XFreeStringList(missing);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue