summaryrefslogtreecommitdiff
path: root/xc/lib/Xft/xftdraw.c
diff options
context:
space:
mode:
Diffstat (limited to 'xc/lib/Xft/xftdraw.c')
-rw-r--r--xc/lib/Xft/xftdraw.c50
1 files changed, 49 insertions, 1 deletions
diff --git a/xc/lib/Xft/xftdraw.c b/xc/lib/Xft/xftdraw.c
index 7ec5290f1..d8f2c9835 100644
--- a/xc/lib/Xft/xftdraw.c
+++ b/xc/lib/Xft/xftdraw.c
@@ -1,5 +1,5 @@
/*
- * $XFree86: xc/lib/Xft/xftdraw.c,v 1.10 2000/12/15 17:12:52 keithp Exp $
+ * $XFree86: xc/lib/Xft/xftdraw.c,v 1.12 2000/12/20 00:28:44 keithp Exp $
*
* Copyright © 2000 Keith Packard, member of The XFree86 Project, Inc.
*
@@ -22,6 +22,7 @@
* PERFORMANCE OF THIS SOFTWARE.
*/
+#include <stdio.h>
#include <stdlib.h>
#include "xftint.h"
#include <X11/Xutil.h>
@@ -200,6 +201,14 @@ XftDrawRenderPrepare (XftDraw *draw,
return False;
if (memcmp (&color->color, &draw->render.fg_color, sizeof (XRenderColor)))
{
+ if (_XftFontDebug () & XFT_DBG_DRAW)
+ {
+ printf ("Switching to color %04x,%04x,%04x,%04x\n",
+ color->color.alpha,
+ color->color.red,
+ color->color.green,
+ color->color.blue);
+ }
XRenderFillRectangle (draw->dpy, PictOpSrc, draw->render.fg_pict,
&color->color, 0, 0, 1, 1);
draw->render.fg_color = color->color;
@@ -255,6 +264,10 @@ XftDrawString8 (XftDraw *draw,
XftChar8 *string,
int len)
{
+ if (_XftFontDebug () & XFT_DBG_DRAW)
+ {
+ printf ("DrawString \"%*.*s\"\n", len, len, string);
+ }
if (font->core)
{
XftDrawCorePrepare (draw, color, font);
@@ -333,6 +346,41 @@ XftDrawString32 (XftDraw *draw,
}
void
+XftDrawStringUtf8 (XftDraw *draw,
+ XftColor *color,
+ XftFont *font,
+ int x,
+ int y,
+ XftChar8 *string,
+ int len)
+{
+ if (font->core)
+ {
+ XChar2b *xc;
+ XChar2b xcloc[XFT_CORE_N16LOCAL];
+ int n;
+
+ XftDrawCorePrepare (draw, color, font);
+ xc = XftCoreConvertUtf8 (string, len, xcloc, &n);
+ if (xc)
+ {
+ XDrawString16 (draw->dpy, draw->drawable, draw->core.draw_gc, x, y,
+ xc, n);
+ }
+ if (xc != xcloc)
+ free (xc);
+ }
+#ifdef FREETYPE2
+ else if (XftDrawRenderPrepare (draw, color, font))
+ {
+ XftRenderStringUtf8 (draw->dpy, draw->render.fg_pict, font->u.ft.font,
+ draw->render.pict, 0, 0, x, y, string, len);
+ }
+#endif
+}
+
+
+void
XftDrawRect (XftDraw *draw,
XftColor *color,
int x,