demo/x11_xft: fix UTF-8 text rendering
If XftDrawString8() is given non-ASCII UTF-8 string it fails to properly render it. Using XftDrawStringUtf8() instead seems to be doing the right thing. Signed-off-by: Sergiy Kibrik <sakib@darkstar.site>
This commit is contained in:
parent
0a46238a44
commit
945c7f82ac
@ -430,7 +430,7 @@ nk_xsurf_draw_text(XSurface *surf, short x, short y, unsigned short w, unsigned
|
||||
xrc.blue = cfg.b * 257;
|
||||
xrc.alpha = cfg.a * 257;
|
||||
XftColorAllocValue(surf->dpy, xlib.vis, xlib.cmap, &xrc, &color);
|
||||
XftDrawString8(surf->ftdraw, &color, font->ft, tx, ty, (FcChar8*)text, len);
|
||||
XftDrawStringUtf8(surf->ftdraw, &color, font->ft, tx, ty, (FcChar8*)text, len);
|
||||
}
|
||||
#else
|
||||
XSetForeground(surf->dpy, surf->gc, fg);
|
||||
@ -632,7 +632,7 @@ nk_xfont_get_text_width(nk_handle handle, float height, const char *text, int le
|
||||
XGlyphInfo g;
|
||||
if(!font || !text)
|
||||
return 0;
|
||||
XftTextExtents8(xlib.dpy, font->ft, (FcChar8*)text, len, &g);
|
||||
XftTextExtentsUtf8(xlib.dpy, font->ft, (FcChar8*)text, len, &g);
|
||||
return g.width;
|
||||
#else
|
||||
XRectangle r;
|
||||
|
Loading…
Reference in New Issue
Block a user