]> Dogcows Code - chaz/openbox/commitdiff
pass the x,y,w,h to font_draw.
authorDana Jansens <danakj@orodu.net>
Mon, 17 Mar 2003 07:30:30 +0000 (07:30 +0000)
committerDana Jansens <danakj@orodu.net>
Mon, 17 Mar 2003 07:30:30 +0000 (07:30 +0000)
draw the text in the "right" place for now.. no justification yet

render/font.c
render/font.h
render/render.c

index 67fd1b7de72fccca6a7aac4adf76d91d0f698756..b92bafb1006a0c22ddffa36f76664bf5496c9c91 100644 (file)
@@ -90,10 +90,15 @@ int font_max_char_width(ObFont *f)
     return (signed) f->xftfont->max_advance_width;
 }
 
-void font_draw(XftDraw *d, TextureText *t)
+void font_draw(XftDraw *d, TextureText *t, int x, int y, int w, int h)
 {
-    int x = 0, y = 0;
     XftColor c;
+
+    /* accomidate for areas bigger/smaller than Xft thinks the font is tall */
+    y += (h - t->font->xftfont->height) / 2;
+
+    x += 3; /* XXX figure out X with justification */
+
     if (t->shadow) {
         c.color.red = 0;
         c.color.green = 0;
index 28a5c5ede3a43dba0ced8a91b12511bf167c3d86..9cb4f2c969a9e86478fb49b74c5232593d6cd934 100644 (file)
@@ -9,5 +9,5 @@ void font_close(ObFont *f);
 int font_measure_string(ObFont *f, const char *str, int shadow, int offset);
 int font_height(ObFont *f, int shadow, int offset);
 int font_max_char_width(ObFont *f);
-void font_draw(XftDraw *d, TextureText *t);
+void font_draw(XftDraw *d, TextureText *t, int x, int y, int w, int h);
 #endif /* __font_h */
index 481ef098c2059800a2ecdce44d374ff8f173ebce..51c3a9beb4a8134b7e0466dae6692da10e552c5a 100644 (file)
@@ -106,7 +106,7 @@ void x_paint(Window win, Appearance *l, int x, int y, int w, int h)
                 l->xftdraw = XftDrawCreate(ob_display, l->pixmap, 
                                         render_visual, render_colormap);
             }
-            font_draw(l->xftdraw, &l->texture[i].data.text);
+            font_draw(l->xftdraw, &l->texture[i].data.text, x, y, w, h);
         break;
         case Bitmask:
             if (l->texture[i].data.mask.color->gc == None)
This page took 0.025706 seconds and 4 git commands to generate.