pass the x,y,w,h to font_draw.

draw the text in the "right" place for now.. no justification yet
This commit is contained in:
Dana Jansens 2003-03-17 07:30:30 +00:00
parent 6abd9fe801
commit 0c2f95674f
3 changed files with 9 additions and 4 deletions

View file

@ -90,10 +90,15 @@ int font_max_char_width(ObFont *f)
return (signed) f->xftfont->max_advance_width; 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; 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) { if (t->shadow) {
c.color.red = 0; c.color.red = 0;
c.color.green = 0; c.color.green = 0;

View 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_measure_string(ObFont *f, const char *str, int shadow, int offset);
int font_height(ObFont *f, int shadow, int offset); int font_height(ObFont *f, int shadow, int offset);
int font_max_char_width(ObFont *f); 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 */ #endif /* __font_h */

View 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, l->xftdraw = XftDrawCreate(ob_display, l->pixmap,
render_visual, render_colormap); 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; break;
case Bitmask: case Bitmask:
if (l->texture[i].data.mask.color->gc == None) if (l->texture[i].data.mask.color->gc == None)