512 |
DefaultColormap(dpy, DefaultScreen(dpy))); |
DefaultColormap(dpy, DefaultScreen(dpy))); |
513 |
if(draw) |
if(draw) |
514 |
{ |
{ |
|
#ifdef HAVE_MBSTOWCS |
|
|
size_t len; |
|
|
#endif /* HAVE_MBSTOWCS */ |
|
|
|
|
515 |
if(clipRegion) |
if(clipRegion) |
516 |
{ |
{ |
517 |
XftDrawSetClip(draw, clipRegion); |
XftDrawSetClip(draw, clipRegion); |
518 |
} |
} |
519 |
|
|
520 |
#ifdef HAVE_MBSTOWCS |
XftDrawStringUtf8(draw, &color, (XftFont *)fontSet, |
521 |
/* Can the string be converted into wide chars (Unicode) ? */ |
x, y, (XftChar8 *)str, strlen(str)); |
|
len = mbstowcs (NULL, str, 0); |
|
|
if (len != -1) |
|
|
{ |
|
|
/* Yes, convert to to Unicode and draw */ |
|
|
wchar_t wstr[len + 1]; |
|
|
mbstowcs (wstr, str, len); |
|
|
XftDrawString32(draw, &color, (XftFont *)fontSet, |
|
|
x, y, (XftChar32 *)wstr, len); |
|
|
} |
|
|
else |
|
|
{ |
|
|
#endif /* HAVE_MBSTOWCS */ |
|
|
|
|
|
/* No, draw plain ASCII */ |
|
|
XftDrawString8(draw, &color, (XftFont *)fontSet, |
|
|
x, y, (XftChar8 *)str, strlen(str)); |
|
|
|
|
|
#ifdef HAVE_MBSTOWCS |
|
|
} |
|
|
#endif /* HAVE_MBSTOWCS */ |
|
522 |
|
|
523 |
XftDrawDestroy(draw); |
XftDrawDestroy(draw); |
524 |
} |
} |
738 |
|
|
739 |
XGlyphInfo extents; |
XGlyphInfo extents; |
740 |
|
|
741 |
#ifdef HAVE_MBSTOWCS |
XftTextExtentsUtf8(dpy, fontSet, (XftChar8 *)str, strlen(str), &extents); |
|
size_t len; |
|
|
|
|
|
/* Can the string be converted into wide chars (Unicode) ? */ |
|
|
len = mbstowcs (NULL, str, 0); |
|
|
if (len != -1) |
|
|
{ |
|
|
/* Yes, convert to to Unicode and measure */ |
|
|
wchar_t wstr[len + 1]; |
|
|
mbstowcs (wstr, str, len); |
|
|
XftTextExtents32(dpy, fontSet, (XftChar32 *)wstr, len, &extents); |
|
|
} |
|
|
else |
|
|
{ |
|
|
#endif /* HAVE_MBSTOWCS */ |
|
|
|
|
|
/* No, measure plain ASCII */ |
|
|
XftTextExtents8(dpy, fontSet, (XftChar8 *)str, strlen(str), &extents); |
|
|
|
|
|
#ifdef HAVE_MBSTOWCS |
|
|
} |
|
|
#endif /* HAVE_MBSTOWCS */ |
|
|
|
|
742 |
|
|
743 |
overall_ink_return->x = -(extents.x); |
overall_ink_return->x = -(extents.x); |
744 |
overall_ink_return->y = -(extents.y); |
overall_ink_return->y = -(extents.y); |